SQLite 데이터베이스에서 수집 한 데이터 배열로 채워진 UITableView가 있습니다. 셀을 선택하면 세부 뷰가 해당 셀과 관련되어로드됩니다. 네비게이션 컨트롤러의 제목은 바뀌지 만 세부보기의 UILabel은 채워지지 않습니다.자세히보기의 UILabel이 채워지지 않습니다.
관련 tableViewController 코드 :
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self.tableView deselectRowAtIndexPath:indexPath animated:YES];
ExhibitorDetailViewController *exhibitorDetailViewControllerInstance = [[ExhibitorDetailViewController alloc] init];
exhibitorDetailViewControllerInstance.theTitle = [self.tableView cellForRowAtIndexPath:indexPath].textLabel.text;
exhibitorDetailViewControllerInstance.exhibitorDetailModal = [arrayOfExhibitors objectAtIndex:indexPath.row];
// Have tried setting the text before the detail view is loaded wiht the line below
exhibitorDetailViewControllerInstance.LabelExhibitorDescription.text = arrayOfExhibitors.description;
[self.navigationController pushViewController:exhibitorDetailViewControllerInstance animated:YES];
}
상세 뷰 컨트롤러의 viewDidLoad에 이벤트 :
- (void)viewDidLoad
{
[super viewDidLoad];
self.title = _theTitle; //This sets the title ok
NSLog(@"0 - %@", _exhibitorDetailModal.description); //This property is what I want to fill the UILabel with
self.LabelExhibitorDescription.text = _exhibitorDetailModal.description; // This does nothing
self.view.backgroundColor = [UIColor colorWithRed:0.6 green:0.8 blue:0.8 alpha:2.0f]; // If I don't set the background colour here it loads up black (despite being set in the storyboard)
NSLog(@"label text = %@", self.LabelExhibitorDescription.text); // This shows the text box being null despite having its text property set above
}
상세보기 헤더 파일 :
@interface ExhibitorDetailViewController : UIViewController
{
}
@property (nonatomic, retain) NSString *theTitle;
@property (strong, nonatomic) IBOutlet UILabel *nameLabel;
@property (strong, nonatomic) IBOutlet UILabel *categoryLabel;
@property (strong, nonatomic) IBOutlet UILabel *descriptionLabel;
@property (strong ,nonatomic) NSArray *exhibitorDetailModal;
@property (strong, nonatomic) IBOutlet UILabel *LabelExhibitorDescription;
@end
가 왜 UILabel의 텍스트 아니다 사람이 거주하고 있습니까?
감사합니다.
편집 : 배열의 "발신"설명이 로그온
- [arrayOfExhibitors objectAtIndex : indexPath.row]를 도시하는 _exhibitorDetailModal.description 같은 인 예상이 올바른 데이터를 도시 자세히보기에서.
iOS 7을 사용하는 경우 테이블보기를 위아래로 스크롤하여 라벨이 채워지는지 확인해보십시오. 나는이 행동을 보았지만 근본 원인을 모른다. –
그래, Xcode5 - iOS7을 사용하고있다. tableView는 괜찮아 보입니다. 위로/아래로 스크롤하여 셀을 클릭하면 상세 뷰가로드됩니다 .- 그런 다음 잔 컨트롤러에서 뒤로 버튼을 누르고 tableView로 돌아가서 다시 다른 셀을 클릭 할 수 있습니다. – Ryan
'didSelectRowAtIndexPath :'메소드에'[arrayOfExhibitors objectAtIndex : indexPath.row]'를 로깅하려고 시도 했습니까? – GoGreen