开发者

Resize navigation bar in detail view controller

开发者 https://www.devze.com 2023-02-13 07:21 出处:网络
i have built view controller with xib file and navigation bar in it,this view controller is shown in detail view of split view controller,i have design the xi开发者_运维技巧b from interface builder ,b

i have built view controller with xib file and navigation bar in it,this view controller is shown in detail view of split view controller,i have design the xi开发者_运维技巧b from interface builder ,but when i rotate from landscape to portrait mode the navigation bar goes out of bound and little part is not shown in view.

how can i fix it. thanx in advance


make uinavigationbar as variable in you view controller and connect to xib file ,then in you this function write

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Override to allow orientations other than the default portrait orientation.
    if (interfaceOrientation==UIInterfaceOrientationLandscapeLeft || interfaceOrientation==UIInterfaceOrientationLandscapeRight) {

    self.navigationBar.frame= CGRectMake(0, 175, 703,44);   


    } else {

    self.navigationBar.frame= CGRectMake(0, 175, 768,44)

    }
    return YES;
}

hope this will help

0

精彩评论

暂无评论...
验证码 换一张
取 消