我需要設置我的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