我有一个带有两个视图控制器的 UItabbarController。当我单击一个视图控制器中的登录按钮时,它应该将我带到另一个 tabbarController。发生这种情况时,我会在当前 tabbarcontroller 的顶部获得第一个视图控制器,它看起来像另一个视图控制器。它在 iPhone 6.0 模拟器中运行良好,但如 iPhone 5.0 模拟器中所述失败。
在 appDelegate.m 中:
- (void)sessionStateChanged:(FBSession *)session
state:(FBSessionState) state
error:(NSError *)error
{
switch (state) {
case FBSessionStateOpen:
if (!error) {
if(UI_USER_INTERFACE_IDIOM()==UIUserInterfaceIdiomPhone)
{
FLogin *flogin=[[FLogin alloc]initWithNibName:@"FLogin" bundle:nil];
self.window.rootViewController=fblogin; // I think because of this I m getting this issue
}
}
}
在flogin.m
tab=[[[UITabBarController alloc]init]autorelease];
ViewController *searchViewController=[[[ViewController alloc]initWithNibName:@"ViewController" bundle:nil]autorelease];
Account *account=[[[Account alloc]initWithNibName:@"Account" bundle:nil]autorelease];
account.title=@"My Account";
tab.viewControllers=[NSArray arrayWithObjects:searchViewController,account,nil];
for(UIViewController *tab1 in tab.viewControllers)
{
if ([[[UIDevice currentDevice] systemVersion] floatValue]>5.0 ||[[[UIDevice currentDevice] systemVersion] floatValue]==5.0)
{
[tab.tabBarItem setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[UIFont fontWithName:@"TimesNewRomanPS-BoldMT" size:16.0], UITextAttributeFont, nil]
forState:UIControlStateNormal];
}
}
[self presentModalViewController:tab animated:NO];