【问题标题】:iOS Keyboard Making View DisappeariOS 键盘使视图消失
【发布时间】:2015-12-17 11:28:17
【问题描述】:

我在这里遇到了一些问题。我有我的应用程序的主要视图,适用于不同的窗口。我已将它们从视线中移开,并且它们会在需要时进行动画处理,在我决定创建一个文本字段之前,我从来没有遇到过这个问题。当我单击按钮将视图带入显示时,它会出现,但是当我单击要键入的文本字段并且键盘加载时,视图会消失,但是如果我单击按钮以使视图返回,则将输入文本字段并准备好输入。有人有任何解决方案吗?我在下面附上了视图出现方式的代码。

谢谢,

柯蒂斯B

- (IBAction)login:(id)sender {

    sidebutton = @"0";
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:0.0];
    [self.blackhide setFrame:CGRectMake(self.blackhide.frame.origin.x -750, self.blackhide.frame.origin.y, self.blackhide.frame.size.width, self.blackhide.frame.size.height)];
    [UIView setAnimationDuration:0.5];
    [self.button2 setFrame:CGRectMake(self.button2.frame.origin.x - 300, self.button2.frame.origin.y, self.button2.frame.size.width, self.button2.frame.size.height)];
    [self.mainview setFrame:CGRectMake(self.mainview.frame.origin.x - 300, self.mainview.frame.origin.y, self.mainview.frame.size.width, self.mainview.frame.size.height)];
    [self.sidebarview setFrame:CGRectMake(self.sidebarview.frame.origin.x - 376, self.sidebarview.frame.origin.y, self.sidebarview.frame.size.width, self.sidebarview.frame.size.height)];
    [UIView setAnimationDuration:0.0];
    [self.loginview setFrame:CGRectMake(self.loginview.frame.origin.x + 376, self.loginview.frame.origin.y, self.loginview.frame.size.width, self.loginview.frame.size.height)];  
}

【问题讨论】:

  • 添加更多代码,即您对文本字段所做的操作
  • 块。基于。动画片。自从。 iOS4。请。谢谢。你。

标签: ios objective-c uiviewanimation ios-keyboard-extension


【解决方案1】:

尝试使用以下代码将您想要的subview 放在最前面:

[parentView bringSubviewToFront:childView];

例如,如果您想显示VIEW_A,请在取消隐藏该视图时执行该代码。如果您仍然遇到该问题,请在键盘出现时输入该代码,即在 UITextfield 委托方法中..

如果您仍然卡住,请添加评论..

【讨论】:

  • 谢谢,这似乎是最好的解决方案。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-07-18
  • 2015-12-16
  • 1970-01-01
  • 1970-01-01
  • 2020-10-21
  • 2019-10-29
相关资源
最近更新 更多