【问题标题】:UIWebView, SearchBar, and TabBar not resizing correctly after the view is reloaded in landscape?UIWebView、SearchBar 和 TabBar 在横向重新加载视图后无法正确调整大小?
【发布时间】:2013-06-30 15:10:09
【问题描述】:

我有一个标签栏应用程序,它在一个标签中显示网络浏览器。当您旋转视图时,一切正常,但是当您切换到另一个选项卡然后以横向返回该选项卡时,视图 webview、搜索栏和工具栏将返回纵向布局。这是我使用的代码,但它没有t 似乎工作:

#define isPortrait [[UIApplication sharedApplication] statusBarOrientation] ==     UIInterfaceOrientationPortrait || [[UIApplication sharedApplication] statusBarOrientation] == UIInterfaceOrientationPortraitUpsideDown

if(isPortrait)
{
    browser.frame = CGRectMake(0, 68, 320, 408);
    addressBar.frame = CGRectMake(0, 23, 320, 44);
    toolBar.frame = CGRectMake(0, 478, 320, 44);
}
else
{
    browser.frame = CGRectMake(0, 68, 320, 408);
    addressBar.frame = CGRectMake(0, 23, 320, 44);
    toolBar.frame = CGRectMake(0, 478, 320, 44);
}

这一切都在我的 viewdidload 方法中。

【问题讨论】:

    标签: ios uiwebview uisearchbar uitabbar uitoolbar


    【解决方案1】:
    -(void)viewDidAppear:(BOOL)animated
    {
        if (UIInterfaceOrientationIsLandscape([UIDevice currentDevice].orientation)) {
            browser.frame = CGRectMake(0, 68, 568, 160);
            addressBar.frame = CGRectMake(0, 23, 568, 44);
            toolBar.frame = CGRectMake(0, 227, 568, 44);
        }
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-10-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多