iPhone tabBar - 我应该如何实现模态视图,以便每次选择选项卡时都会显示?

时间:2011-06-20 16:12:10

标签: iphone uitabbarcontroller modal-dialog uitabbar viewdidload

您能否告诉我实施模态视图的最佳方法,以便每次选择/推送某个标签时它都会出现?因为我当前拥有代码的方式会导致所有后续选择/推送无效。

#import <UIKit/UIKit.h>

@interface SecondViewController : UIViewController <UIImagePickerControllerDelegate, UINavigationControllerDelegate>
{
    UIImage *image;
    IBOutlet UIImageView *imageView;
}

@end

#import "SecondViewController.h"

@implementation SecondViewController

- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    image = [info objectForKey:UIImagePickerControllerOriginalImage];
    imageView.image = image;
    [self dismissModalViewControllerAnimated:YES];
}


// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
    [super viewDidLoad];
    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    [self presentModalViewController:picker animated:YES];
    [picker release];
}

...
@end

1 个答案:

答案 0 :(得分:2)

你可以看看

-(void)viewWillAppear {}