У меня есть ячейка UITableView с четырьмя строками, которые пользователи могут щелкнуть, и она выводит их на веб-страницу. Проблема в том, что пользователи нажимают на ячейку, она не становится синей, показывая, что пользователь был нажат. Ячейки работают нормально, когда при нажатии вы переходите к делегату веб-страницы. Но я хотел бы, чтобы клетка поменяла цвет при касании, чтобы они знали, в какую ячейку они нажали. Ниже приведен код:iOS UItableviewcell не имеет анимации при прослушивании
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// Return the number of rows in the section.
return 4;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
}
// Configure the cell...
cell.detailTextLabel.textColor = [UIColor grayColor];
cell.textLabel.font=[UIFont fontWithName:@"Helvetica" size:19];
cell.detailTextLabel.lineBreakMode = UILineBreakModeWordWrap;
cellHasStoreLink = YES;
Ни один из тех, кто работал. Я думаю, что проблема связана с ячейками, имеющими текст в них, который поступает из json-файла. –
Можете ли вы вставить весь код для cellForRowAtIndexPath? –
- (UITableViewCell *) tableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath { static NSString * CellIdentifier = @ "Cell"; UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier: CellIdentifier]; if (cell == nil) { cell = [[UITableViewCell alloc] initWithStyle: UITableViewCellStyleValue1 reuseIdentifier: CellIdentifier]; } // Конфигурирование ячейки ... cell.detailTextLabel.textColor = [UIColor grayColor]; cell.textLabel.font = [UIFont fontWithName: @ "Helvetica" size: 19]; –