当我在加载或打开时触发动作表时会出现ios崩溃

时间:2013-11-08 16:10:57

标签: ios7

在视图上触发一个动作表确实在ios 6中加载了但现在它在ios 7上崩溃了。将它移动到viewWillAppear没有帮助。在视图显示后从按钮单击触发操作表可以正常工作。为什么它现在不适用于ios 7?

现在加载视图时,建议自动触发操作表的方法是什么?

 UIActionSheet *actionSheet;
    NSString* title  = @"update your public profile picture";

    if (![UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) {
        actionSheet = [[UIActionSheet alloc] initWithTitle:title delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles: @"Choose Existing Photo",  nil];     
    }
    else {
        actionSheet = [[UIActionSheet alloc] initWithTitle:title delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Take Photo", @"Choose Existing Photo",  nil];   
    }

    [actionSheet showFromRect:CGRectMake(0, 0, [[UIScreen mainScreen]bounds].size.width, [[UIScreen mainScreen]bounds].size.height) inView:self.view animated:YES];

0 个答案:

没有答案