UITabBarController


 /*UITabBarController
     //实例化三个controller
     MyViewController1 *vc1 = [[MyViewController1 alloc]init];
     MyViewController2 *vc2 = [[MyViewController2 alloc]init];
     // MyViewController3 *vc3 = [[MyViewController3 alloc]init];
     
     //实例化一个导航,导航管理vc2,vc3 两个页面
     UINavigationController *nc = [[UINavigationController alloc]initWithRootViewController:vc2];
     [vc2 release];
     
     //将多个Controller 加入数组
     NSMutableArray *array = [NSMutableArray arrayWithObjects:vc1,nc,nil];
     [vc1 release];
     [nc release];
     
     //创建UITabBarController
     UITabBarController *tc = [[UITabBarController alloc]init];
     
     tc.viewControllers = array;//tc控制vc1根nc;
     
     self.window.rootViewController = tc;
     
     
     UITabBarItem *item = [[UITabBarItem alloc]initWithTitle:@"ab" image:[UIImage imageNamed:@""] tag:8];
     nc.tabBarItem = item;
     [item release];
     UITabBarItem *item2 = [[UITabBarItem alloc]initWithTabBarSystemItem:UITabBarSystemItemMore tag:1];
     vc1.tabBarItem = item2;
     [item2 release];
     [tc release];
     
     //视图二中的代码
     -(void)viewDidLoad{
     
     self.view.backgroundColor = [UIColor yellowColor];
     
     UIBarButtonItem *rightButton = [[UIBarButtonItem alloc]initWithTitle:@"next" style:UIBarButtonItemStylePlain target:self action:@selector(click:)];
     self.navigationItem.rightBarButtonItem = rightButton;
     }
     
     -(void)click:(UIBarButtonItem *)rightButton{
     MyViewController3 *vc3 = [[MyViewController3 alloc]init];
     [self.navigationController pushViewController:vc3 animated:YES];
     [vc3 release];
     
     }     */
    
    
    /*UIscollView实现图片在视图中的拖放
     -(void)viewDidLoad{
     [super viewDidLoad];
     
     UIScrollView *sv = [[UIScrollView alloc]initWithFrame:CGRectMake(0, 0, 320, 460)];
     [self.view addSubview:sv];
     sv.contentSize = CGSizeMake(1204, 768);//定义后面画布的大小
     
     UIImageView *imageview = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 1024, 768)];
     imageview.image = [UIImage imageNamed:@"2f5b11ee9df2a856fcfa3cac.jpg"];
     [sv addSubview:imageview];
     [sv release];
     [imageview release];
     
     //获取原比例
     NSLog(@"%f,%f",imageview.image.size.width,imageview.image.size.height);
     }     */
    
    
    
    /*tabBarController的代理方法
     -(BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController{
     NSLog(@"should select");
     return YES;
     }
     -(void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController{
     NSLog(@" select");
     }
     - (void)tabBarController:(UITabBarController *)tabBarController willBeginCustomizingViewControllers:(NSArray *)viewControllers{
     NSLog(@"willBeginCustom");
     }
     -(void)tabBarController:(UITabBarController *)tabBarController willEndCustomizingViewControllers:(NSArray *)viewControllers changed:(BOOL)changed{
     NSLog(@"will ending %d",changed);
     }
     -(void)tabBarController:(UITabBarController *)tabBarController didEndCustomizingViewControllers:(NSArray *)viewControllers changed:(BOOL)changed{
     NSLog(@"did ending %d",changed);
     }     
     
     */
    
    
    /*
     //本地保存;可以保存五种类型
     // NSString NSArray NSDictionary NSNumber NSData 
     NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
     [userDefaults setObject:@"abc" forKey:@"A"];
     [userDefaults synchronize];//同步操作方法
     
     NSUserDefaults *userd = [NSUserDefaults standardUserDefaults];
     NSString *str = [userd objectForKey:@"A"];
     NSLog(@"%@",str);
     
     
     NSMutableArray *array = [NSMutableArray arrayWithCapacity:0];
     for(int i = 0;i < 10 ;i++){
     UIViewController *vc = [[UIViewController alloc]init ];
     vc.view.backgroundColor = [UIColor redColor];
     [array addObject:vc];
     [vc release];
     
     UITabBarItem *item = [[UITabBarItem alloc]initWithTitle:[NSString stringWithFormat:@"%d",i] image:nil tag:i];
     vc.tabBarItem = item;
     item.badgeValue = @"ad";//气泡,可以用于消息提示
     [item release];
     }
     
     UITabBarController *tc = [[UITabBarController alloc]init];
     tc.viewControllers = array;
     self.window.rootViewController = tc;
     [tc release];
     //超过5页,自动加如更多,导航;可以移动显示顺序
     //具有5个代理方法,见下文
     tc.delegate = self;
     
     //
     NSUserDefaults *userDefault = [NSUserDefaults standardUserDefaults];
     NSMutableArray *numArray = [userDefaults objectForKey:@"array"];
     if(numArray != nil){
     NSMutableArray *newArray = [NSMutableArray arrayWithCapacity:0];
     for(NSNumber *num in numArray){
     UIViewController *vc = [array objectAtIndex:[num intValue]];
     [newArray addObject:vc];
     }
     array = newArray;
     }
     
     return YES;
     }
     
     */

优质内容筛选与推荐>>
1、github基础
2、游戏机制(Machinations)在线演示工具
3、文件系统的发展
4、rem屏幕自适应
5、Atlas—微软的Ajax工具包(来自MSDN Scott Guthrie)


长按二维码向我转账

受苹果公司新规定影响,微信 iOS 版的赞赏功能被关闭,可通过二维码转账支持公众号。

    阅读
    好看
    已推荐到看一看
    你的朋友可以在“发现”-“看一看”看到你认为好看的文章。
    已取消,“好看”想法已同步删除
    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号