update: 2011/09/21
點入我的最愛文章:
A. 修改 FavoriteViewController.m 如下:
#import "FavoriteViewController.h"
//@add
#import "ArticleViewController.h"
#pragma mark - Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// Navigation logic may go here. Create and push another view controller.
/*
<#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil];
// ...
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
*/
//@add
ArticleViewController *articleViewController = [[ArticleViewController alloc] init];
NSManagedObject *article = [self.fetchedResultsController objectAtIndexPath:indexPath];
articleViewController.article = article;
// relationship
articleViewController.title = [[article valueForKey:@"notebook"] valueForKey:@"name"];
//@update
articleViewController.managedObjectContext = self.managedObjectContext;
[self.navigationController pushViewController:articleViewController animated:YES];
[articleViewController release];
}
B. 結果:
沒有留言:
張貼留言
注意:只有此網誌的成員可以留言。