【问题标题】:presentViewController and UIViewController layoutpresentViewController 和 UIViewController 布局
【发布时间】:2013-08-18 06:58:45
【问题描述】:

我有一个 UIViewController,它有一个父 UITabBarController。 一开始,UIViewController 位于 UITabBarController 上方。从地址簿调用返回后,UIViewController 位于其下方(其高度突然增加)

调用是 [self presentViewController:picker animated:YES completion:nil]

picker 是 ABPeoplePickerNavigationController

谢谢,罗伊

【问题讨论】:

  • 当picker出现时,你的tabBar控制器改变了item(tab)?
  • 不,我之后会回到同一个选项卡更改选项卡事件没有触发
  • 什么是self(它的类是什么)?
  • self 是 UIViewController 控制器树是 UIViewController -> UINavigationController -> UITabBarController
  • 无论何时使用presentViewController:,都应该从全屏视图中调用它。显示一些代码,也许是屏幕截图。

标签: ios uiviewcontroller uitabbarcontroller abpeoplepickerview


【解决方案1】:

说起来很不一样,您需要什么,我们没有您的代码,但我会尽力提供帮助: 尝试将[self presentViewController:picker animated:YES completion:nil]改成开启

[self.navigationController presentViewController:picker animated:YES completion:nil]
//or [anyNavController presentViewController:picker animated:YES completion:nil]

如果没有帮助,请尝试在viewDidLoad 中设置 ViewController 的视图(呈现)高度 或者您可以尝试在没有导航控制器的情况下呈现 newView:

newView.bounds = mainView.bounds; //newView can be nextViewController.view
newView.biunds.size.height=newView.biunds.size.height-  self.navBar.bounds.size.height;//devide navBar height (you can delete this line)                   
newView.frame = CGRectMake(newView.frame.origin.x + 784, newView.frame.origin.y,   newView.frame.size.width, newView.frame.size.height);
[mainView addSubview:newView];

/* Begin transition */
[UIView beginAnimations:@"Slide Left" context:oldView];
[UIView setAnimationDelegate:self];
[UIView setAnimationDelay:0.0f];
[UIView setAnimationDuration:0.5f];
[UIView setAnimationDidStopSelector:@selector(slideInCompleted:finished:context:)];
[UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
newView.frame = CGRectMake(0,0, newView.frame.size.width, newView.frame.size.height);
oldView.frame = CGRectMake(oldView.frame.origin.x - 784, oldView.frame.origin.y,     oldView.frame.size.width, oldView.frame.size.height);
[UIView commitAnimations];

post cmets,你的结果如何。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-02-28
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多