2014-01-17 44 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让你当前的答案不相关。 –