iOS 자습서를 따르고 있으며 코드가 정확하지만 처음 튜토리얼 코드에 표시되지 않은 오류가 발생합니다. 다음은 관련된 방법은 다음과 같습니다다른 메서드에서 BOOL 메서드를 호출하려고 할 때 경고가 발생했습니다.
-(BOOL)tableview:(UITableView *)tableView canCollapseSection:(NSInteger)section {
if (section >0) return YES;
return NO;
}
그리고 여기에 올바른 있어야 코드의 조각,하지만 오류가 발생합니다 :
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (tableView == self.searchDisplayController.searchResultsTableView)
{
return [self.searchResults count];
}
else {
if ([self tableView:tableView canCollapseSection:section])
{
if ([expandedSections containsIndex:section])
{
.../...
오류가 라인
if ([self tableView:tableView canCollapseSection:section])
에 표시됩니다 다음은 오류 메시지입니다.
No visible @interface for 'ToDoItemsTableViewController' declares the selector 'tableView:canCollapseSection:'
즉, @ santhu 감사합니다. – mvasco