다른 클래스에서 tableView를 다시로드하려고합니다. 콘솔의 일부 NSLog가 끝나면 데이터가 변경되지만 변경되지는 않습니다.다른 클래스의 reloadData?
RootViewController *test = [[RootViewController alloc] init];
// Set up database connection
NSString *myDB = [[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"flashpics.db"];
database = [[Sqlite alloc] init];
[database open:myDB];
[database executeNonQuery:@"INSERT INTO albums (id, name, connections) VALUES (?,?,'No Connections')", theID, theName];
[test.listOfItems addObject:theName];
RootViewController *controller = [[RootViewController alloc] init];
[controller.tableView reloadData];
[self dismissModalViewControllerAnimated:YES];
당신이 날은 아마 존재하는 가장 쉬운 질문 중 하나를 해결하는 데 도움 주실 래요
SecondViewController.m : 아래의 일부 코드이다?
덕분에, Coulton
수정 # 1 : NSLogs는 다음을 표시합니다. 이 일이 무엇이든 할 수 있을까요? __NSAutoreleaseNoPool(): Object 0x5883000 of class UITableView autoreleased with no pool in place - just leaking
편집 # 2 : SecondViewController.m
편집 # 3에 더 많은 코드를 추가 : 그것을 작동하지 않는 몇 가지 이유.
SecondViewController.m
RootViewController *controller = [[RootViewController alloc] init];
[RootViewController refreshTableView];
RootViewController.m
- (void) refreshTableView {
[self.tableView reloadData];
NSLog(@"Refreshing TableView - %@", listOfItems);
}
삽입 I '니토'배열된다. 그런 다음 SecondViewController.m에서 reloadTableView를 RootViewController.m으로 호출했습니다. 출력을 얻었지만 tableView를 업데이트하지 않았습니다. 아래는 NSLog입니다.
Refreshing TableView - (
"Default Album",
"Hello.",
"This is cool!",
hi,
neato
)
P. 나는 결과를 얻지 못하지만 NSLog를 통해 말하도록 프로그램 한 내용을 얻습니다.
이제 네가 말 했으니 까. 어떤 클래스에서 초기화해야합니까? 그리고 어떻게해야합니까? 내 - 초기화에서? – iosfreak
나는 한 무리의 코드를 남겨 뒀지 만 NSMutableArray에서 데이터를 채울 데이터를 얻는다. 간단한 샘플 코드를 제공해 주시겠습니까? 무리 감사! – iosfreak
많은 부분이 테이블에 렌더링하려는 것에 달려 있기 때문에 너무 자세하게 설명 할 수는 없지만 시작하기를 기대하는 예제가 포함되어 있습니다. – Dimitry