คำถามติดแท็ก nstextattachment

10
กึ่งกลาง NSTextAttachment image ถัดจาก UILabel บรรทัดเดียว
ฉันต้องการต่อท้ายNSTextAttachmentรูปภาพเข้ากับสตริงที่มาจากแหล่งข้อมูลของฉันและจัดให้อยู่กึ่งกลางในแนวตั้ง ฉันใช้รหัสต่อไปนี้เพื่อสร้างสตริงของฉัน: NSMutableAttributedString *str = [[NSMutableAttributedString alloc] initWithString:DDLocalizedString(@"title.upcomingHotspots") attributes:attrs]; NSTextAttachment *attachment = [[NSTextAttachment alloc] init]; attachment.image = [[UIImage imageNamed:@"help.png"] imageScaledToFitSize:CGSizeMake(14.f, 14.f)]; cell.textLabel.attributedText = [str copy]; textLabelแต่ภาพจะปรากฏขึ้นเพื่อให้สอดคล้องกับด้านบนของของเซลล์ ฉันจะเปลี่ยน rect ที่วาดไฟล์แนบได้อย่างไร
โดยการใช้ไซต์ของเรา หมายความว่าคุณได้อ่านและทำความเข้าใจนโยบายคุกกี้และนโยบายความเป็นส่วนตัวของเราแล้ว
Licensed under cc by-sa 3.0 with attribution required.