2
Facebook 또는 경로 앱에서 볼 수있는 것처럼 슬라이딩 메뉴로 작업하고 있습니다.UIModalViewController UIViewController 뒤에 숨김
후면 메뉴에서 사용자가 카메라 또는 사진 라이브러리를 사용하여 이미지를 추가 할 수있게하려고합니다.
내가 가지고있는 문제는 슬라이드하는 주보기 컨트롤러가 항상 맨 위에 있다는 것입니다.
액션 시트는 훌륭하게 표시되지만 모달 뷰 컨트롤러는 메인 뷰 컨트롤러에 의해 부분적으로 숨겨져 있습니다.
여기 내 피커 코드입니다 :
- (void)viewDidLoad
{
[super viewDidLoad];
_UIPicker = [[UIImagePickerController alloc] init];
_UIPicker.delegate = self;
}
- (IBAction)profilePicButtonTapped
{
UIActionSheet * actionSheet = [[UIActionSheet alloc] initWithTitle:@"Set Up Your Profile Picture" delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:nil otherButtonTitles:@"Camera", @"Photo Library", nil];
actionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque;
[actionSheet showInView:_rearTableView];
}
-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (buttonIndex == 0)
{
_UIPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentViewController:_UIPicker animated:YES completion:nil];
}
else if (buttonIndex == 1)
{
_UIPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentViewController:_UIPicker animated:YES completion:nil];
}
else
{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"Error" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:nil];
[alert show];
}
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage * selectedImage = [info objectForKey:UIImagePickerControllerOriginalImage];
_profileImageView.image = selectedImage;
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
[picker dismissViewControllerAnimated:YES completion:nil];
}
그래도 속성을 YES로 설정하면 기본 ViewController가 숨겨지지 않습니다. 달성하고자하는 가장 좋은 예는 GroupMe 앱과 그룹스 프로필 이미지 설정 방법입니다. –