如何實現以下效果?如何在圖像中實現背景圖像在UILabel中?
我希望當我的UIImage
寬度小於UILabel
寬度時,我的圖像應該只顯示一次,如下所示。
我已經用UILabel
和UIImage
做了一些更多的工作。參考我以前的問題:How to stretch Image to fill the Label Width set in Background in UILabel?。
但現在我希望有更多的樂趣與UILabel
...:d
編輯:
SBLabel *lbl = [[SBLabel alloc] initWithFrame:CGRectMake(0, 50, 320, 28)];
lbl.text = @"Hello World!!!...";
UIImage *img = [UIImage imageNamed:@"cn3.png"];
UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 50, 320, 28)];
imgView.image = img;
[lbl setNonRepeatingBackgroundImage:imgView];
[self.view addSubview:lbl];
[imgView release];
我想圖像不是作爲不同的控制,但作爲標籤的背景... – DShah 2011-12-27 17:14:00