Skip to content

Commit

Permalink
changed naming of delegate helper methods
Browse files Browse the repository at this point in the history
  • Loading branch information
myell0w committed Feb 16, 2012
1 parent 867c314 commit 9fbb8a8
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions NGVerticalTabBarController/NGVerticalTabBarController.m
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,14 @@ @interface NGVerticalTabBarController () <UITableViewDataSource, UITableViewDele
/** the (computed) frame of the sub-viewcontrollers */
@property (nonatomic, readonly) CGRect childViewControllerFrame;
@property (nonatomic, assign) NSUInteger oldSelectedIndex;

@property (nonatomic, readonly) BOOL containmentAPISupported;

- (void)updateUI;

- (CGFloat)askDelegateForWidthOfTabBar;
- (BOOL)askDelegateIfWeShouldSelectViewController:(UIViewController *)viewController atIndex:(NSUInteger)index;
- (CGFloat)delegatedTabBarWidth;
- (BOOL)delegatedDecisionIfWeShouldSelectViewController:(UIViewController *)viewController atIndex:(NSUInteger)index;
- (void)callDelegateDidSelectViewController:(UIViewController *)viewController atIndex:(NSUInteger)index;
- (CGFloat)askDelegateForHeightOfTabBarCellAtIndex:(NSUInteger)index;
- (CGFloat)delegatedHeightOfTabBarCellAtIndex:(NSUInteger)index;

@end

Expand Down Expand Up @@ -74,7 +73,7 @@ - (void)viewDidLoad {

NSAssert(self.delegate != nil, @"No delegate set");

CGFloat width = [self askDelegateForWidthOfTabBar];
CGFloat width = [self delegatedTabBarWidth];
self.tabBar = [[NGVerticalTabBar alloc] initWithFrame:CGRectMake(0.f, 0.f, width, self.view.bounds.size.height) style:UITableViewStylePlain];
self.tabBar.dataSource = self;
self.tabBar.delegate = self;
Expand Down Expand Up @@ -289,7 +288,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N

- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// ask the delegate if we can select the cell
if ([self askDelegateIfWeShouldSelectViewController:[self.viewControllers objectAtIndex:indexPath.row] atIndex:indexPath.row]) {
if ([self delegatedDecisionIfWeShouldSelectViewController:[self.viewControllers objectAtIndex:indexPath.row] atIndex:indexPath.row]) {
return indexPath;
}

Expand All @@ -309,7 +308,7 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
return [self askDelegateForHeightOfTabBarCellAtIndex:[indexPath row]];
return [self delegatedHeightOfTabBarCellAtIndex:[indexPath row]];
}

////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -368,7 +367,7 @@ - (void)updateUI {

- (CGRect)childViewControllerFrame {
CGRect bounds = self.view.bounds;
CGRect childFrame = UIEdgeInsetsInsetRect(bounds, UIEdgeInsetsMake(0.f, [self askDelegateForWidthOfTabBar]+1.f, 0.f, 0.f));
CGRect childFrame = UIEdgeInsetsInsetRect(bounds, UIEdgeInsetsMake(0.f, [self delegatedTabBarWidth]+1.f, 0.f, 0.f));

return childFrame;
}
Expand All @@ -386,7 +385,7 @@ - (BOOL)containmentAPISupported {
return containmentAPISupported;
}

- (CGFloat)askDelegateForWidthOfTabBar {
- (CGFloat)delegatedTabBarWidth {
if (delegateFlags_.widthOfTabBar) {
return [self.delegate widthOfTabBarOfVerticalTabBarController:self];
}
Expand All @@ -395,7 +394,7 @@ - (CGFloat)askDelegateForWidthOfTabBar {
return kNGTabBarControllerDefaultWidth;
}

- (BOOL)askDelegateIfWeShouldSelectViewController:(UIViewController *)viewController atIndex:(NSUInteger)index {
- (BOOL)delegatedDecisionIfWeShouldSelectViewController:(UIViewController *)viewController atIndex:(NSUInteger)index {
if (delegateFlags_.shouldSelectViewController) {
return [self.delegate verticalTabBarController:self shouldSelectViewController:viewController atIndex:index];
}
Expand All @@ -410,7 +409,7 @@ - (void)callDelegateDidSelectViewController:(UIViewController *)viewController a
}
}

- (CGFloat)askDelegateForHeightOfTabBarCellAtIndex:(NSUInteger)index {
- (CGFloat)delegatedHeightOfTabBarCellAtIndex:(NSUInteger)index {
if (delegateFlags_.heightForTabBarCellAtIndex) {
return [self.delegate heightForTabBarCell:self atIndex:index];
}
Expand Down

0 comments on commit 9fbb8a8

Please sign in to comment.