0
点赞
收藏
分享

微信扫一扫

iOS设置背景图片

何以至千里 2022-08-08 阅读 110


1. 使用一个UIImageView实例做子视图,并且放最后面

UIImageView *customBackgournd = [UIImageView alloc] initWithImage:[UIImage imageNamed:@"background.jpg"]];
self.background = customBackground;
[customBackground release];

[self addSubview:background];
[self sendSubViewToBack:background];



2. 

UIImageView *contentView = [UIImageView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]];
[contentView setImage:[UIImage imageNamed:@"background.jpg"]];
[contentView setUserInteractionEnabled:YES];
self.view = contentView;
[contentView release];



3. 

self.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"background.jpg"]];

举报

相关推荐

0 条评论