我在表格视图单元格中创建了一个 UIContextualAction,它显示了一个长文本,但它工作错误。标题显示文本:文本示例...
如果我使用 UITableViewRowAction 在表格视图单元格中进行滑动操作。标题在 ios 10 中显示完整,在 ios 11+ 中显示错误
我已经用“\n”分解了文本中的行
- (NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *warningMessage = @"This is the title of UITablViewRowAction \nin table view cell.";
UITableViewRowAction *warningAction = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault
title:warningMessage
handler:
^(UITableViewRowAction *action, NSIndexPath *indexPath){
//do nothing
}];
return @[warningAction];
}
- (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(11.0)) {
NSString *warningMessage = @"This is the title of UIContextualAction \nin table view cell.";
UIContextualAction *warningAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:warningMessage
handler:
^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
// action
}];
UISwipeActionsConfiguration *configuration = [UISwipeActionsConfiguration configurationWithActions:@[warningAction]];
configuration.performsFirstActionWithFullSwipe = NO;
return configuration;
}
这是图片。
有人可以帮我解决这个问题吗?太感谢了。