UITabBarController的使用方法 UINavigationController的使用方法
来源:互联网 发布:买灯具要注意什么 知乎 编辑:程序博客网 时间:2024/04/23 16:44
HomeViewController.m
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [superinitWithNibName:nibNameOrNilbundle:nibBundleOrNil];
if (self) {
// Custom initialization
self.title =@"首页";
self.tabBarItem.badgeValue =@"New";
}
return self;
}
-(void)loadView
{
UIView *view = [[UIViewalloc]initWithFrame:[[UIScreenmainScreen]applicationFrame]];
view.backgroundColor = [UIColorwhiteColor];
self.view = view;
}
//AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindowalloc]initWithFrame:[[UIScreenmainScreen]bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColorwhiteColor];
[self.windowmakeKeyAndVisible];
UILabel *lab = [[UILabelalloc]initWithFrame:CGRectMake(320/2-140/2,80,140, 40)];
lab.text =@"王振";
lab.textAlignment =UITextAlignmentCenter;
lab.backgroundColor = [UIColorblueColor];
[self.windowaddSubview:lab];
//your code
UILabel *label = [[UILabelalloc]initWithFrame:CGRectMake(320/2-140/2,480/2-40/2,140,40)];
label.text =@"Hello World";
label.backgroundColor = [UIColorcyanColor];
label.textAlignment =UITextAlignmentCenter;
[self.windowaddSubview:label];
HomeViewController *view1 = [[HomeViewControlleralloc]init];
UINavigationController *v1 = [[UINavigationControlleralloc]initWithRootViewController:view1];
MessageViewController *view2 = [[MessageViewControlleralloc]init];
UINavigationController *v2 = [[UINavigationControlleralloc]initWithRootViewController:view2];
//NSArray *arr = @[view1,view2,view3,view4];
NSArray *viewControllers = [NSArrayarrayWithObjects:v1,v2,nil];
UITabBarController *mainViewController = [[UITabBarControlleralloc]init];
mainViewController.viewControllers = viewControllers;
//[mainViewController setViewControllers:mainViewController];
//[mainViewController release];
[UIApplicationsharedApplication].applicationIconBadgeNumber =2;
[self.windowsetRootViewController:mainViewController];
return YES;
}
- UITabBarController的使用方法 UINavigationController的使用方法
- UITabBarController的使用方法、 UINavigationController的使用方法、 presentModalViewController的使用方法
- UITabBarController的基本使用方法
- UINavigationController和UITabBarController的集成
- UITabBarController 和 UINavigationController 的 popToRootViewController
- 继承UINavigationController的问题----UITabBarController
- UINavigationController与UITabbarController的样式
- 【iOS开发-UITabBarController】UITabBarController上面的UINavigationController的设置
- iphone--UIViewController/UITabBarController和UINavigationController的结合
- UINavigationController和UITabBarController共存的例子
- UINavigationController和UITabBarController共存的例子
- iOS之UINavigationController与UITabBarController的使用
- UITabBarController 、UIViewController和UINavigationController的简单讲解
- UINavigationController,UIViewController与UITabBarController的整合使用
- UINavigationController和UITabBarController的组合使用
- iOS UINavigationController与UITabBarController的组合使用
- UIViewController、UINavigationController与UITabBarController的整合使用
- iOS UINavigationController与UITabBarController的组合使用
- Dubbo架构设计详解
- Java_语法基础_不要让四舍五入亏了一方
- 连号区间数
- struct和typedefstruct用法简述
- java.lang.Object学习
- UITabBarController的使用方法 UINavigationController的使用方法
- UART中的硬件流控RTS与CTS
- PHP的cURL技术实现课表、成绩等的查询
- Deep Learning(深度学习)学习笔记
- 下部导航类安卓程序架构的实现思想
- strcpy拷贝越界问题(转)
- android系统账户管理(AccountManagerService+AccountAuthenticator)
- Windows下修改Git bash的HOME路径
- 深度探索C++对象模型复习和学习 第五章:构造、析构、拷贝、语意学