У меня проблема с моим проектом приложений для iOS. Я хочу передать значение моего SearchViewController в свой ResultGeneralInfoViewController. Нет ошибок или проблем, но это не работает.Передача переменной между диспетчерами просмотра
Вот мой код в моем SearchViewController.m
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSDictionary *item = [searchResults objectAtIndex:[indexPath row]];
ResultGeneralInfosViewController *detailViewController = [ResultGeneralInfosViewController alloc];
detailViewController.companyName = [item objectForKey:@"companyName"];
NSLog([item objectForKey:@"companyName"]);
}
ResultGeneralInfoViewController.h
@interface ResultGeneralInfosViewController : UIViewController {
NSString *companyName;
}
@property NSString *companyName;
@property (weak, nonatomic) IBOutlet UILabel *companyNameLabel;
и ResultGeneralInfoViewController.m
@implementation ResultGeneralInfosViewController
@synthesize companyName;
//Outlets
@synthesize companyNameLabel;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
companyNameLabel.text = self.companyName;
}
Есть идеи?
* «Нет ошибок, но это не сработает» * кажется для меня противоречием :-) –