iOS模拟器底部的删除/折叠栏

时间:2012-11-20 16:25:46

标签: ios testing webdriver simulator

我可以使用webdriver在iOS模拟器上成功运行测试,我唯一担心的是屏幕底部有一个栏,可以防止整个屏幕显示。它不会导致测试失败,只是想知道是否有办法删除/折叠它以便显示整个屏幕。

1 个答案:

答案 0 :(得分:0)

如果您使用Uitabbar,则可以使用:

[self hideTabBar:your tabbarcontroller];//call to hide the tabbar;
[self showTabBar:your tabbarcontroller];//call to show the tabbar;


  - (void)hideTabBar:(UITabBarController *) myTabbarController
    {
       [UIView beginAnimations:nil context:NULL];
       [UIView setAnimationDuration:0.5];

       for(UIView *myView in myTabbarController.view.subviews)
          {
             if([myView isKindOfClass:[UITabBar class]])
               {
                  [myView setFrame:CGRectMake(myView.frame.origin.x, 480,
                   myView.frame.size.width,
                    myView.frame.size.height)];
                } 
               else 
                  {
                       [myView setFrame:CGRectMake(myView.frame.origin.x, 
                        myView.frame.origin.y,  
                        myView.frame.size.width, 480)];
                   }
           }

             [UIView commitAnimations];   
        }

   - (void)showTabBar:(UITabBarController *) tabbarcontroller
      {       
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:0.5];
        for(UIView *view in tabbarcontroller.view.subviews)
          {

            if([view isKindOfClass:[UITabBar class]])
             {
                [view setFrame:CGRectMake(view.frame.origin.x, 431, view.frame.size.width,
                view.frame.size.height)];

              } 
            else 
              {
                [view setFrame:CGRectMake(view.frame.origin.x, view.frame.origin.y, 
                  view.frame.size.width, 431)];
              }
           }

          [UIView commitAnimations]; 
       }