ユーザーがUITableViewControllerで行を選択したときに、別のviewControllerにセグエし、そのUIImageViewを以前に設定された画像に設定したいと思います。今のところ、私はそれを一般的にしています-常に/images/en.jpegを表示します。
flickrTVC.m(UITableViewController):
@implementation flickrTVC
...
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([segue.identifier isEqualToString:@"showPhoto"])
UIImage *photo = [UIImage imageWithContentsOfFile:@"images/en.jpeg"];
[segue.destinationViewController setDisplayedPhoto:photo];
}
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self performSegueWithIdentifier:@"showPhoto" sender:self];
}
-(void)setDisplayedPhoto:( UIImage *)image; (self.photoをimageに設定します)私のphotoViewController.h(segue.destinationViewController)で。私は得ています
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIViewController setDisplayedPhoto:]: unrecognized selector sent to instance 0x1f5c4a60'
次の行:[segue.destinationViewController setDisplayedPhoto:photo]; 。実装が空白の場合でも、エラーは表示されます。私はobjective-cを初めて使用しますが、おそらく、いくつかのことを台無しにしているだけです。
どんな助けでもいただければ幸いです。ありがとう!