我需要设置我的UITableView
单元格,当我选择一个单元格时将其大小增加到两倍,如果我选择另一个,则增加大小并减小先前选定的大小。在TableView中选择一个单元格并更改大小
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [self.states count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *simpleTableIdentifier = @"SimpleTableCell";
SimpleTableCell *cell = (SimpleTableCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"SimpleTableCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
cell.stateName.text = [self.states objectAtIndex:indexPath.row];
return cell;
}
-(CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 40;
}
@end
如何申报selectedindexpath标识? –
在h文件中创建属性,如 – techloverr
@property(强,非原子)NSIndexPath * selectedIndexPath; – techloverr