imagepicker+navigationController 在 iphone 中导致问题?
我该怎么做..我有应用程序委托...我在其中通过代码添加了导航控制器...
这是我的代码...
- (void)applicationDidFinishLaunching:(UIApplication *)application {
HomeScreenController *homeScreenobj=[[HomeScreenController alloc] initWithNibName:@"HomeScreen" bundle:[NSBundle mainBundle]];
navController = [[UINavigationController alloc] initWithRootViewController:homeScreenobj];
[homeScreenobj release];
[window addSubview:navController.view];
// Override point for customization after app launch
[window makeKeyAndVisible];
}
在主屏幕上我有一个带有三个按钮的选项卡栏,这是一个图像
我想从 imagepickerController 的库中拍摄照片...但是出现奇怪的问题,
它被添加到主窗口中,我不知道为什么
这里有一个图像
为什么不全屏显示。 ...而且如果我把这行
imagePickerController.allowsImageEditing = YES;
它挂起不知道为什么..这是我拍摄照片的代码....
-(IBAction)TakePhotoClicked
{
imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.allowsImageEditing = YES;
imagePickerController.delegate = self;
imagePickerController.sourceType =
UIImagePickerControllerSourceTypePhotoLibrary;
//self.navigationController.navigationBar.hidden=YES;
[self.navigationController pushViewController:imagePickerController animated:NO];
//[imagePickerController release];
}
如果我不评论这一行 //self.navigationController.navigationBar.hidden=YES;
它显示如下
点击主页按钮返回主页...
how do i do this..i have appliation delegate...in which i added uinavigation controller through code...
here is my code...
- (void)applicationDidFinishLaunching:(UIApplication *)application {
HomeScreenController *homeScreenobj=[[HomeScreenController alloc] initWithNibName:@"HomeScreen" bundle:[NSBundle mainBundle]];
navController = [[UINavigationController alloc] initWithRootViewController:homeScreenobj];
[homeScreenobj release];
[window addSubview:navController.view];
// Override point for customization after app launch
[window makeKeyAndVisible];
}
on homescreen i have a tabbar with three buttons here is an image
i want to take photo from library from imagepickerController...but getting weired issues
it is added to the main window i don't know why
here is an image for this
why this isn't shown fullscreen.... and also if i put this line
imagePickerController.allowsImageEditing = YES;
it hangs don't know why..here is my code to takePhoto....
-(IBAction)TakePhotoClicked
{
imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.allowsImageEditing = YES;
imagePickerController.delegate = self;
imagePickerController.sourceType =
UIImagePickerControllerSourceTypePhotoLibrary;
//self.navigationController.navigationBar.hidden=YES;
[self.navigationController pushViewController:imagePickerController animated:NO];
//[imagePickerController release];
}
if i don't put this line to commented
//self.navigationController.navigationBar.hidden=YES;
it shows like this
where clicking on home button take back to home...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您必须将 UIImagePickerController 呈现为模式视图控制器。因此,不要推送控制器,而是将其呈现为模式:
您可以使用
-[UINavigationController DismissModalViewControllerAnimated:]
弹出图像选择器,以返回到堆栈上的最后一个视图控制器。You have to present the UIImagePickerController as a modal view controller. So don't push your controller, but present it as modal:
You can pop the image picker using
-[UINavigationController dismissModalViewControllerAnimated:]
to go back to the last view controller on the stack.