iPad modalPresentationStyle UIModalPresentationFormSheet定位问题 [英] iPad modalPresentationStyle UIModalPresentationFormSheet orientation problem

查看:170
本文介绍了iPad modalPresentationStyle UIModalPresentationFormSheet定位问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



使用modalPresentationStyle时遇到问题。

我在tabbarcontroller的第一个视图控制器的viewDidload中调用以下函数

这样就显示了登录viewController当应用程序启动时


I have problem when using modalPresentationStyle.
I call the following function in my tabbarcontroller's first view controller's viewDidload
So that the login viewController is displayed when app launches

但问题是当我在横向模式下启动应用程序时,我可以正确地看到登录视图,并且我将iPad旋转到纵向模式的背景登录viewcontroller是我的第一个tabbar viewcontroller上升了大约20pixels

But the problem is when I launch app in Landscape mode I can see the login view correctly and I rotate the iPad to portrait mode the background of login viewcontroller that is my First tabbar viewcontroller goes up by about 20pixels

我创建了一个新的应用程序来检查,我发现这只会在我们使用tabbar时发生。

当App以纵向模式启动时,它的效果非常好!


I create a new app to check and I found this will only happend when we use tabbar.
and when App launches in portrait mode its works great!

-(void)gotoCredentials {
Login *objLoginViewController=[[Login alloc] initWithNibName:@"Login" bundle:nil];        
 UINavigationController *objnavigationController = [[UINavigationController alloc] 
                initWithRootViewController:objLoginViewController];       
 objnavigationController.modalPresentationStyle=UIModalPresentationFormSheet;
 objLoginViewController.modalPresentationStyle=UIModalPresentationFormSheet;
 [self  presentModalViewController:objnavigationController animated:YES];
 //[self.tabBarController presentModalViewController:objnavigationController animated:YES];
 [objLoginViewController release];
 objLoginViewController=nil;
 [objnavigationController release];
 objnavigationController=nil;
}

提前感谢!

推荐答案

抱歉通过设置标签栏控制器选择来修复它

sorry it is fixed by setting tabbar controller selection

[m_objTabBarController setSelectedIndex:0];

。我不知道发生在这里。

但我认为这样做是因为在解散FormSheet并更改选项卡然后看起来很好所以我尝试设置tabbar选择索引并且它工作得很好...

after creating tabbar. I dont know that happens here.
But I think to do so is because after dissmiss FormSheet and change the tab then looks fine so I try setting tabbar selected index and it work great...

这篇关于iPad modalPresentationStyle UIModalPresentationFormSheet定位问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆