ITeye博客

iphone开发--大区域中平铺(非拉伸)图片

lpluck08 · 2012-11-10 22:14 · 移动研发 · C/Object-C · xcode/iphone · xcode/ipad · 移动开发 · Markdown

创建一个UIView的子类,在- (void)drawRect:(CGRect)rect中写入

[[UIImage imageNamed:@"123.png"] drawAsPatternInRect:rect];

 

并在- (id)initWithFrame:(CGRect)frame中写入

[self setBackgroundColor:[UIColor clearColor]];
[self setNeedsDisplay];

 

在调用的地方直接调用- (id)initWithFrame:(CGRect)frame即可。

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。