iPad's UIActionSheet showing multiple times

前端 未结 5 1068
栀梦
栀梦 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 07:48

    I found another solution to this. The problem is that when using showFromBarButtonItem, the toolbar view is automatically added to the popover's list of passthrough views. You can modify (and clear) the passthrough views when using a UIPopoverController directly, but not when it's presented as part of a UIActionSheet.

    Anyway, by using showFromRect, there is no toolbar that the popover can automatically add to its passthrough views. So if you know the (approximate) rectangle where your button bar is, you can use something like:

    CGRect buttonRect = CGRectIntersection(toolbar.frame, CGRectMake(0, 0, 60, self.frame.size.height));
    [popupQuery showFromRect:buttonRect inView:self animated:YES];
    

    In the above example, my button is on the left hand side of the toolbar.

提交回复
热议问题