当我们 select 表视图中的特定行时如何取消隐藏步进器
How to Unhide stepper when we select particular row in tableview
我在 UITableView
的 CustomCell 中创建了步进器。但是,我希望步进器仅在选择特定行时可见。为此,我尝试了以下方法:
在tableView:cellForRowAtIndexPath:
cell.customStepper.hidden=NO;
并在 tableView:didSelectRowAtIndexPath:
cell.customStepper.hidden=YES;
但步进器仍然隐藏。我错过了什么?
@interface BRNCategoryViewController ()
{
NSMutableArray *arySelectCategory;
NSMutableArray *aryCategory;
}
- (void) viewDidLoad
{
arySelectCategory=[NSMutableArray new];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return aryCategory.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
BRNCategoryCell *cell=[[BRNCategoryCell alloc]initWithOwner:self];
if ([arySelectCategory containsObject:[aryCategory objectAtIndex:indexPath.row]])
{
cell.customStepper.hidden = NO;
}
else
{
cell.customStepper.hidden = YES;
}
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if ([arySelectCategory containsObject:[aryCategory objectAtIndex:indexPath.row]])
{
[arySelectCategory removeObject:[aryCategory objectAtIndex:indexPath.row]];
}
else
{
[arySelectCategory addObject:[aryCategory objectAtIndex:indexPath.row]];
}
[tblEventCategory reloadData];
}
在cellForRowAtIndexPath
cell.customStepper.hidden=YES;
和
在didSelectRowAtIndexPath
VideosCell *cell = (VideosCell *)[tableView cellForRowAtIndexPath:indexPath];
cell.customStepper.hidden = NO;
我在 UITableView
的 CustomCell 中创建了步进器。但是,我希望步进器仅在选择特定行时可见。为此,我尝试了以下方法:
在tableView:cellForRowAtIndexPath:
cell.customStepper.hidden=NO;
并在 tableView:didSelectRowAtIndexPath:
cell.customStepper.hidden=YES;
但步进器仍然隐藏。我错过了什么?
@interface BRNCategoryViewController ()
{
NSMutableArray *arySelectCategory;
NSMutableArray *aryCategory;
}
- (void) viewDidLoad
{
arySelectCategory=[NSMutableArray new];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return aryCategory.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
BRNCategoryCell *cell=[[BRNCategoryCell alloc]initWithOwner:self];
if ([arySelectCategory containsObject:[aryCategory objectAtIndex:indexPath.row]])
{
cell.customStepper.hidden = NO;
}
else
{
cell.customStepper.hidden = YES;
}
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if ([arySelectCategory containsObject:[aryCategory objectAtIndex:indexPath.row]])
{
[arySelectCategory removeObject:[aryCategory objectAtIndex:indexPath.row]];
}
else
{
[arySelectCategory addObject:[aryCategory objectAtIndex:indexPath.row]];
}
[tblEventCategory reloadData];
}
在cellForRowAtIndexPath
cell.customStepper.hidden=YES;
和
在didSelectRowAtIndexPath
VideosCell *cell = (VideosCell *)[tableView cellForRowAtIndexPath:indexPath];
cell.customStepper.hidden = NO;