我是iPhone新手,我使用AppDelegate创建了使用UITabbarController和4个项目启动的应用程序。通过应用程序打开我的一些看法,我想通过使用类似的代码再重新推出的AppDelegate:通过AppDelegate以编程方式重新启动iphone应用程序
[appdelegate presentModalViewController:myNavController animated:YES];
这可能吗?
这是我AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
NSMutableArray *array = [[NSMutableArray alloc] init];
MaktabatyTableViewController *own = [[MaktabatyTableViewController alloc] initWithStyle:UITableViewStylePlain];
UINavigationController *ownNavController = [[UINavigationController alloc] initWithRootViewController:own];
[array addObject:ownNavController];
NewestTableViewController *newest = [[NewestTableViewController alloc] initWithStyle:UITableViewStylePlain];
UINavigationController *newestNavController = [[UINavigationController alloc] initWithRootViewController:newest] ;
[array addObject:newestNavController];
MostBuyTableViewController *mostbuy = [[MostBuyTableViewController alloc] initWithStyle:UITableViewStylePlain];
UINavigationController *mostbuyNavController = [[UINavigationController alloc] initWithRootViewController:mostbuy];
[array addObject:mostbuyNavController];
FreeBooksTableViewController *free = [[FreeBooksTableViewController alloc] initWithStyle:UITableViewStylePlain];
UINavigationController *freeNavController = [[UINavigationController alloc] initWithRootViewController:free];
[array addObject:freeNavController];
self.tabBarController = [[UITabBarController alloc] init];
self.tabBarController.viewControllers = array;
[self.window setBackgroundColor:[UIColor whiteColor]];
[self.window addSubview:self.tabBarController.view];
self.window.rootViewController = self.tabBarController;
[self.window makeKeyAndVisible];
return YES;
}
在此先感谢。
你的问题的直接答案是“不,你不能”......但你真正想要完成的是什么?例如,如果只是将所有导航控制器设置为其原始根控制器,那并不困难。 –
可能是,你能告诉我一个示例代码来做到这一点吗? – user1553381
也许你可以先告诉我这是你真正想要的。没有规范的代码通常是一个坏主意。 :) –