왜 내 셀의 제목과 부제목을 표시 할 수 없는지 알 수 없습니다. NSLog()
통해 문자열 개체를 가져 오는 시도했다 그러나 array_Stacks
배열 (Stack
개체) 테스트 개체의 메모리 위치를 성공적으로 인쇄하는 NSLog()
에서 제쳐두고 출력을받지 못합니다.제목 및 NSLog가 cellForRowAtIndexPath에서 실행되지 않음
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SimpleCell" forIndexPath:indexPath];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"SimpleCell"];
}
NSString *cell_Title = [[array_Stacks objectAtIndex:[indexPath row]] title];
NSString *cell_Subtitle = [[array_Stacks objectAtIndex:[indexPath row]] subject];
NSLog(@"%@", cell_Title);
NSLog(@"%@", [array_Stacks objectAtIndex:[indexPath row]]);
NSLog(@"%@", cell_Subtitle);
cell.textLabel.text = cell_Title;
cell.textLabel.tintColor = [cp color_master_tan];
cell.detailTextLabel.text = cell_Subtitle;
cell.detailTextLabel.tintColor = [cp color_master_tan];
//cell.imageView.image = [UIImage imageNamed:@"asset_Cell"];
return cell;
}
참고 :
여기 내 cellForRowAtIndexPath:
방법이다 "CP는"내 컬러 팔레트 객체이며 UIColor
객체를 반환합니다. 여기
Stack initWithTitle:...
에
@""
에 문자열을 설정하는 Stack.m
#import "Stack.h"
#import "FlashCard.h"
/*
Notes
* Need to get the name of the creator and add it to the default init.
*/
@implementation Stack
{
NSMutableArray *array_flashCard;
}
@synthesize title, subject, creator, array_FlashCard;
#pragma mark - Initializers
- (id)init {
return [self initWithTitle:@"New Stack" subject:@"No Subject" creator:@"None Listed" array:array_FlashCard];
}
- (id)initWithTitle:(NSString *) ttl subject:(NSString *) sbj creator:(NSString *) ctr array:(NSMutableArray *) arr {
self = [super init];
if (self) {
title = ttl;
subject = sbj;
creator = ctr;
array_FlashCard = arr;
title = [[NSString alloc] init];
subject = [[NSString alloc] init];
creator = [[NSString alloc] init];
array_FlashCard = [[NSMutableArray alloc] init];
}
return self;
}
#pragma mark - Array Operations
- (void)addFlashCardToArray:(FlashCard *) flashcard { [array_FlashCard addObject:flashcard]; }
@end
문자열이 비어 있습니다. –
먼저, 전혀 호출되지 않습니까? 중단 점을 설정하고 트리거가 발생하는지 확인하십시오. 그렇지 않다면 테이블 뷰의 데이터 소스로 무엇을 설정 했습니까? 얼마나 많은 행이 테이블에 있는지 말하는 메소드가 호출됩니까? 그렇다면 무엇이 반환됩니까? –
두 번째 NSLog는 어레이의 Stack 객체에 대한 메모리 주소 인 올바른 정보를 출력하므로 객체가 존재하고 메소드가 트리거되고 있음을 알 수 있습니다. 파일 소유자가 설정되었습니다. 문제는 문자열이 비어 있더라도 적어도 터미널에서 타임 스탬프를 사용하여 'nil'을 얻는 것이지만 아무 것도 얻지 못합니다. – Cole