1) hideKeyboard (below) does not hide keyboard. I verified that the view it receives is a text field.
2) I have a table in a nav controller in another view I call "main view". The main view is fully occupied by the nav controller.
The table should show numbers 0 through 49, but goes to 38. It tries to scroll further, but bounces back.
Code:
UIView* findFirstResponder(UIView* start)
{
if (start.isFirstResponder)
{
return start;
}
for (UIView *subView in start.subviews)
{
UIView* ret = findFirstResponder(subView);
if (ret)
{
return ret;
}
}
return nil;
}
void hideKeyboard()
{
UIView* v = findFirstResponder(gMainView);
[v resignFirstResponder];
}
2) I have a table in a nav controller in another view I call "main view". The main view is fully occupied by the nav controller.
The table should show numbers 0 through 49, but goes to 38. It tries to scroll further, but bounces back.
Code:
#import "TestTable.h"
@implementation TestTable
- (NSInteger)numberOfSectionsInTableView:(UITableView*)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 50;
}
-(UITableViewCell*) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:@"TestTable"];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"TestTable"];
}
cell.textLabel.text = [@"" stringByAppendingFormat:@"%lu", indexPath.row];
return cell;
}
@end