此代码工作正常在iPhone上,但在iPad上的actionsheet是显示屏幕的中间了。 未在触发按钮的角落。 还没有取消按钮显示出来。
此外,应用程序只在横向模式。 相机触发按钮在屏幕的右上角。
mediaPicker = [[UIImagePickerController alloc] init];
mediaPicker.allowsEditing = YES;
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Take photo", @"Choose Existing", nil];
//[actionSheet showInView:self.view];
[actionSheet showInView:self.navigationController.view];
}
// If device doesn't has a camera, Only "Choose Existing" and "Cancel" options will show up.
else {
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil
delegate:self
cancelButtonTitle:@"Cancel"
destructiveButtonTitle:nil
otherButtonTitles:@"Choose Existing", nil];
[actionSheet showInView:self.view];
}
我需要actionsheet现身其中按钮。 我应该如何去做。