내 UITableViewCell이 textLabel에 적절한 텍스트를 표시하려고 시도했지만 현재 텍스트가 표시되고 있지 않습니다. NSLOG 배열에 데이터가 있는지 확인하려고 시도했다. 배열을 살펴보고 내가 가져온 Core Data 엔티티의 각 항목에서 텍스트를 인쇄하고 원하는 텍스트를 다시 가져 오려고했습니다. 셀에있는 모든 정보를 표시 할 때 아무 일도 일어나지 않습니다. 또한 cellForRowAtIndexPath 메서드도 호출되지 않는 것을 알 수 있습니다.UITableViewCell textLabel이 텍스트를 표시하지 않습니다.
UIAlertView 단추에서보기가 처음 전환되는 방식은 다음과 같습니다.
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
NSString *title = [alertView buttonTitleAtIndex:buttonIndex];
if ([title isEqualToString:@"Corp"]){
DeckBuilderTableViewController *deckBuilder = [[DeckBuilderTableViewController alloc]init];
[deckBuilder fetchCorpCards];
[self performSegueWithIdentifier:@"deckBuilder" sender:self];
}
if ([title isEqualToString:@"Runner"]){
DeckBuilderTableViewController *deckBuilder = [[DeckBuilderTableViewController alloc]init];
[deckBuilder fetchRunnerCards];
[self performSegueWithIdentifier:@"deckBuilder" sender:self];
}
}
여기에 cellForRowAtIndexPath 메소드가 있습니다.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"cellForRowAtIndexPath called");
NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
// Configure the cell...
if (self.corpCardsSelected == YES){
CorpCard *corpCards = [self.datasource objectAtIndex:indexPath.row];
cell.textLabel.text = corpCards.title;
}
if (self.runnerCardsSelected == YES){
RunnerCard *runnerCards = [self.datasource objectAtIndex:indexPath.row];
cell.textLabel.text = [NSString stringWithFormat:@"%@", runnerCards.title];
}
return cell;
}
편집 :
여기 대리자 메서드
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return self.datasource.count;
}
지금 몰래 데이터 소스 배열이 그 내용을 기록하는 것입니다 오전 문제가 있지만, numberOfRowsInSection는 0의 수를 반환합니다.
보기가 시작되고 처음으로 전환되는 방식은 다음과 같습니다. 이 코드는 초기 viewController의 코드입니다.
-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
NSString *title = [alertView buttonTitleAtIndex:buttonIndex];
if ([title isEqualToString:@"side1"]){
DeckBuilderTableViewController *deckBuilder = [[DeckBuilderTableViewController alloc]init];
[deckBuilder fetchSide1Cards];
[self performSegueWithIdentifier:@"deckBuilder" sender:self];
}
if ([title isEqualToString:@"side2"]){
DeckBuilderTableViewController *deckBuilder = [[DeckBuilderTableViewController alloc]init];
[deckBuilder fetchSide2Cards];
[self performSegueWithIdentifier:@"deckBuilder" sender:self];
}
}
속성 검사기에는 무엇이 있습니까? (상단 목록의 네 번째 아이콘) – sha
이것은 귀속되지 않습니다. 첫 번째 입력란에 'Content : Dynamic Prototypes'가 표시됩니다. – sha
스크린 샷을 다시 편집했는데 찾고있는 패널입니까? – TheM00s3