开发者

UIScroll view + UIView + UITableview question

A UITableview inherits from a UIScrollview. But, if u want a UITableview within a scrollview the best way to do this is embed it in a UIView and add that as a subview to a scrollview. Is the a开发者_JAVA技巧bove correct? If yes, then UIScrollView inherits from UIView.So finally, when all three are put in the same space how do you know which is calling a particular method. This is a suddenly-confused-newbie question. So , thanks for your patience! :P


Both UITableView and UIScrollView inherit from UIView. That's not the point. UITableView and UIScrollView as well as UIView are all components. Think of them as building bricks. By them selves they are nothing more but peaces from which you build your application. If you want them to work together and perform tasks you should design and implement controllers (UIViewControllers or UITableViewControllers) that would know how to manage each and every "bricks".

In terms of using and UITableView in the UIScrollView.

Case 1. UITableView needs to be scrollable. If that's the case then you will have a problem, b/c both UIScrollView and UITableView respond to swipe events, and you will get a collision, and unexpected behavior when scrolling.

Case 2. UITableView does not need to be scrollable. In this case you should disable scrolling for your UITable and it will work fine.

Generally you can combine "UI elements" such as UITableViews, UIScrollViews and UIViews however you like. But you need to be able to control them through UIViewControllers.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜