我正在做一個測試應用程序使用從我在我的application:didFinishLaunchingWithOptions:
的appDelegate讀取plist文件數據在導航基於應用程序上市的電影。當我嘗試去第二個detailViewController我得到部分改變的標題(我得到的電影的標題,而不是在UIView.title
年,我得到像「78898320」&空UIImageView & UILabels。我錯過了什麼?填充的UIView用的UIViewController在基於導航應用
這是我在RootViewController的方法:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"YOU SELECTED: %d",indexPath.row);
detailViewController *detailView = [[detailViewController alloc] initWithNibName:@"detailViewController" bundle:nil];
NSDictionary *dict = [NSDictionary dictionaryWithDictionary:
[movies objectAtIndex:indexPath.row]];
[detailView fill:dict];
[self.navigationController pushViewController:detailView animated:YES];
[detailView release];
}
這是我在detailViewController填充UIView的方法:
-(void)fill: (NSDictionary*) fillData
{
//movie = [NSDictionary dictionaryWithDictionary:fillData];
NSLog(@"DETAILS: %@",[fillData objectForKey:@"description"]);
self.title = [NSString stringWithFormat:@"%@ (%d)",
[fillData objectForKey:@"title"],
[fillData objectForKey:@"year"]];
//[movie objectForKey:@"title"];
self.img = [[UIImageView alloc] initWithImage:
[UIImage imageNamed:[fillData objectForKey:@"image"]]];
self.description = [fillData objectForKey:@"description"];
self.cast = [fillData objectForKey:@"cast"];
}
當我嘗試打印使用的NSLog它打印出精美的字典中的描述。
如何'self.title','self.img'。在'detailViewController'中聲明? – 2011-07-14 13:39:16
沒有什麼東西會跳出來,你應該設置一個斷點並逐步完成。 –
只需設置detailView.title = @「變形金剛」。你不會得到這些數字。 – Legolas