2013-10-01 3 views
1

의 속성을 설정 (및 @synthesize하는 .m)에IOS는 :이 속성이 내 응용 프로그램에서 iOS7에

@property (nonatomic, strong) IBOutlet UILabel *titleHeader; 

secondViewController인치 그것이 작동하지 않는

[secondViewController.titleHeader setText:@"title"]; 

, iOS 6에서 작동 :

문제는 iOS 7firstViewController에서 내가 할 경우이다.

왜?

편집

나는 그것을 할 : 당신이 그들을 설정할 때 secondViewController

SecondViewController *secondViewController = [[SecondViewController alloc]initWithNibName:@"SecondViewController" bundle:nil code:[object code]]; 
     [self.navigationController pushViewController:secondViewController animated:YES]; 
     [secondViewController.titleHeader setText:[object name]]; 
     [secondViewController.headerView setBackgroundColor:colorHeaderGallery]; 
+0

어떤 방식으로 작동하지 않습니까? is titleHeader! = nil입니까? 그리고 secondViewController입니다! = nil? – Magnus

+0

제 질문을 편집합니다 – CrazyDev

답변

3

전망은 아직로드되지 않았습니다. 보기 컨트롤러를 탐색 스택으로 누른 후 secondViewController.titleHeader 값을 쿼리하여이를 확인할 수 있습니다. 수정으로

, 당신은 다음 secondViewController.titleHeader setText
예를 들어, 대신 그 속성을 설정 secondViewController

@property (nonatomic, strong) NSString *titleHeaderText; 

에서 속성을 선언 할 수 있습니다 당신의 secondViewControllerviewDidLoad 방법 그 후

secondViewController.titleHeaderText = [object name]; 

, 당신은 레이블의 텍스트를 설정할 수 있습니다.

[self.titleHeader setText:self.titleHeaderText ]; 

편집 :
pushViewController의 동작은 내가 노력하고 문제를 복제 한 아이폰 OS 7 변경 것으로 보인다.

위의 변경을 원하지 않는 경우 label setText으로 전화하기 전에보기가로드되도록 secondViewController보기에 액세스하는 것이 좋습니다.
예 :

SecondViewController *secondViewController = [[SecondViewController alloc]initWithNibName:@"SecondViewController" bundle:nil code:[object code]]; 
[self.navigationController pushViewController:secondViewController animated:YES]; 
[secondViewController view]; 
[secondViewController.titleHeader setText:[object name]]; 
[secondViewController.headerView setBackgroundColor:colorHeaderGallery]; 
+0

예, secondViewController.titleHeader는 무효입니다.하지만 재앙은 iOS 7에서만 발생합니다 !!! – CrazyDev

+0

나는 귀하의 문제를 시도하고 복제했습니다. 위의 내 대답에 다른 해결 방법을 추가했습니다. –