How do I pass data into an detailView?
I have got an tableView
, so when the cell is tapped it diverts to a DetailViewController. But it doesn´t have any data in it, such as images or text. How do I pass this data to my DetailView?
Code for controllers:
.h file
@interface Sushi : NSObject { IBOutlet UILabel *sushiDescription; IBOutlet UIImageView *sushiPicture; }
@property (nonatomic, retain) IBOutlet UILabel *sushiDescription; @property (nonatomic, retain) IBOutlet UIImageView *sushiPicture;
@end
.m file
@implementation Sushi
@synthesize sushiDescription, sushiPicture;
-(void)dealloc { [sushiDescription release]; 开发者_JAVA技巧 [sushiPicture release]; [super dealloc]; }
@end
For sample do like this,
1) Store any value ex:the indexpath.row vale in appdelegate
2)In DetailViewController's viewDidLoad access the value and display it accordingly
精彩评论