【发布时间】:2013-04-05 13:31:52
【问题描述】:
我有一个带有两个视图控制器的 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];
【问题讨论】:
-
您是否正在更改您的根视图控制器以响应登录?
-
我只在 iOS 5.1、iOS 5、iOS 4.3 和 iOS 6 中遇到这个问题
-
可能是我的应用程序中是否有任何仅包含在 iOS 6 中的功能
-
我在该视图中有一个登录视图我有一个 Facebook 登录选项如果点击这个我的应用程序主屏幕应该出现但我的问题是我的主屏幕出现在登录视图中跨度>
-
@siva,我们需要更多地了解该问题以更好地帮助您。编辑您的原始帖子并提供:1)有关“所描述的失败”的含义的更详细信息。有错误信息吗?如果是这样,请发布它。应用程序会崩溃吗?如果有,在哪一行。等等... 2) 来自 AppDelegate 的 .h 和 .m 文件的完整代码(或者您正在执行导致错误的逻辑的任何位置)。