2010-11-23 63 views
0

我有一个tableView,所以当单元格被轻敲时,它转移到DetailViewController。但它没有任何数据,如图像或文本。我如何将这些数据传递给我的DetailView?如何将数据传递到detailView?

代码控制器:

h文件

@interface寿司:NSObject的{ IBOutlet中的UILabel * sushiDescription; IBOutlet UIImageView * sushiPicture; }

@property(nonatomic,retain)IBOutlet UILabel * sushiDescription; @property (非原子,保留)IBOutlet UIImageView * sushiPicture;

@end

.m文件

@implementation寿司

@synthesize sushiDescription, sushiPicture;

- (void)dealloc {[sushiDescription release]; [寿司照片发布]; [super dealloc]; }

@end

+0

还有一件事,我是初学者,所以请您在回答时深入讨论。 – Souljacker 2010-11-23 15:29:10

+0

可能的重复http://stackoverflow.com/questions/1338028/pass-data-to-object-of-uiviewcontroller-on-iphone,http://stackoverflow.com/questions/1174285/cocoa-touch-uiviewcontroller-属性和类设计等... – Anna 2010-11-23 16:15:49

回答

2

对样品做这样的,

1)存储任何值ex:在的appdelegate

2)在DetailViewController的viewDidLoad的indexpath.row访问谷值和相应地显示它