Add shortcut for reloadRowsAtIndexPaths

This commit is contained in:
Roman Efimov
2013-06-18 12:37:54 -05:00
parent bf023936a9
commit 12f77e1085
3 changed files with 10 additions and 2 deletions

View File

@@ -56,5 +56,6 @@
- (id)initWithTitle:(NSString *)title accessoryType:(UITableViewCellAccessoryType)accessoryType selectionHandler:(void(^)(RETableViewItem *item))selectionHandler accessoryButtonTapHandler:(void(^)(RETableViewItem *item))accessoryButtonTapHandler;
- (NSIndexPath *)indexPath;
- (void)reloadRowWithAnimation:(UITableViewRowAnimation)animation;
@end

View File

@@ -25,6 +25,7 @@
#import "RETableViewItem.h"
#import "RETableViewSection.h"
#import "RETableViewManager.h"
@implementation RETableViewItem
@@ -79,4 +80,9 @@
return [NSIndexPath indexPathForRow:[self.section.items indexOfObject:self] inSection:self.section.index];
}
- (void)reloadRowWithAnimation:(UITableViewRowAnimation)animation
{
[self.section.tableViewManager.tableView reloadRowsAtIndexPaths:@[self.indexPath] withRowAnimation:animation];
}
@end

View File

@@ -68,7 +68,8 @@
//
RETableViewOptionsController *optionsController = [[RETableViewOptionsController alloc] initWithItem:item options:options multipleChoice:NO completionHandler:^{
[weakSelf.navigationController popViewControllerAnimated:YES];
[weakSelf.tableView reloadRowsAtIndexPaths:@[item.indexPath] withRowAnimation:UITableViewRowAnimationNone];
[item reloadRowWithAnimation:UITableViewRowAnimationNone]; // same as [weakSelf.tableView reloadRowsAtIndexPaths:@[item.indexPath] withRowAnimation:UITableViewRowAnimationNone];
}];
[weakSelf.navigationController pushViewController:optionsController animated:YES];
}];
@@ -86,7 +87,7 @@
// Present options controller
//
RETableViewOptionsController *optionsController = [[RETableViewOptionsController alloc] initWithItem:item options:options multipleChoice:YES completionHandler:^{
[weakSelf.tableView reloadRowsAtIndexPaths:@[item.indexPath] withRowAnimation:UITableViewRowAnimationNone];
[item reloadRowWithAnimation:UITableViewRowAnimationNone]; // same as [weakSelf.tableView reloadRowsAtIndexPaths:@[item.indexPath] withRowAnimation:UITableViewRowAnimationNone];
NSLog(@"%@", item.value);
}];
[weakSelf.navigationController pushViewController:optionsController animated:YES];