标签:
//当页面跳转时系统自动调用,segue连线
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {}
segue.sourceViewController 现有界面
segue.destinationViewController 到达界面
segue.identifier 连线标示符
nav.topViewController 栈顶视图(拿到下一界面的属性)
故事版 show方式 取决于上一界面属性 若为UINavigationController 则为压栈出站方法, 若为其他,则为模态视图
(2) 代码跳转到另一个控制器上,根据Identifier进行界面切换
[self performSegueWithIdentifier:@"navgition" sender:sender];
2、自定义Tabbar
- (void)tabbar:(Tabbar *)tabbar selectedAtIndex:(DockItemType)type {
self.selectedIndex = type;
}
3、UIApplication
//单例模式获取应用对象
UIApplication * application = [UIApplication sharedApplication];
//获取AppDelegate对象
AppDelegate * appDelegate = application.delegate;(可以调用在AppDelegate中的方法)
//设置网络连接的指示器的显示和隐藏
// application.networkActivityIndicatorVisible = YES;
//创建通知
// UIUserNotificationSettings * notifi = [UIUserNotificationSettings settingsForTypes:UIUserNotificationTypeBadge categories:nil];
// //为应用注册通知
// [application registerUserNotificationSettings:notifi];
// //设置icon角标(软件右上小红圈)
// application.applicationIconBadgeNumber = 10;
//http:ftp:https: //safiri
//sms: //发短信
//tel: //打电话
//mailto://发邮件
//一定要真机测试
NSURL * url = [NSURL URLWithString:@"mailto://liuyujiahuan@163.com"];
[[UIApplication sharedApplication] openURL:url];
//iOS7之前的方法
//使用它时要设置info.plist,使View controller-based status bar appearance为NO
[[UIApplication sharedApplication] setStatusBarHidden:NO];
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
//iOS7之后设置状态栏的隐藏设在VC里设置的
- (BOOL)prefersStatusBarHidden {
return NO;
}
- (UIStatusBarStyle)preferredStatusBarStyle {
return UIStatusBarStyleLightContent;
}
4、UIWindow
//获取UIWindow的三种方法
UIWindow * window1 = appDelegate.window;
UIWindow * window2 = [[UIApplication sharedApplication] keyWindow];
UIWindow * window3 = self.view.window;
//切换界面(尽量别用)
window3.rootViewController = [[SecondViewController alloc] init];
标签:
原文地址:http://www.cnblogs.com/PSSSCode/p/5271807.html