2013-03-20 46 views
1

我在UISplitViewController(它在UITabbarController中)有一個UITablevView。 我的表是太長,當我在橫向開始,所以我設置UITableView錯誤的長度

CGRect frame = self.view.frame; 
    switch([[UIApplication sharedApplication] statusBarOrientation]) { 
     case UIInterfaceOrientationLandscapeRight: 
      frame.size.height = 768-20-44; 
      self.view.frame = frame; 
      break; 
     case UIInterfaceOrientationLandscapeLeft:   
      frame.size.height = 768-20-44; 
      self.view.frame = frame; 
      break; 
     case UIInterfaceOrientationPortrait: 
      frame.size.height = 1024-20-44; 
      self.view.frame = frame; 
      break; 
     case UIInterfaceOrientationPortraitUpsideDown: 
      frame.size.height = 1024-20-44; 
      self.view.frame = frame; 
      break; 
    } 

這個工程。 但是當我的SearchDisplayController(也有錯誤的長度)隱藏時,我的tableview又太長了。 我能做什麼?

+0

你在爲什麼版本的iOS?並確切地定義你的意思是「太長」 – 2013-03-20 15:09:26

+0

在所有情況下,你有相同的身高,那麼爲什麼不是一個案例?甚至沒有情況? – 2013-03-20 15:09:45

+0

表格比屏幕大,所以我可以滾動「外部」也有一些單元格不可達。 – Sebastian 2013-03-20 15:14:08

回答

0

請檢查這個代碼:https://github.com/alexth/TBSV,也許它會幫助你。這是關於如何在一個項目中將UITableView,UINavigationController,UITabBar和UISplitViewController與兩個方向上的正確元素混合使用。

+0

我會在週末看看這個,謝謝 – Sebastian 2013-03-27 07:10:18

+1

我發現我的問題和例子讓我以正確的方式。 (我隱藏tabbar,但我必須這樣做之前,我做任何事情與tabbar,當我做它以後它搞亂控制器的整體大小計算) – Sebastian 2013-04-03 10:44:52

+0

我很高興,如果它是有用的。乾杯! – Alex 2013-04-03 13:31:12