`

Device orientation

 
阅读更多
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
    return YES;
}

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
                                         duration:(NSTimeInterval)duration
{
    UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
    if (UIDeviceOrientationIsLandscape(orientation))
    {
        [view setFrame:CGRectMake(0, 0, 480, 320 - 44)];
    }
    else
    {
        [view setFrame:CGRectMake(0, 0, 320, 460 - 44)];
    }
    [view reloadData];
}


view.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleTopMargin;
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics