Я работаю над Prototype TableView Cell, где у меня есть две ярлыка над ячейкой и одна кнопка за ячейкой. Я хочу скрыть вторую метку на кнопке Hide Button. Я пробовал много, но не получили соответствующую информацию, Вот мой код для отображения меток в Cell:Скрыть метку из ячейки прототипа в TableView
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *simpleTableIdentifier = @"TableCell";
TableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
// Configure the cell...
int row = [indexPath row];
cell.EnglishLable.text = _English[row];
cell.UrduLable.text = _Urdu[row];
return cell;
}
Все нормально, мне просто нужно, чтобы скрыть «UrduLabel» в моем методе Скрыть IBAction.
- (IBAction)Hide:(id)sender {
static NSString *simpleTableIdentifier = @"TableCell";
UITableView *tableView = [[UITableView alloc]init];
CGPoint location = [gestureRecognizer locationInView:self.tableView];
NSIndexPath *indexPath = [self.tableView indexPathForRowAtPoint:location];
UITableViewCell *cell = [tableView cellForRowAtIndexPath:IndexPath];
BOOL *hideLabel;
hideLabel = YES;
[self.tableView reloadData];
UILabel *subtitle = (UILabel *)[cell.contentView viewWithTag:1];
subtitle.hidden = hideLabel;
}
Что не так в методе Button?
Где '- (IBAction) скрывает ваш код? в 'viewcontroller', который держит' tableView' или внутри реализации TableViewCell? –
- (IBAction) hide находится в моем классе tableView, а не в классе TableViewCell –
Что такое gestureRecognizer в вашем - (IBAction) Скрыть метод? – Arun