1

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

谢谢,

柯蒂斯

- (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)];  
}
4

1 回答 1

1

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

[parentView bringSubviewToFront:childView];

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

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

于 2015-12-17T11:44:54.660 回答