كيف يمكنني تعيين سحر النائب (٪)؟
-
13-09-2019 - |
سؤال
في الهدف، ج ... أريد أن تمثل فرس النائب (٪) ولكن الكود الخاص بي لا ....
NSString *base = @"<style type=\"test/css\">div{width:100\%}</style><body>%@</body>";
NSString *html = [NSString stringWithFormat:base, @"hello world"];
NSLog(@"%@",html);
- نتوقع: DIV {العرض: 100٪}
- حقيقي: DIV {width: 100}
ما الخطأ؟
المحلول
جرب هذا:
NSString *base = @"<style type=\"test/css\">div{width:100%%}</style><body>%@</body>";
القائمة الكاملة من محددات التنسيق هي هنا.
لا تنتمي إلى StackOverflow