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
。
添付ファイルが描画される四角形を変更するにはどうすればよいですか?