簡體   English   中英

UIView 隱藏在文本字段點擊

[英]UIView Hides on textfield tap

這個

是我的 UIViewController 的結構,這里是問題場景

  1. 按添加欄按鈕
  2. 名為“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. 這個“NewAddressView”視圖包含如圖所示的文本字段。

  4. 在點擊文本字段時,“NewAddressView”會自動隱藏,無需編寫額外的代碼來隱藏“NewAddressView”。

  5. 只是注意到視圖沒有隱藏它移動到它的原始位置即 CGRectMake(0,500,320,460)。 除了普通的視圖和文本字段,沒有做任何其他事情。

如果有什么我需要補充的,請告訴我。

謝謝

嘗試通過編寫以下內容將視圖帶到前面:

[self.view bringSubviewToFront:self.NewAddressView];

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM