nagyist / bggiphone

Automatically exported from code.google.com/p/bggiphone
0 stars 0 forks source link

Search immediate list too tall, prevents selection of bottom items when keyboard is present #80

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Go to "Settings", make sure there is a valid username (who owns more than 5 
games with the letter 'e', e.g. "gerald").
2. Go to "Games Owned", wait for list to download if necessary.
3. Go to "Search", type 'e'.

What is the expected output?
Allow user to select any of the items listed.

What do you see instead?
The list goes under the keyboard (which cannot be hidden), making it impossible 
to select items at the bottom of the list.

What version of the product are you using? On what operating system?
1.7.4, iOS 6.1.

Please provide any additional information below.
Easy fix is to resize the table to fit above the keyboard. Will provide example 
code below...

Original issue reported on code.google.com by squel...@gmail.com on 23 Feb 2013 at 12:55

GoogleCodeExporter commented 9 years ago
Add this to SearchUIViewController.m:

- (void)viewWillAppear:(BOOL)animated {
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(keyboardWasShown:)
                                                 name:UIKeyboardDidShowNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(keyboardWillBeHidden:)
                                                 name:UIKeyboardWillHideNotification object:nil];
}
- (void)viewDidDisappear:(BOOL)animated {
    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardDidShowNotification object:nil];
    [[NSNotificationCenter defaultCenter] removeObserver:self name:UIKeyboardWillHideNotification object:nil];
}

- (void)keyboardWasShown:(NSNotification*)aNotification
{
    NSDictionary* info = [aNotification userInfo];
    CGSize kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
    CGRect f = self.view.frame;
    f.size.height -= kbSize.height;
    self.view.frame = f;
}

// Called when the UIKeyboardWillHideNotification is sent
- (void)keyboardWillBeHidden:(NSNotification*)aNotification
{
    NSDictionary* info = [aNotification userInfo];
    CGSize kbSize = [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue].size;
    CGRect f = self.view.frame;
    f.size.height += kbSize.height;
    self.view.frame = f;
}

Original comment by squel...@gmail.com on 23 Feb 2013 at 12:57