一、隐藏状态栏
-(BOOL)prefersStatusBarHidden{ return YES; }
二、在有navigation下的公共视图在添加按钮等控件的时候就不会偏移64
self.automaticallyAdjustsScrollViewInsets = NO;
三、隐藏tabBar的方法
//1.设置self.tabBarController.tabBar.hidden=YES; self.tabBarController.tabBar.hidden=YES; //2.如果在push跳转时需要隐藏tabBar,设置self.hidesBottomBarWhenPushed=YES; self.hidesBottomBarWhenPushed=YES; NextViewController *next=[[NextViewController alloc]init]; [self.navigationController pushViewController:next animated:YES]; self.hidesBottomBarWhenPushed=NO; //并在push后设置self.hidesBottomBarWhenPushed=NO; //这样back回来的时候,tabBar会恢复正常显示。
四、判断字典某个元素是否为空
[dict[@"name"] isKindOfClass:[NSNull class]];
五、添加导航栏
ViewController * mainVC = [[ViewController alloc] init]; UINavigationController * nav = [[UINavigationController alloc] initWithRootViewController:mainVC]; self.window.rootViewController = nav;
六、UIView添加背景颜色
UIColor *bgColor = [UIColor colorWithPatternImage: [UIImage imageNamed:@"bg.jpg"]]; self.view.backgroundColor = bgColor;