用代码改变image的渲染颜色
UIImage *theImage = [[UIImage imageNamed:@"icon"] imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
self.imageView.image = theImage;
[self.imageView setTintColor:[UIColor blueColor]];
在我们使用应用的时候,每当有网络请求产生时,我们总是可以在状态栏看到一个转动的网络请求标志。这个标志并不是在网络请求发生的时候自动出现的,需要在代码中手动启动和关闭。
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:YES];// 启动状态栏网络请求指示
[[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:NO];// 关闭状态来网络请求指示
通过storyBoard获取控制器
//OC
UIStoryboard* storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
RootViewController* controller = [storyboard instantiateViewControllerWithIdentifier:@"RootViewController"];
//Swift
let main = UIStoryboard.init(name: "Main", bundle: nil)
if let vc = main.instantiateInitialViewController() as? UITabBarController {
self.show(vc, sender: nil)
}
UIView设置圆角和边框
UIView *view = [[UIView alloc] init];
view.layer.cornerRadius = 5;//或者写view.layer.masksToBounds = YES;
view.clipsToBounds = YES;
view.layer.borderWidth = 1;
view.layer.borderColor = [[UIColor grayColor] CGColor];