Iphone dismissModalViewController问题

Iphone dismissModalViewController问题,iphone,ios5,modalviewcontroller,Iphone,Ios5,Modalviewcontroller,我在取消模式视图时遇到了一个问题: 我有一个有五个标签的标签栏。 我在第四个选项卡上,显示一个模态视图。 当我驳回它时。我要第一张账单,但我想留在第四张账单上 要显示我调用此方法的模式,请在父控制器中: [self presentModalViewController:controller animated:YES]; [self dismissModalViewControllerAnimated:YES]; 要隐藏我调用此方法的模式,请在父控制器中: [self presentModal

我在取消模式视图时遇到了一个问题:

我有一个有五个标签的标签栏。 我在第四个选项卡上,显示一个模态视图。 当我驳回它时。我要第一张账单,但我想留在第四张账单上

要显示我调用此方法的模式,请在父控制器中:

[self presentModalViewController:controller animated:YES];
[self dismissModalViewControllerAnimated:YES];
要隐藏我调用此方法的模式,请在父控制器中:

[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];
}

猜测一下(您需要添加更多详细信息):实现
uitabardelegate
的viewController是否在
视图上设置所选项目将显示:
(或调用的其他方法之一?

请为这些调用提供上下文,如果没有看到您的代码,就无法判断发生了什么。我希望您正在与第四个选项卡关联的视图控制器内调用
presentModalViewController
,而不是在显示选项卡栏的视图控制器内。如果您的视图由第四个选项卡显示的滚轮显示模式视图此问题将得到解决。或者是这样吗?@gurooj我正在与第四个选项卡关联的视图控制器中调用
presentModalViewController
。@JoePasq第四个选项卡已显示模式视图,但当我关闭它时,我转到第一个选项卡,我将ike to stay in the fourth关于给定代码的任何内容都不会被认为是明显不正确的。但是,我希望您使用的是自动引用计数,因为所有分配的对象都必须被释放,否则您会造成内存泄漏。这可能是一个问题?不管怎样,都需要解决。还有关于
imgPicker.delegate的一些内容=nil对我来说似乎不合适。我从未使用过它,而且我从未遇到过图像选择器的任何问题。非常感谢,这是问题的根源。