我在这里提出质疑:Best idea for importing text to each NavigationController View回答我关于导航控制器的旧问题!
的回答是这样的:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
PoemDetailsViewController *poemDetails = [[[PoemDetailsViewController alloc] initWithNibName:@"PoemDetailsViewController" bundle:nil] autorelease];
poemDetails.poem = [poems objectAtIndex:indexPath.row]; // assuming you have a single dimension array with poems and a single table group
[self.navigationController pushViewController:poemDetails animated:YES];
}
现在在PoemDetailsViewController我创建一个UIWebView并编写这些代码:
(我知道这个代码只显示一个我的HTML文件)
NSString *path = [[NSBundle mainBundle] pathForResource:@"fal1" ofType:@"html"];
NSFileHandle *readHandle = [NSFileHandle fileHandleForReadingAtPath:path];
NSString *htmlString = [[NSString alloc] initWithData:
[readHandle readDataToEndOfFile] encoding:NSUTF8StringEncoding];
现在我找不到任何关联此代码
poemDetails.poem = [poems objectAtIndex:indexPath.row];
在每个单元格上加载AnotherViewController上的诗吗?
我的意思是每个细胞都用导航控制器在其他视图上显示他们的诗。
是否有一个理由,为什么你不使用'NSString.stringWithContentsOfFile:编码:错误:'? – notnoop 2010-01-06 22:26:20
我有495个电池,所以他们进口plist财产! NSString * myfile = [[NSBundle mainBundle] pathForResource:@“ghazal”ofType:@“plist”]; \t ghazalList = [[NSArray alloc] initWithContentsOfFile:myfile]; 和: - (NSInteger的)的tableView:(UITableView的*)的tableView numberOfRowsInSection:(NSInteger的)部分 { \t返回ghazalList.count; } 等 (为什么评论没有代码标记!?) – Momi 2010-01-06 22:36:49
@notnoop:对不起IAM新iPhone的SDK – Momi 2010-01-06 22:41:45