UISearchDisplayDelegate how to remove this opaque view?

前端 未结 4 661
醉话见心
醉话见心 2021-01-16 16:41

how can i programmatically show/hide this opaque view from UISearchDisplayController?

\"enter

4条回答
  •  爱一瞬间的悲伤
    2021-01-16 16:47

    Temporary solved using UIKeyboardWillAppearNotification.

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow) name:UIKeyboardWillShowNotification object:nil];
    

    OpaqueView is an UIControl with alpha = 0.8.

    - (void) keyboardWillShow {
      for( UIView *subview in self.view.subviews ) {
       if( [subview isKindOfClass:[UIControl class]] ) {
          UIControl *v = (UIControl*)subview;
          if (v.alpha < 1) {
            v.hidden = YES;
          }
        }
      }
    }
    

    I used this ORRIBLE way to temporary fix problem.... any other idea will be appreciated!

    thanks.

提交回复
热议问题