2014-01-17 97 views
0

我有一個UITableView位於視圖附加到SlidingPanel。無法讓UITableView滾動我的SlidingPanel內

我使用SlidingPanels.Lib,和我有一個自定義演示

Here's a gist of the custom presenter

從那裏我MenuView真的是直線前進。

public class MenuView : ViewControllerBase 
{ 
    private new MenuViewModel ViewModel { get { return (MenuViewModel)base.ViewModel; } } 

    public override void ViewDidLoad() 
    { 
     base.ViewDidLoad(); 

     // todo: this should actually be... 
     // _currentBookId = currentUser.UserBooks[0].BookId; 
     // _homeViewModel.ChapterViewModel = Mvx.Resolve<IChapterService>().FindByBookId(_currentBookId); 
     ViewModel.Chapters = Mvx.Resolve<IChapterService>().Find(); 

     // this ensures the sliding panel doesn't fill the entire view. 
     var frame = View.Frame; 
     frame.Width = 300; 
     View.Frame = frame; 

     // var currentUser = Mvx.Resolve<IUserService>().GetById(Mvx.Resolve<UserModel>().Id); 

     var label = new UILabel(new RectangleF(10, 10, 300, 40)) 
     { 
      TextColor = UIColor.White, 

     }; 
     Add(label); 

     //var listHeight = (chapters.Count*40); 
     var navigationList = new UITableView(new RectangleF(0, 50, 300, 300)) 
      { 
       Source = new NavigationTableSource(ViewModel.Chapters) 
      }; 
     Add(navigationList); 

     var set = this.CreateBindingSet<MenuView, MenuViewModel>(); 
     set.Bind(label).To(vm => vm.DisplayName); 
     set.Apply(); 
    } 
} 

不幸的是,我不確定在哪裏尋找以允許TableView滾動。我可以看到它,但它超出了屏幕的底部。

回答

0

拿了幾個dicking左右的時間來發現,我從@ patbonecrusher的Github repo抓住原始的源代碼已經從LIB一定的差異,你可以找到在@ fcaico的Github repo

長話短說...我所要做的只是編譯@ fcaico的版本並將其部署到我的應用中,並且滾動回來了。現在我意識到@ fcaico的回購只是包含一個子模塊到@ patbonecrusher的,但由於某種原因...重新編譯修復了這個問題。沒有很多時間來挖掘原因。

0

我認爲這個問題是:

 var listHeight = (chapters.Count*40); 

取而代之的是,嘗試的高度設置爲可用屏幕高度(取決於其iPhone/iPad的你是)。在此之後,該列表將在該可用高度內滾動。

+0

我其實已經嘗試將高度設置爲300(這比視圖的高度更低),但它仍然拒絕滾動。 –

+0

我剛剛更新了我的問題,並從示例中刪除了該行。對不起@stuart讓你當前的答案不相關。 –