[英]UIView Hides on textfield tap
是我的 UIViewController 的結構,這里是問題場景
名為“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){ }]; }
這個“NewAddressView”視圖包含如圖所示的文本字段。
在點擊文本字段時,“NewAddressView”會自動隱藏,無需編寫額外的代碼來隱藏“NewAddressView”。
只是注意到視圖沒有隱藏它移動到它的原始位置即 CGRectMake(0,500,320,460)。 除了普通的視圖和文本字段,沒有做任何其他事情。
如果有什么我需要補充的,請告訴我。
謝謝
嘗試通過編寫以下內容將視圖帶到前面:
[self.view bringSubviewToFront:self.NewAddressView];
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.