Font for button titles in editActionsForRowAtIndexPath

925 Views Asked by At

Firstly, it would be nice for anyone that has 1500 reputation to create a new tag for UITableViewRowAction

I don't have that privilege.

using xcode version 6.1

I currently am using Apples newly introduced edit actions for UITableViewCells as shown below:

-(NSArray *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewRowAction *deleteButton = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@"Delete" handler:^(UITableViewRowAction *action, NSIndexPath *indexPath)
                                {
                                    NSManagedObjectContext *context = [self.fetchedResultsController managedObjectContext];
                                    [context deleteObject:[self.fetchedResultsController objectAtIndexPath:indexPath]];
                                }];
deleteButton.backgroundColor = [UIColor redColor]; 

UITableViewRowAction *saveButton = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDefault title:@" Save " handler:^(UITableViewRowAction *action, NSIndexPath *indexPath)
                                 {
                                     [self moreActions:self];
                                 }];
saveButton.backgroundColor = [UIColor colorWithRed:0.188 green:0.514 blue:0.984 alpha:1]; 
return @[deleteButton, saveButton];
}

However there is no font attribute to the title of the button or at least from my research.

The Documentation & API Reference states the only configurable options are for style, title (NSString), backgroundColor or backgroundEffect.

I have been able to programmatically alter other classes with an example below but have no results with the UITableViewRowActions:

[[UIBarButtonItem appearanceWhenContainedIn:[UISearchBar class], nil] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                                                                              [UIColor whiteColor],
                                                                                              NSForegroundColorAttributeName,
                                                                                              nil]
                                                                                    forState:UIControlStateNormal];

I am using a custom font throughout my app and it would be nice to maintain fluidity. I realize there are other options and frameworks out there that offer swipeable tableView content, however, iOS 8 has made this is so easy to implement why wouldn't I?

Are there any good eyes out there that have spotted the fix? Or can it be done suitable to pass App Store Guidelines?

0

There are 0 best solutions below