看你的代碼,在你繼續之前(我稍微改變它 - 做同樣的事情)。當您嘗試從主控切換到詳細時,您發送的代碼崩潰。這些是我發現的更大的問題。
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if ([[segue identifier] isEqualToString:@"showDetail"]) {
DetailViewController *dvc = segue.destinationViewController;
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
NSDate *object = _exercises[indexPath.row];
dvc.detailItem = object;
}
}
// in detail view
@property (strong, nonatomic) NSDate *detailItem;
你的「對象」要傳遞到詳細信息視圖控制器是的NSDate對象。
您不能將標題設置爲NSDate對象。
你也有一個問題,當你做
[[self detailItem] setFullImage:fullImage];
[[self detailItem] setThumbImage:thumbImage];
您再次嘗試圖像設置爲您的NSDate對象。
我建議你按照本教程進行操作,它會顯示你正在嘗試製作的一個很好的例子,正如你所提到的你是初學者。
iOS Tutorial: How To Create A Simple iPhone App
什麼類型的對象是detailItem? – Alex
你有沒有看過這個http://stackoverflow.com/questions/8302674/property-not-found-on-object-of-type-id – DogCoffee
@Smick是的,但仍然困惑,因爲我是新客觀的C – pjv