UISearchDisplayDelegate如何删除这个不透明的视图?

elp*_*elp 0 iphone objective-c uisearchbar uisearchdisplaycontroller ipad

如何以编程方式显示/隐藏UISearchDisplayController中的这个不透明视图?

在此输入图像描述

可能在searchDisplayControllerWillBeginSearchsearchDisplayControllerDidBeginSearch我需要设置一些东西......但是什么?

谢谢.

elp*_*elp 9

临时解决使用UIKeyboardWillAppearNotification.

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillShow) name:UIKeyboardWillShowNotification object:nil];
Run Code Online (Sandbox Code Playgroud)

OpaqueView是一个alpha = 0.8 的UIControl.

- (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;
      }
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

我使用这种可行的方式来临时修复问题......任何其他想法将不胜感激!

谢谢.