2011-07-08 5 views
0

私はライブラリーで写真を選んでサーバーに送ることができるアプリを書いています。 これは私のコードiOS:写真を選んだ後にビューを切り替える方法は?

 
-(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]; 
} 

私は写真を選ん後、それがページを送信するために変更されることが期待されます。しかし、それはまだホームページに戻ります。

これらの行はどこですか?あなたがイメージを選択すると

 
Send* send = [[Send alloc] initWithNibName:@"Send Email" bundle:nil]; 
    [self presentModalViewController:send animated:YES]; 
    [send release]; 

答えて

0

それはビューコントローラ

- (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]; 

}ここ

+0

それはまだ戻っページにライブラリからロードするボタンが含まれていて。とにかく、助けてくれてありがとう。 –

0
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo{ 
    [picker.parentViewController dismissModalViewControllerAnimated:YES]; 
    self.imgTemp = image; 
..... 

uはNOにそのYESを作るを送信するために移動します。つまり、アニメーションなしでモーダルビューを閉じます。あなたがアニメーションでモーダルビューコントローラを提示した場合は、完成ブロックでそれを解放

+0

ごめんなさいゴマティ。それは私が求めていることではありません。 –

1

、あなたが試すことができます:

Send* send = [[Send alloc] initWithNibName:@"Send Email" bundle:nil]; 
    [self presentViewController:send animated:YES completion:^{ 
     [send release]; 
    }];