如何在uitabbar中使用uiimagepickercontroller?

时间:2011-07-25 11:12:01

标签: iphone

我正在开发一个应用程序。我使用带有5个选项卡的uitabbar和带有4个选项卡的另一个uitabbar。在这两个选项卡之间我放置每个选项卡视图。我用于放置一个uitabbar的选项卡视图的代码

  • (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item {

    如果(item.tag == 0) {

           UIViewController *chkin = [viewController objectAtIndex:0];
    [self.selectedViewController.view removeFromSuperview];
    chkin.view.frame=CGRectMake(0,88, 320,323);
    [self.view addSubview:chkin.view];
    self.selectedViewController = chkin;
    [chkin release];
    

}

否则

如果(item.tag == 1)

{

        UIViewController *chkService = [viewController objectAtIndex:1];
        [self.selectedViewController.view removeFromSuperview];
        chkService.view.frame=CGRectMake(0,88, 320,323);
        [self.view addSubview:chkService.view];
        self.selectedViewController = chkService;
        [chkService release];
    }
    else 
        if(item.tag==2)
        {

            UIViewController *chkDecor = [viewController objectAtIndex:2];
            [self.selectedViewController.view removeFromSuperview];
            chkDecor.view.frame=CGRectMake(0,88, 320,323);
            [self.view addSubview:chkDecor.view];
            self.selectedViewController = chkDecor;
            [chkDecor release];
        }
        else 
            if(item.tag==3)
            {

                UIViewController *chkStaff = [viewController objectAtIndex:3];
                [self.selectedViewController.view removeFromSuperview];
                chkStaff.view.frame=CGRectMake(0,88, 320,323);
                [self.view addSubview:chkStaff.view];
                self.selectedViewController = chkStaff;
                [chkStaff release];

            }
            else 
                if(item.tag==4)
                {
                    UIViewController *chkNotes = [viewController objectAtIndex:4];
                    [self.selectedViewController.view removeFromSuperview];
                    chkNotes.view.frame=CGRectMake(0,88, 320,323);
                    [self.view addSubview:chkNotes.view];
                    self.selectedViewController = chkNotes;
                    [chkNotes release];

                }

}

但主要问题是。在一个标签中包含表格。每个单元格包含用于从相机拍摄图像的imageview。我写的代码如

  • (void)imagePickerController:(UIImagePickerController *)选取器 didFinishPickingMediaWithInfo:(NSDictionary *)info {

    UIImage * image = [info objectForKey:UIImagePickerControllerOriginalImage];

    NSLog(@“选中图像”);  itemimageview.image = image; [self dismissModalViewControllerAnimated:YES];

} 当iam执行此操作时,图像将仅显示最后一个单元格imageview。该选项卡视图隐藏下面的tabbar。所以请告诉我如何使用uitabbar管理imagepicker。

0 个答案:

没有答案