uiview设置圆角样式
只需在加载时,添加这样的话就可以了:
testView.layer.cornerRadius = 6;
testView.layer.masksToBounds = YES;
注意,需要 import <QuartzCore/QuartzCore.h> 导入,否则,不能识别cornerRadius和masksToBounds。
uiview设置背景图片:
[theMainView setBackgroundColor: [UIColor colorWithPatternImage: [UIImage imageNamed: @"bg.png"]]];
imageName 缓存,下面方法不缓存
NSString *thePath = [[NSBundle mainBundle] pathForResource:@"default" ofType:@"jpeg"];
UIImage *prodImg = [[UIImage alloc] initWithContentsOfFile:thePath"];
controller.productImg.image = prodImg;
[prodImg release];