iPhone tabBar - 我应该如何实现模态视图,以便每次选择选项卡时都会出现?
您能告诉我实现模态视图的最佳方法,以便每次选择/按下某个选项卡时都会出现模态视图吗?因为我目前的代码方式导致所有后续选择/推送什么都不做。
#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
Could you tell me the best way to implement a Modal view so that it appears each time a certain tab is selected/pushed? Because the way I currently have my code results in all subsequent selections/pushes doing nothing.
#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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你可以看看
You might check out