我在这里遇到了一些问题。对于不同的窗口,我有我的应用程序的主视图。我把它们放在观察视线之外,当它们被要求时它们会动画显示进入视图,我之前从未遇到过这个问题,直到我决定创建一个文本字段。当我单击按钮使视图显示它出现时,但是当我单击文本字段键入并且键盘加载时视图消失,但是如果我单击按钮将视图返回,则文本字段将被输入并准备好输入。有人有任何解决方案?我附上了视图出现方式的下面的代码。
谢谢,
CurtisB
- (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)];
}
答案 0 :(得分:1)
尝试使用以下代码将您想要的subview
置于最前面:
[parentView bringSubviewToFront:childView];
例如,如果要显示VIEW_A
,请在取消隐藏该视图时执行该代码。如果您仍然遇到该问题,请在键盘出现时输入该代码,即UITextfield
委托方法..
如果您仍然卡住,请添加评论..