Я создаю детализированное приложение с панелью вкладок, выполняющей роль rootViewController.Приложение полностью функционирует, за исключением подробного просмотра.Я выделил три свойства в моем .plist: заголовок, ассоциированное изображение и отраслевая информация.
Итак, я создал эти переменные в своем заголовочном файле:
@interface DetailView : UIViewController {
NSDictionary *industryData;
IBOutlet UILabel *titleLabel;
IBOutlet UIImageView *associatedImage;
IBOutlet UITextView *industryInfo;
}
@property (nonatomic, retain) NSDictionary *industryData;
@property (nonatomic, retain) IBOutlet UILabel *titleLabel;
@property (nonatomic, retain) IBOutlet UIImageView *associatedImage;
@property (nonatomic, retain) IBOutlet UITextView *industryInfo;
@end
Я уверен, что смог правильно получить вторую часть метода viewDidLoad, но у меня возникли проблемызаставить его ассоциировать с моим .plist.Я все еще в замешательстве в первой части:
{
NSString *Path = [[NSBundle mainBundle] bundlePath];
NSString *DataPath = [Path stringByAppendingPathComponent:@"IndustryData.plist"];
NSDictionary *tempDict = [[NSDictionary alloc] initWithContentsOfFile:DataPath];
self.industryData = tempDict;
[tempDict release];
associatedImage.image = [UIImage imageNamed:[industryData valueForKey:@"Associated Image"]];
titleLabel.text = [industryData valueForKey:@"Title"];
industryInfo.text = [industryData valueForKey:@"Industry Info"];
[super viewDidLoad];
}
Я думаю, мой вопрос коренится в первых пяти строках кода.Я пытался применить то, что сделал с навигационной частью, к подробному виду, но при загрузке на экране нет содержимого.Как мне связать мои данные с моим исходным .plist?
Редактировать:
Я подумал, что это стоит добавить из моего "IndustryView", известного как контроллер представления навигации:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
//Get the dictionary of the selected data source.
NSDictionary *dictionary = [self.tableDataSource objectAtIndex:indexPath.row];
//Get the children of the present item.
NSArray *Children = [dictionary objectForKey:@"Children"];
Dg3_z_Z4_8AppDelegate *AppDelegate = (Dg3_z_Z4_8AppDelegate *) [[UIApplication sharedApplication] delegate];
if([Children count] == 0) {
DetailView *dvController = [[DetailView alloc] initWithNibName:@"DetailView" bundle:[NSBundle mainBundle]];
[AppDelegate.indNavControl pushViewController:dvController animated:YES];
[dvController release];
}
Есть еще одна часть, но здесь она не особенно актуальна.Спасибо!