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]; 

posted @ 2016-09-05 15:48  HZ_张雷  阅读(169)  评论(0编辑  收藏  举报