简体   繁体   中英

I used xib to load the inputView in my custom keyboard. I Would like to know how to change height of inputView when orientation changes?

i have been developing a custom keyboard with extensions. i would like to change the height of the keyboard when the device rotates. Currently am not using sizes classes just the autolayout constraints. Thanks in advance

When you rotate your device for example portrait to landscape right and Landscap right to portrait.

-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
    if (fromInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
    {
        // change you height constraints here when landscap;
    }
    else if (fromInterfaceOrientation == UIInterfaceOrientationMaskPortrait)
    {
        // change you height constraints here when portrait;
    }
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM