【问题标题】:Subviews are not shown after return from dismiss "mainTabBar" view从关闭“mainTabBar”视图返回后不显示子视图
【发布时间】:2012-10-22 16:57:30
【问题描述】:

我有一个带有两个子视图(1.UIScrollView 和 2.UIView)的 UIView(超级视图),第一个视图是登录表单,第二个视图包含启动动画(带有 UIImageView)。动画完成后,我将其从 superview 中删除,然后,在验证登录后,它会呈现一个新的 TabBarViewController,其中有一个 Home 和其他导航控制器。主页导航控制器有一个注销按钮,注销的动作在tabBarViewController中被称为“注销”方法,这种方法会自行关闭以返回登录表单。

@implementation LoginViewController

MainTabBarViewController *mainTabBarViewController = [[self storyboard] instantiateViewControllerWithIdentifier:@"MainTabBarViewController"];

[self presentViewController: mainTabBarViewController animated: YES completition: nil];

Logout works fine as long as the keyboard is never shown, otherwise the login form doesn´t appear, the superview does.

@implementation MainTabBarViewController

-(void)logout{

[self dismissViewControllerAnimated: YES completition: nil];

}

我注意到 loginView (1.ScrollView) 位于堆栈顶部,并且 hidden 属性为 NO。

有什么想法吗?提前谢谢你

注意:我使用 ARC、故事板和 iOS 5

【问题讨论】:

    标签: iphone uiview keyboard


    【解决方案1】:

    我发现了问题,在我的 loginView 中,我调整 UIScrollView 中的框架以在出现键盘时移动到 TextField 的可见区域,我这样做是注册键盘通知,所以,当键盘出现在某处时,loginView 落入一个不可见区域,所以解决方法是loginView出现时注册键盘通知,消失时注销。

    谢谢你,对不起我的英语!!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-09-17
      • 1970-01-01
      • 2020-11-01
      • 1970-01-01
      • 1970-01-01
      • 2021-10-23
      • 1970-01-01
      相关资源
      最近更新 更多