-1

I am having a Table with 10 rows and an Images and two labels in Each cell. I want to display the image in a full screen view in other view when user taps on it. Can you help me in that?

4 Answers4

1

create a property of UIImage in the viewController.h where you want to display big image, and synthesise the object in viewController.m file.

Now on didselectRowAtIndexPath method create a instance of the view controller and assign the object to UIImage view property created with a "." operator.

ViewController.h file write the below code:

@property(assign,nonatomic) UIImage *image;

ViewController.m file write the below code :

@synthesize image;

TableViewController.m file write below code in didSelectRowAtIndexPath method :

ViewController *vc = [[[ViewController alloc]init]autorelease];
vc.image = someImage;
[self.navigationController pushToViewController:vc animated:YES];
Raviraj Jadeja
  • 849
  • 6
  • 17
1

for that you have to decalre UIImageView property in second view like below and synthesize it

@interface secondViewController ()
@property (strong, nonatomic) IBOutlet UIImageView *imageToMove;
@end

@implementation secondViewController

@synthesize imageToMove;

.....

@end

now you can access it in your second view by assigning it in first view like below

firstViewController *firstView = [[[firstViewController alloc]init]autorelease];
firstView.imageToMove = someImage;
[self.navigationController pushToViewController:firstView animated:YES];
Haresh Ghatala
  • 1,996
  • 17
  • 25
0

In didSelectRowAtIndex: get the image of the row and add it to what ever view you want to.

Durga Vundavalli
  • 1,790
  • 22
  • 26
0

First create an imageview in second view controller

ImageShowViewcontroller.h

@interface ImageShowViewcontroller ()
@property (assign, nonatomic) IBOutlet UIImageView *SecondViewImageView;
@end

in .m You can synthesize it like below

ImageShowViewcontroller.m

@implementation ImageShowViewcontroller

@synthesize SecondViewImageView;

in FirstView.m in didselectRow() function you can pass the image to ImageShowViewcontroller class like below

FirstView.m

  - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    ImageShowViewcontroller *ImagePass = [[ImageShowViewcontroller alloc]init];

    ImagePass.SecondViewImageView.image=cell.imageView.image;

    [self.navigationController pushViewController:ImageShowViewcontroller animated:NO];


}

In cell.image your pressed row image will be avilable and it will be passed to next view SecondViewImageView throw object of second class. If i did any mistake pls let me know it

Yohan
  • 1,108
  • 9
  • 21