UIActionSheet Crashes on iPad / not iPhone

前端 未结 6 613
-上瘾入骨i
-上瘾入骨i 2021-01-03 16:24

When I look in the console I get this message

2010-09-18 17:04:05.284 Wasted Time[8998:207] *** Assertion failure in -[UIActionSheet showInView:], /SourceCache/UI         


        
6条回答
  •  灰色年华
    2021-01-03 16:30

    do like this:

    [self performSelectorOnMainThread:@selector(choosePhoto) withObject:nil waitUntilDone:NO];
    
    -(void)choosePhoto
    {
    
        UIActionSheet* actionSheet = [[UIActionSheet alloc] initWithTitle:@""
                                                      delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil
                                             otherButtonTitles:@"Take Photo", @"Choose from gallery", nil];
        actionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque;
        actionSheet.tag = 1;
        [actionSheet showInView:self.view];
        [actionSheet release];
    }
    

    Worked for me

提交回复
热议问题