0

Any one have exact solution for passing image from one view to other view when using popview controller in iPhone.

Please give me some guidelines for this problem. Thanks.

12345
  • 157
  • 3
  • 10
  • you can create protocol and pass image. the other way is to store image in appdelegate or any global image object. – ChintaN -Maddy- Ramani Feb 01 '13 at 09:33
  • you can use ivar to pass variables from one class to another class. – Exploring Feb 01 '13 at 09:35
  • POst your code, because now we have to guess what you are doing. With your code we con point out where your problem is. – rckoenes Feb 01 '13 at 09:40
  • what you tried? . if you post some of the code then we can help you. no1 will provide you full code that you want. – ChintaN -Maddy- Ramani Feb 01 '13 at 09:43
  • Here i'm tring to pass cropped image.In first View -(void)btn_Press { croppedViewcontroller* myCropImg = [[croppedViewcontrolleralloc]initWithNibName:@"croppedViewcontroller" bundle:nil]; [myCropImg setScrollView:self.img.image]; [self.navigationController pushViewController:myCropImg animated:YES]; } ////here i'm doing cropping.CGImageRef imageRef=CGImageCreateWithImageInRect([imageview.image CGImage], cropRects); resultImage = [UIImage imageWithCGImage:imageRef]; CGImageRelease(imageRef); targetview.imageview.image = self.image; [self.navigationController popViewControllerAnimated:YES]; – 12345 Feb 01 '13 at 09:49
  • take one uiimage object in appdelegate then when you get cropped image store that image in appdelegate object. so after popview you will get image from that object. protocol is best way if you want to pass image but use this if you dnt know how to make protocol. – ChintaN -Maddy- Ramani Feb 01 '13 at 09:58
  • I had created uiimage object in Appdelegate,set the property and synthesize that.i'm using that object for my cropped image but it will not show the image after popview controller. – 12345 Feb 01 '13 at 10:23
  • i'm also allocated for that uiimage in Appdelegate class. – 12345 Feb 01 '13 at 10:23

2 Answers2

0

Using Protocol Delegate method use the image, or else assign your image to another controller image object and use it.

Madhu
  • 1,542
  • 1
  • 14
  • 30
  • I had set the delegates for the image.but not get the solution. – 12345 Feb 01 '13 at 09:51
  • Did you able to get the reference the object of you passed to app delegate.? – Madhu Feb 01 '13 at 12:04
  • Hmm, You can you use the reference image. Thats the passed object of which you supposed to send ryt. – Madhu Feb 01 '13 at 12:46
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/23775/discussion-between-12345-and-madhu) – 12345 Feb 01 '13 at 13:11
0

suppose your imageview is existingImageView;

.h

@interface SecondController : UIViewController

@property (retain, nonatomic) UIImageView *previousImageView;

.m

@interface SecondController ()

@end

@implementation SecondController @synthasize previousImageView;

Now in firstController while navigating use it like,

SecondController *second = [[SecondController alloc] init];
[self.navigationController pushViewController:second animated:YES];
[second setPreviousImageView:existingImageView];
[photoController release];

After Cropping Image it will reflect to existingImageView.

Madhu
  • 1,542
  • 1
  • 14
  • 30