iOS: how to change between views after picking a photos?
I'm writing an App that user can pick a photo in library, send to a server. This is my code
-(IBAction)btnTakePictureClicked {
UIImagePickerController* picker = [[UIImagePickerController alloc] init];
picker.delegate=self;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:picker animated:YES];
[picker release];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo{
[picker.parentViewController dismissModalViewControllerAnimated:YES];
self.imgTemp = image;
// Where should these lines be?
Send* send = [[Send alloc] initWithNibName:@"Send Email" bundle:nil];
[self presentModalViewController:send animated:YES];
[send release];
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
[picker.parentViewController dismissModalViewControllerAnimated:YES];
}
I expected that after picking a photo, it will change to Send page. But, it still back to the home page.
Where should these lines be?
Send* send = [[Send alloc] initWithNibName:@"Send Email" bundle:nil];
[self presentModalViewController:send animated:YES];
[send release];
如果您使用动画呈现模态视图控制器,请将其释放到完整的块中,您可以尝试:
Send* send = [[Send alloc] initWithNibName:@"Send Email" bundle:nil];
[self presentViewController:send animated:YES completion:^{
[send release];
}];
Once you pick image it will move to send View controller
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:UIImage *)image editingInfo:(NSDictionary *)editingInfo{
self.imgTemp = image;
Send* send = [[Send alloc] initWithNibName:@"Send Email" bundle:nil];
[self presentModalViewController:send animated:YES];
[send release];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo{
[picker.parentViewController dismissModalViewControllerAnimated:YES];
self.imgTemp = image;
.....
here u make that YES to NO. ie., dismiss the modalview without animation.
链接地址: http://www.djcxy.com/p/68376.html上一篇: 允许使用UIImagePickerController捕获照片,直到点击取消按钮
下一篇: iOS:在拍摄照片后如何在视图之间切换?
