我創建了一個HTML屬性串像這樣:iOS版 - NSAttributedString標記化到localization.string元素
NSString * htmlString = @"<html><body> Some html string <sup>MD</sup></body></html>";
NSAttributedString * attrStr = [[NSAttributedString alloc] initWithData:[htmlString dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType } documentAttributes:nil error:nil];
現在我有了這樣的令牌的本地化字符串:
"greeting_label" ="reeveBeets%s \n are awesome";
如何我是否使用我創建的屬性html文本替換%s,並將其放在我作爲名爲_label的iboutlet的標籤中?
另外,IBOutlets不高德,正因爲如此,一個IBOutlet應該永遠不要預先加上_。您的標籤應該被命名爲標籤,而不是_label。 – TheCodingArt
xcode爲我合成它。所以在我的.h文件中調用標籤,但是當我在代碼中使用它時,我使用_label。你怎麼看? – j2emanue
是的,沒關係使用self.property,它不涉及實例變量,getter/setter副作用,init或dealloc。但沒關係。 – TheCodingArt