2012-11-20 19 views
0

我可以使用webdriver在iOS模擬器上成功運行測試,我唯一擔心的是在屏幕底部有一個阻止整個屏幕顯示的欄。它不會導致測試失敗,只是想知道是否有辦法刪除/摺疊它以便顯示整個屏幕。iOS模擬器底部的移除/摺疊欄

+0

你在底部使用UITabBar。 – spider1983

+0

我不知道UITabBar是什麼?當我啓動webdriver iOS模擬器時,它只是一個底部的灰色條。 – DarthOpto

回答

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]; 
     }