[英]how can i set a background image in ios objective c to rootViewController?
i can set a background color like : rootViewController.view.backgroundColor = [UIColor colorWithRed:(35.0/255.0) green:(92.0/255.0) blue:(78.0/255.0) alpha:1];我可以设置一个背景颜色,如: rootViewController.view.backgroundColor = [UIColor colorWithRed:(35.0/255.0) green:(92.0/255.0) blue:(78.0/255.0) alpha:1];
how can i set in rootViewController an image background ?如何在 rootViewController 中设置图像背景?
UIViews
are basically backed by CALayer
's so you can apply settings to its properties. UIViews
基本上由CALayer
支持,因此您可以将设置应用于其属性。
UIImage *img = [UIImage imageNamed:@"yourAssetImage"];
rootViewController.view.layer.contents = (__bridge id)img.CGImage;
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.