Я настраиваю UITableView с пролистыванием для редактирования функций, и я использую автоматическое расположение.В моем контроллере представления есть только UITableViewController с пользовательским UITabelViewCell.Проблема в том, что мне пришлось несколько раз провести пальцами по ячейкам, чтобы вызвать эти меню.Я получаю меню только после нескольких ударов.Иногда мне пришлось сильно ударить, чтобы сделать эту работу.Как я могу вывести эти меню плавно, как в Почтовом приложении iOS?
В методе viewDidLoad я включил
self.practiceGrouptableView.allowsMultipleSelectionDuringEditing = NO;
Я получилЭто решение из других подобных вопросов, но все же, оно не решает мою проблему.
Пожалуйста, просмотрите мой код.
- (UITableViewCell *)tableView:(nonnull UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *cellidentifier = [NSString stringWithFormat:@"MyPracticeGroupCell"];
MyPracticeGroupCell *cell = (MyPracticeGroupCell *)[tableView dequeueReusableCellWithIdentifier:cellidentifier];
CountryItem *item = [hospitalArray objectAtIndex:indexPath.row];
cell.lblGroupname.text = [NSString stringWithFormat:@"%@", item.name];
cell.lblDescription.text = [NSString stringWithFormat:@"%@", item.Description];
return cell;
}
- (NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return hospitalArray.count;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return UITableViewAutomaticDimension;
}
- (NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"Entered here");
UITableViewRowAction *deleteAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"Leave Group" handler:^(UITableViewRowAction *action, NSIndexPath * indexPath) {
NSLog(@"Leave Group");
}];
UITableViewRowAction *joinAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleNormal title:@"Join Group" handler:^(UITableViewRowAction * action, NSIndexPath * indexPath) {
NSLog(@"Join Group");
}];
joinAction.backgroundColor = ApplicationDelegate.ButtonColor;
NSArray *rowActionArray = [[NSArray alloc] initWithObjects:deleteAction, joinAction, nil];
return rowActionArray;
}
Когда я отлаживал, каждый раз, когда я проводил, метод "editActionsForRowAtIndexPath" былвызвал но меню не показывалось.Это было показано только после попытки несколько раз.Как только меню появилось, пролистывание следующей ячейки станет более плавным, и меню отобразится без каких-либо попыток.И снова, когда скрытое меню будет отображаться, потребуется несколько попыток, чтобы снова его отобразить.