按下按钮后如何保持LGAlertView显示?

时间:2016-02-15 02:15:15

标签: ios objective-c uialertview

我将委托设置为self并添加了

这里也是我的代码:

LGAlertView *alertView = [[LGAlertView alloc]initWithViewAndTitle:@"title" message:nil style:LGAlertViewStyleActionSheet view:view buttonTitles:@[@"Button 1"] cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil
            actionHandler:^(LGAlertView *alertView, NSString *title, NSUInteger index)
        {
        NSLog(@"actionHandler, %@, %lu", title, (long unsigned)index);
        }
        cancelHandler:^(LGAlertView *alertView) {
        NSLog(@"cancelHandler");
        }
        destructiveHandler:^(LGAlertView *alertView) {
        NSLog(@"destructiveHandler");
        }];

        [buyView setCancelOnTouch:NO];

        [buyView setDelegate:self];

        NSLog(@"%d",buyView.cancelOnTouch);
        [buyView showAnimated:YES completionHandler:nil];

当我按下按钮时,它仍然会关闭视图

当视图被取消时,它会显示在日志-[LGAlertView dealloc] [Line 972]

1 个答案:

答案 0 :(得分:0)

答案是设置alert.dismissOnAction = NO;