Permalink
Browse files

Added the ability to specify whether the tableview should be scrollab…

…le when a form field is activated and the input provider is being displayed.
  • Loading branch information...
1 parent 27f0de9 commit a2930f015c243991eec498ef399276f8af3001d8 @ittybittydude ittybittydude committed Feb 29, 2012
@@ -22,6 +22,7 @@
CGRect tableViewOriginalFrame_;
IBAFormDataSource *formDataSource_;
CGRect keyboardFrame_;
+ BOOL scrollEnabledOnFormFieldActivation_;
@private
UIView *hiddenCellCache_;
@@ -30,6 +31,7 @@
@property (nonatomic, retain) IBOutlet UITableView *tableView;
@property (nonatomic, readonly) CGRect tableViewOriginalFrame;
@property (nonatomic, retain) IBAFormDataSource *formDataSource;
+@property (nonatomic, assign) BOOL scrollEnabledOnFormFieldActivation;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
formDataSource:(IBAFormDataSource *)formDataSource;
@@ -50,6 +50,7 @@ @implementation IBAFormViewController
@synthesize formDataSource = formDataSource_;
@synthesize keyboardFrame = keyboardFrame_;
@synthesize hiddenCellCache = hiddenCellCache_;
+@synthesize scrollEnabledOnFormFieldActivation = scrollEnabledOnFormFieldActivation_;
#pragma mark -
#pragma mark Initialisation and memory management
@@ -71,6 +72,7 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
self.formDataSource = formDataSource;
self.hidesBottomBarWhenPushed = YES;
+ self.scrollEnabledOnFormFieldActivation = YES;
[self registerForNotifications];
}
@@ -264,6 +266,8 @@ - (void)inputManagerWillShow:(NSNotification *)notification {
[self willShowInputRequestorWithBeginFrame:keyboardBeginFrame endFrame:keyboardEndFrame animationDuration:animationDuration animationCurve:animationCurve];
[self adjustTableViewHeightForCoveringFrame:[self rectForOrientationFrame:keyboardBeginFrame]];
+
+ [[self tableView] setScrollEnabled:[self scrollEnabledOnFormFieldActivation]];
}
- (void)inputManagerDidHide:(NSNotification *)notification {
@@ -281,6 +285,7 @@ - (void)inputManagerDidHide:(NSNotification *)notification {
if (![[IBAInputManager sharedIBAInputManager] activeInputRequestor]) {
[self adjustTableViewHeightForCoveringFrame:CGRectZero];
+ [[self tableView] setScrollEnabled:YES];
}
}

0 comments on commit a2930f0

Please sign in to comment.