まず、評判が 1500 のユーザーが UITableViewRowAction の新しいタグを作成すると便利です。
私にはその特権がありません。
xcode バージョン 6.1 を使用
私は現在、以下に示すように、Apples が新しく導入した UITableViewCells の編集アクションを使用しています。
-(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];
}
ただし、ボタンのタイトルまたは少なくとも私の調査によると、フォント属性はありません。
ドキュメンテーションと API リファレンスには、スタイル、タイトル (NSString)、backgroundColor、または backgroundEffect に対する構成可能なオプションのみが記載されています。
以下の例では、他のクラスをプログラムで変更できましたが、UITableViewRowActions では結果が得られませんでした。
[[UIBarButtonItem appearanceWhenContainedIn:[UISearchBar class], nil] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
[UIColor whiteColor],
NSForegroundColorAttributeName,
nil]
forState:UIControlStateNormal];
アプリ全体でカスタム フォントを使用していますが、流動性を維持するとよいでしょう。スワイプ可能な tableView コンテンツを提供するオプションやフレームワークが他にもあることは承知していますが、iOS 8 ではこれを実装するのが非常に簡単になっています。
修正を見つけた良い目はありますか?それとも、App Store ガイドラインに合格するのに適しているでしょうか?