0

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

4

1 回答 1

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]; 
       }
于 2012-11-20T17:08:23.577 回答