Clover
Clover

Reputation: 21

Title of UIContextualAction does not show full of text

I create an UIContextualAction in table view cell which shows a long text but it works wrong. The title shows text with: The sample of text...

If I use UITableViewRowAction for swiping action in table view cell. The title shows full in ios 10 and gets wrong in ios 11+

I have broken down lines in the text with "\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;

}

Here are the pictures.

Could anybody help me on this issue?. Thank you so much.

ios10 ios11

Upvotes: 0

Views: 246

Answers (0)

Related Questions