Iphone UIAlertView未禁用所有交互

Iphone UIAlertView未禁用所有交互,iphone,objective-c,xcode,ipad,uialertview,Iphone,Objective C,Xcode,Ipad,Uialertview,当显示UIAlertView时,是否可以使用与其他窗口的交互 我想到的解决方案是在UIAlertView窗口上放置一个额外的UIWindow,或者是一个更小的警报 有人对如何实现这一目标有任何建议/解决方案吗 谢谢 编辑: 我必须使用UIAlertView实例。我已经找到了一种方法来识别显示UIAlertView的时刻。只是一个想法,使用您的警报文本和按钮创建自定义视图,并将其显示为UIAlertView。单击按钮隐藏该视图。这将解决你的目的。下面的代码可以用于相同的目的。请根据您的要求调整x/

当显示UIAlertView时,是否可以使用与其他窗口的交互

我想到的解决方案是在UIAlertView窗口上放置一个额外的UIWindow,或者是一个更小的警报

有人对如何实现这一目标有任何建议/解决方案吗

谢谢

编辑:

我必须使用UIAlertView实例。我已经找到了一种方法来识别显示UIAlertView的时刻。

只是一个想法,使用您的警报文本和按钮创建自定义视图,并将其显示为UIAlertView。单击按钮隐藏该视图。这将解决你的目的。下面的代码可以用于相同的目的。请根据您的要求调整x/y/高度/宽度

UIView *customAlert = [[UIView alloc] initWithFrame:CGRectMake(100,100,100,100)];
UILabel *lblText = [[UILabel alloc] initWithFrame:CGRectMake(0,0,100,30)];
lblText.text =@"Your alert text";

[customAlert addSubView:lblText];

UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button addTarget:self action:@selector(hideAlertView:) forControlEvents:UIControlEventTouchDown];
[button setTitle:@"OK" forState:UIControlStateNormal];
button.frame = CGRectMake(30.0, 50.0, 50.0, 50.0);
[customAlert addSubview:button];

[self.view addSubView:customAlert];

-(IBAction)hideAlertView:(id)sender
{
     [customAlert removeFromSuperView];
}
编辑

由于UIAlertView是模态行为,在应用程序的任何其他部分被解除之前,您不能接触它。

Swift解决方案:

  // Define a view
  var popup:UIView!
  func showAlert() {
    // customise your view
    popup = UIView(frame: CGRect(x: 100, y: 200, width: 200, height: 200))
    popup.backgroundColor = UIColor.redColor()

    // show on screen
    self.view.addSubview(popup)

  }

  func dismissView(){
    // Dismiss the view from here
    popup.removeFromSuperview()
  }

好啊这将是我的常规解决方案,但我必须使用UIAlertView实例。我将编辑我的问题。我看到了你的解决方案。就像我说的,我通常会用它。但是你没有使用UIAlertView,我必须(非常糟糕)。。。所以我的问题是,a能否在模式视图上放置视图/窗口?