Squash merge bww improvements, tableview reordering

This commit is contained in:
Loren Brichter
2011-08-11 22:44:42 -04:00
parent c310441ceb
commit cb8e5da3d1
14 changed files with 855 additions and 40 deletions
@@ -44,6 +44,7 @@
_tableView.autoresizingMask = TUIViewAutoresizingFlexibleSize;
_tableView.dataSource = self;
_tableView.delegate = self;
_tableView.maintainContentOffsetAfterReload = TRUE;
[self addSubview:_tableView];
_tabBar = [[ExampleTabBar alloc] initWithNumberOfTabs:5];
@@ -115,6 +116,10 @@
- (void)tabBar:(ExampleTabBar *)tabBar didSelectTab:(NSInteger)index
{
NSLog(@"selected tab %ld", index);
if(index == [[tabBar tabViews] count] - 1){
NSLog(@"Reload table data...");
[_tableView reloadData];
}
}
- (NSInteger)numberOfSectionsInTableView:(TUITableView *)tableView
@@ -174,4 +179,23 @@
return YES;
}
-(BOOL)tableView:(TUITableView *)tableView canMoveRowAtIndexPath:(TUIFastIndexPath *)indexPath {
// return TRUE to enable row reordering by dragging; don't implement this method or return
// FALSE to disable
return TRUE;
}
-(void)tableView:(TUITableView *)tableView moveRowAtIndexPath:(TUIFastIndexPath *)fromIndexPath toIndexPath:(TUIFastIndexPath *)toIndexPath {
// update the model to reflect the changed index paths; since this example isn't backed by
// a "real" model, after dropping a cell the table will revert to it's previous state
NSLog(@"Move dragged row: %@ => %@", fromIndexPath, toIndexPath);
}
-(TUIFastIndexPath *)tableView:(TUITableView *)tableView targetIndexPathForMoveFromRowAtIndexPath:(TUIFastIndexPath *)fromPath toProposedIndexPath:(TUIFastIndexPath *)proposedPath {
// optionally revise the drag-to-reorder drop target index path by returning a different index path
// than proposedPath. if proposedPath is suitable, return that. if this method is not implemented,
// proposedPath is used by default.
return proposedPath;
}
@end