#import "RootViewController.h"
#import "DetailViewController.h"
@implementation RootViewController
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// UITableViewStyleGrouped table view style will cause the table have a textured background
// and each section will be separated from the other ones.
DetailViewController *controller = [[DetailViewController alloc]
initWithStyle:UITableViewStyleGrouped
andfileData:[dao libraryItemAtIndex:indexPath.row]];
controller.title = [[dao libraryItemAtIndex:indexPath.row] valueForKey:@"Description"];
[self.navigationController pushViewController:controller animated:YES];
[controller release];
}
编译错误..导入了所有文件..出错了?
答案 0 :(得分:3)
实际上,我猜测控制器对象(类DetailViewController)实际上并没有“dot-syntax”工作所需的属性“title”。
DetailViewController是否正确地从UIViewController继承?
答案 1 :(得分:1)
控制器是否正确初始化?你检查它是否为空或出了什么问题? 在它上面加一个断点并检查出来:
DetailViewController *controller = [[DetailViewController alloc]
答案 2 :(得分:1)
尝试使用:
[controller setTitle:[[dao libraryItemAtIndex:indexPath.row] valueForKey:@"Description"];
答案 3 :(得分:0)
尝试使用:
self->Title //... Your code here
或尝试使用这样的方法:
-(void)setTitle: (NSString*)aTitle;
{
[self->Title setString:aTitle];
}