내 iOS 앱 프로젝트에 문제가 있습니다. 내 SearchViewController 값을 내 ResultGeneralInfoViewController로 전송하고 싶습니다. 버그 나 문제는 없지만 작동하지 않습니다. 여기viewcontrollers 사이에 변수 전송
내 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;
}
어떤 아이디어를 내 코드?
* "버그는 없지만 작동하지 않습니다."* 나에게 모순이있는 것처럼 보입니다 :-) –