UITableViewController and UITextField keyboard

后端 未结 3 759
-上瘾入骨i
-上瘾入骨i 2021-02-08 12:31

I have a UITableViewController with a grouped static UITableView. I am defining the cells for my static table view on the storyboard. One of the cells has a textfield in it. Whe

3条回答
  •  广开言路
    2021-02-08 13:26

    Pushes the view up if one of the table forms is selected for editing (requires keyboard notification implementation)

    - (void) keyboardDidShow:(NSNotification *)aNotification
    {
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:0.25];
        self.view.center = CGPointMake(self.view.center.x, self.view.center.y-moveAmount);
        [UIView commitAnimations];
        isRaised = [NSNumber numberWithBool:YES];
    }
    

    Resizes the table (divides height by 2). Swap this into the keyboard did show method. Also, you can use the keyboard did hide method to undo this stuff.

    CGRect temp = CGRectMake(mineTable.frame.origin.x, mineTable.frame.origin.y, mineTable.frame.size.width, mineTable.frame.size.height/2);
    mineTable.frame = temp;
    

提交回复
热议问题