UILabel
iOSアプリケーションを開発していますが、このような画像のスタイルを設定したいと思います。画像http://img4.hostingpics.net/thumbs/mini_388558Capturedcran20120629142330.png
これを行うことは可能ですか?
UILabel
iOSアプリケーションを開発していますが、このような画像のスタイルを設定したいと思います。画像http://img4.hostingpics.net/thumbs/mini_388558Capturedcran20120629142330.png
これを行うことは可能ですか?
解決策は、通常どおりにを作成してから、の空の部分の上にUILabel
黒を配置することです。テキストのフォントのサイズに基づいて、実際に配置する場所を計算できます。UIView
UILabel
解決策は、ラッパー UIView のサブビューとして UILabel を追加することです
// Using ARC
// Set Wrapper
CGRect wrapperFrame = CGRectMake(0, 0, 320, 80);
UIView *specialLabel = [[UIView alloc] initWithFrame:wrapperFrame];
[specialLabel setBackgroundColor:[UIColor blackColor]];
// Set Content
CGFloat padding = 10;
CGRect contentFrame = CGRectInset(wrapperFrame, padding, padding);
UILabel *contentLabel = [[UILabel alloc] initWithFrame:contentFrame];
[contentLabel setBackgroundColor:[UIColor greenColor]];
// Append content to wrapper
[specialLabel addSubview:contentLabel];