在 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];