Ios UIView在文本字段点击时隐藏
是我的UIViewController的结构,下面是问题场景Ios UIView在文本字段点击时隐藏,ios,objective-c,iphone,uiview,Ios,Objective C,Iphone,Uiview,是我的UIViewController的结构,下面是问题场景 按添加栏按钮 名为“NewAddressView”(参考图像)的UIView将通过动画打开 - (IBAction)AddAddressAction:(id)sender { [UIView animateWithDuration:0.5 delay:0.1 options: UIViewAnimationOptionCurveEaseOut
- (IBAction)AddAddressAction:(id)sender {
[UIView animateWithDuration:0.5
delay:0.1
options: UIViewAnimationOptionCurveEaseOut
animations:^{
self.NewAddressView.frame = CGRectMake(0, 0, 320, 460);
}
completion:^(BOOL finished){
}];
}
- (IBAction)CloseAddAddress:(id)sender {
[UIView animateWithDuration:0.5
delay:0.1
options: UIViewAnimationOptionCurveEaseOut
animations:^{
self.NewAddressView.frame=CGRectMake(0,500,320,460);
}
completion:^(BOOL finished){
}];
}
谢谢试着写下以下内容,将观点带到前面:
[self.view bringSubviewToFront:self.NewAddressView];
这里有点混乱。。。是否要隐藏
NewAddressView
或重新定位它?如果你想隐藏它,那么我在你的代码中看不到.hidden
属性。也许你连接了一些插座错误?如果你想隐藏,请使用hidden属性!!!!!!我不想隐藏它,但想知道为什么它会移动到它的原始位置,CGRectMake(0500320460),因为当我点击文本字段时,它的位置是self.NewAddressView.frame=CGRectMake(0,0,320,460);那么为什么它会移回原来的位置呢?不,这只会使它位于顶部,但请注意NewAddressView的原来位置是self.NewAddressView.frame=CGRectMake(0500320460);从那里,动画出现在self.NewAddressView.frame=CGRectMake(0,0320460);点击添加新地址,点击文本字段,视图返回底部,这就是为什么它不返回到原始位置的问题。