Мне удалось сделать TableView расширяемым. Проблема в том, что когда я запускаю приложение, он всегда открывается. Я хочу, чтобы он был закрыт и был открыт только, когда я ударил по строке.Расширяемые строки в UITableView установлены для открытия
Что мне здесь не хватает? Как я могу открыть его при запуске?
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 3;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 5;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
if (!indexPath.row)
{
// first row
cell.textLabel.text = @"Expandable"; // only top row showing
}
else
{
cell.textLabel.text = @"Some Detail";
cell.accessoryView = nil;
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
}
return cell;
}
- (BOOL)tableView:(UITableView *)tableView canCollapseSection:(NSInteger)section
{
return YES;
}