当我解雇模态视图时,我遇到了问题:
我有一个带有五个标签的tabBar。 我在第四个标签上,我显示一个模态视图。 当我解雇它。我进入第一个标签,但我想留在第四个。
要在父控制器中显示我调用此方法的模态:
[self presentModalViewController:controller animated:YES];
隐藏模态我在父控制器中调用此方法:
[self dismissModalViewControllerAnimated:YES];
我已经尝试调用self.tabBarController / self.navigationController方法而不是self方法,但这是同样的问题。
有人有想法吗?
编辑:
我在第四个标签的控制器中调用方法。
这是上下文:
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
UIImagePickerController *imgPicker = [[UIImagePickerController alloc] init];
imgPicker.allowsEditing = NO;
imgPicker.delegate = self;
switch (buttonIndex) {
case 0: {
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:kMobiglissFromPicker];
imgPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:imgPicker animated:YES];
break;
}
case 1: {
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
[[NSUserDefaults standardUserDefaults] setBool:YES forKey:kMobiglissFromPicker];
imgPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:imgPicker animated:YES];
}
break;
}
}
}
- (void)imagePickerController:(UIImagePickerController *)imgPicker didFinishPickingMediaWithInfo:(NSDictionary *)info {
UIImage *origin = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
UIImage *photo = [origin thumbnailImage:280
transparentBorder:0.0
cornerRadius:0.0
interpolationQuality:kCGInterpolationHigh];
[icon replaceImageWithImage:photo];
[serverProxy updateProfileAvatar:photo];
[self dismissModalViewControllerAnimated:YES];
imgPicker.delegate = nil;
}
- (IBAction)editAvatar:(id)sender {
NSString *camera = [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera] ? [WPLanguage get:@"SignupPhotosheetCamera"] : nil;
UIActionSheet *photoSheet = [[UIActionSheet alloc] initWithTitle:[WPLanguage get:@"SignupPhotosheetTitle"]
delegate:self
cancelButtonTitle:[WPLanguage get:@"CANCEL"]
destructiveButtonTitle:nil
otherButtonTitles:[WPLanguage get:@"SignupPhotosheetGallery"], camera, nil];
[photoSheet showInView:self.view];
}
答案 0 :(得分:4)
只是猜测(您需要添加更多详细信息):实现UITabBarDelegate
的viewController是否在viewWillAppear:
上设置了所选项(或其他方法之一?