以前据说使用autolayout不能修改在代码中修改view的frame问题,通过测试后发现,确实在viewdidload和viewwillapper上不能修改view的尺寸问题,能够在viewdidapper的里面进行修改,app
在使用view.backgroundcolor的时候使用[UIColor colorWithPatternImage:]的时候,须要调节image的大小,这样才能将图片做为背景色显示全。测试
- (UIImage *)resizeImage:(UIImage *)image size:(CGSize)size {spa
UIGraphicsBeginImageContext(size);图片
[image drawInRect:CGRectMake(0, 0, size.width, size.height)];it
UIImage *resizeImage = UIGraphicsGetImageFromCurrentImageContext();autolayout
UIGraphicsEndImageContext();im
return resizeImage;layout
}di