iPad's UIActionSheet showing multiple times

前端 未结 5 974
栀梦
栀梦 2021-02-14 07:22

I have a method called -showMoreTools: which is:

- (IBAction) showMoreTools:(id)sender {
    UIActionSheet *popupQuery = [[UIActionSheet alloc] initWithTitle:nil dele         


        
5条回答
  •  眼角桃花
    2021-02-14 08:00

    My method is similar to christophercotton's.

    In my showActionSheet I check if the actionsheet is visible rather than instantiated:

    - (IBAction)showActionSheet:(id)sender
    {
        if ([self.fullActionSheet isVisible]) {
            [self.fullActionSheet dismissWithClickedButtonIndex:-1 animated:NO];
            _fullActionSheet = nil;
            return;
        }
    
        //actionsheet code
    }
    

提交回复
热议问题