2016-05-03 51 views

回答

1

這是以防有人的答案發現它有用----->

NSTextAttachment *attachment = [[NSTextAttachment alloc] init]; 
    attachment.image = [UIImage imageNamed:@"Attach-52.png"]; 

    NSAttributedString *attachmentString = [NSAttributedString attributedStringWithAttachment:attachment]; 

    NSMutableAttributedString *myString= [[NSMutableAttributedString alloc] initWithString:@"My label text"]; 
    [myString appendAttributedString:attachmentString]; 

    myLabel.attributedText = myString; 

同樣可以通過添加NSAttributedString png圖片。

相關問題