iPhone开场动画及初始化带有导航(UINavigationController)的标签栏控制器(UITabBarController)
- 博客分类:
- iPhone开发
很多程序需要开场动画,但仅仅用Default.png又满足不了自己的需求,如时间太短.解决其最好的办法就是加一个ViewController,我这起名为OpeningViewController.
在AppDelegate.h里面声明:
在AppDelegate.m中如下:
在-(void) setupUI;中设置界面的UI.我这里是初始化一个带有导航(UINavigationController)的标签栏控制器(UITabBarController),如下:
在AppDelegate.h里面声明:
OpeningViewController *openingViewController; ... @property (nonatomic, retain) OpeningViewController *openingViewController;
在AppDelegate.m中如下:
- (void)applicationDidFinishLaunching:(UIApplication *)application { if(openingViewController == nil) openingViewController = [[OpeningViewController alloc] initWithNibName:@"OpeningViewController" bundle:nil]; [window addSubview:openingViewController.view]; [window makeKeyAndVisible]; NSAutoreleasePool *pool=[[NSAutoreleasePool alloc] init]; [self performSelectorInBackground:@selector(removeOpeningView) withObject:nil]; [pool release]; return YES; } -(void) removeOpeningView { NSAutoreleasePool *pool=[[NSAutoreleasePool alloc] init]; [NSThread sleepForTimeInterval:3]; //[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:YES]; [self setupUI]; [[UIApplication sharedApplication] setStatusBarHidden:NO animated:YES]; [pool release]; }
在-(void) setupUI;中设置界面的UI.我这里是初始化一个带有导航(UINavigationController)的标签栏控制器(UITabBarController),如下:
-(void) setupUI { UIColor *titleBarColor=[UIColor colorWithRed:0.0/255.0 green:173.0/255.0 blue:238.0/255.0 alpha:1.0]; //TabBar Item 1 mainDirectoryViewController = [[MainDirectoryViewController alloc] initWithNibName:@"MainDirectoryViewController" bundle:nil]; if (mainDirNavController == nil) mainDirNavController = [[UINavigationController alloc] initWithRootViewController:mainDirectoryViewController]; mainDirNavController.navigationBar.tintColor = titleBarColor; //TabBar Item 2 bookmarkViewController = [[BookmarkViewController alloc] initWithNibName:@"BookmarkViewController" bundle:nil]; if (bookmarkNavController == nil) bookmarkNavController = [[UINavigationController alloc] initWithRootViewController:bookmarkViewController]; bookmarkNavController.navigationBar.tintColor = titleBarColor; //TabBar Item 3 aboutViewController = [[AboutViewController alloc] initWithNibName:@"AboutViewController" bundle:nil]; if (aboutNavController == nil) aboutNavController = [[UINavigationController alloc] initWithRootViewController:aboutViewController]; aboutNavController.navigationBar.tintColor = titleBarColor; UITabBarItem *customItem1 = [[UITabBarItem alloc] initWithTitle:@"学习" image:[UIImage imageNamed:@"some.png"] tag:0]; UITabBarItem *customItem2 = [[UITabBarItem alloc] initWithTitle:@"书签" image:[UIImage imageNamed:@"some.png"] tag:1]; UITabBarItem *customItem3 = [[UITabBarItem alloc] initWithTitle:@"关于" image:[UIImage imageNamed:@"some.png"] tag:2]; mainTabBar = [[UITabBarController alloc] init]; mainTabBar.delegate = self; mainTabBar.viewControllers = [NSArray arrayWithObjects:mainDirNavController, bookmarkNavController, aboutNavController, nil]; mainDirNavController.tabBarItem = customItem1; bookmarkNavController.tabBarItem = customItem2; aboutNavController.tabBarItem = customItem3; [customItem1 release]; [customItem2 release]; [customItem3 release]; [window addSubview:mainTabBar.view]; }
发表评论
-
选取相册视频,并获得路径。
2012-07-18 10:18 1658- (NSString*)videoAssetURLT ... -
ad-hoc及企业版app打包之后在itunes中图标为白色的问题
2012-07-03 16:36 1245准备512*512大小的png(将要显示的图片),在终端执行以 ... -
iOS工具类之16进制颜色转为UIColor
2012-06-27 16:33 6710将16进制颜色如#FF0000,转换为UIColor: ... -
调试内存问题
2012-06-12 10:14 677Project -> Edit Scheme -> ... -
[转]iOS开发之详解剪贴板
2011-12-05 11:43 1468概述: 在iOS中, ... -
过滤html标签(修改版)
2011-12-01 10:44 1263- (NSString *)flattenHTML:(NS ... -
[转] iPhone:UIImage 图像截取,等比例缩放
2011-09-29 10:02 7767@interface UIImage(UIImageSc ... -
[转载]iPhone文件系统NSFileManager
2011-09-09 11:41 1016iPhone文件系统:创建、重命名以及删除文件 NSFile ... -
UIImage用imageNamed的内存问题
2011-09-08 09:33 1226@implementation UIImage(imageNa ... -
截屏存图片到相册或者指定路径
2011-06-13 11:15 2711#import <QuartzCore/Quartz ... -
存图片和视频到iPhone相册
2011-04-19 09:33 7593UIImage *img = [UIImage i ... -
选择相册图片并保存
2011-04-19 08:18 1757.h中: <UINavigationControl ... -
Push一个横屏页面
2011-03-28 16:39 2052[[UIDevice currentDevice] setOr ... -
NSPredicate及正则的一点使用
2011-03-21 14:38 6870记录一点正则表达式的使用。 例如:判断字符串首字母是否为字母 ... -
建立到服务器的连接
2011-02-14 10:47 1312在Mac OS X上,可以使用NSHost和NSS ... -
iPhone中的Sqlite3数据库操作
2010-12-27 09:38 1286可将数据库操作写入一个类,这样用起来也很方便。例如: ... -
Cocos2d游戏场景切换
2010-12-15 09:51 2614在游戏中,我们需要点击菜单选项进入相应的画面,而我们常 ... -
NSNotificationCenter随笔
2010-12-10 13:21 1469可在AppDelegate.h中定义,之后可全局使用。 ... -
Category的使用
2010-12-09 16:17 1011Category的用法有时使得程序很方便,可将已有的类 ... -
iPhone判断是否接入网络
2010-12-06 10:41 2346在这里介绍一种较为简单的判断是否连接网络的方法,首先要引入 ...
相关推荐
我们写iOS项目的时候,基本都是一个UINavigationController套一个UITabBarController的形式,就是上面一个导航栏,下面几个按钮的工具条的形式。我写了几个应用,发现如果每次都重新写的话完全就是浪费精力和时间,...
页面跳转 UITabBarController+UINavigationController+UIViewController
很多时候我们创建一个基于UITabBarController的application以后还希望能够在每个tab view都可以实现导航控制,即添加一个UINavigationController来实现tabview内部的view之间的切换,这即是本文所要介绍的。
iOS 自定义UINavigationController和UITabBarController
一个小demo,演示如何隐藏tabbar
UITabBarController和UINavigationController的整合使用DEMO,详情见:http://blog.csdn.net/hwe_xc/article/details/50588500
1、首先在程序入口界面AppDelegate中添加导航栏控制器,并且创建根视图控制器RootViewController 2、其次就是对导航堆栈进行页面的pop和push了 3、再次就是对每个页面进行导航按钮的设置 4、注意,本页面只能设置...
自定义UITabBar,layoutSubviews重写UITabBarButton位置,重写则hitTest方法并监听按钮的点击 自定义的UITabBarController和UINavigationController
做了这么长时间的ios开发了,最基本的UITabBarController和UINavigationController都用了好长时间了,总是改现成的代码,或者各种自定义控件的修改,用的都有些混乱了,呵呵。还是自己做个demo再复习一下吧,记录...
UINavigationController导航控制器
IOS 导航 UINavigationController,说明了setBackBarButtonItem,setRightBarButtonItem,setLeftBarButtonItem,setTitleView
NULL 博文链接:https://stephen830.iteye.com/blog/1699184
2、一般导航条的返回按钮需要自定义,一般除了栈底控制器有导航条,其他控制器都需要隐藏底部的条,可以重写pushViewController:animated:方法,在该方法中实现该功能 3、导航控制器右滑返回效果(触摸屏幕的任意...
多控制器和导航控制器简单介绍 一、多控制器 一个iOS的app很少只由一个控制器组成,除非这个app极其简单。当app中有多个控制器的时候,我们就需要对这些控制器进行管理 有多个view时,可以用一个大的view去管理1个或者...
导航控制器(UINavigationController)用来管理一系列显示层次型信息的场景。一般而言,逐步显示更详细的信息。 导航控制器 -- 用户在场景之间切换时,导航控制器依次将视图控制器压入(push)堆栈中,且当前场景的...
详情请看博客http://blog.csdn.net/ecjtuacm_yuewei/article/details/69400245
如何根据被推送的视图控制器的大小设置包含 UINavigationController 的 UIPopoverController 的大小调整动画? 通常,在要使用UIPopoverController呈现的视图控制器上设置preferredContentSize足以触发...
iOS中present出一个透明导航控制器NavigationController 的方法+毛玻璃效果
实现UINavigationController和UITabBarController结合的一个小例子