Permalink
Browse files

[models] Allow the radio group controller to be presented in differen…

…t ways via the delegate.
  • Loading branch information...
jverkoey committed Jul 31, 2012
1 parent 4211873 commit 63b5d785ca9cb847182444395145bb16982313c3
Showing with 9 additions and 3 deletions.
  1. +4 −1 src/models/src/NIRadioGroup.h
  2. +5 −2 src/models/src/NIRadioGroup.m
@@ -107,8 +107,11 @@
* The radio group controller is about to appear.
*
* This method provides a customization point for the radio group view controller.
+ *
+ * @return YES if controller should be pushed onto the current navigation stack.
+ * NO if you are going to present the controller yourself.
*/
-- (void)radioGroup:(NIRadioGroup *)radioGroup radioGroupController:(NIRadioGroupController *)radioGroupController willAppear:(BOOL)animated;
+- (BOOL)radioGroup:(NIRadioGroup *)radioGroup radioGroupController:(NIRadioGroupController *)radioGroupController willAppear:(BOOL)animated;
@end
@@ -304,12 +304,15 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
NIRadioGroupController* controller = [[NIRadioGroupController alloc] initWithRadioGroup:self tappedCell:(id<NICell>)[tableView cellForRowAtIndexPath:indexPath]];
controller.title = self.controllerTitle;
+ BOOL shouldPush = YES;
// Notify the delegate that the controller is about to appear.
if ([self.delegate respondsToSelector:@selector(radioGroup:radioGroupController:willAppear:)]) {
- [self.delegate radioGroup:self radioGroupController:controller willAppear:YES];
+ shouldPush = ![self.delegate radioGroup:self radioGroupController:controller willAppear:YES];
}
- [self.controller.navigationController pushViewController:controller animated:YES];
+ if (shouldPush) {
+ [self.controller.navigationController pushViewController:controller animated:YES];
+ }
} else if ([self isObjectInRadioGroup:object]) {
NSInteger newSelection = [self identifierForObject:object];

0 comments on commit 63b5d78

Please sign in to comment.