简体   繁体   English

UIView 隐藏在文本字段点击

[英]UIView Hides on textfield tap

这个

is the structure of my UIViewController, here is the problem scenario是我的 UIViewController 的结构,这里是问题场景

  1. Pressing Add bar button按添加栏按钮
  2. UIView named "NewAddressView" (refer image) is opened with animation名为“NewAddressView”(参考图片)的 UIView 以动画方式打开

    - (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){ }]; }
  3. This "NewAddressView" view contains textfield as shown in image.这个“NewAddressView”视图包含如图所示的文本字段。

  4. On tapping the textfield the "NewAddressView" hides automatically, no extra code is written to hide "NewAddressView".在点击文本字段时,“NewAddressView”会自动隐藏,无需编写额外的代码来隐藏“NewAddressView”。

  5. Just noticed that the view does not hide it moves to its original position ie CGRectMake(0,500,320,460).只是注意到视图没有隐藏它移动到它的原始位置即 CGRectMake(0,500,320,460)。 There is nothing else done just normal view and textfield.除了普通的视图和文本字段,没有做任何其他事情。

Kindly let me know if there is anything I have to add.如果有什么我需要补充的,请告诉我。

Thanks谢谢

尝试通过编写以下内容将视图带到前面:

[self.view bringSubviewToFront:self.NewAddressView];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM