开发者

subclass uitableview already in a UIView

开发者 https://www.devze.com 2023-03-12 08:48 出处:网络
I am trying to implement Le开发者_StackOverflowah\'s \"Pull to Refresh\" code (https://github.com/leah/PullToRefresh) in to my UITableView. However, I have a UIView, so cannot subclass the tableViewCo

I am trying to implement Le开发者_StackOverflowah's "Pull to Refresh" code (https://github.com/leah/PullToRefresh) in to my UITableView. However, I have a UIView, so cannot subclass the tableViewController as is required by this.

My structure is

UIView
  - UITableView

So there's a UITableView inside my main UIView. I use a UIViewController obviously - and this cannot really change (I think!)

I have tried to change the class in interface builder to the custom uitableviewcontroller above (the pull to refresh one) but it doesn't let me.

Any ideas on how I can subclass the UITableView - NOT the tableViewController??


Here is how I did it:

Change PullToRefreshTableViewController so that it subclasses UIViewController, NOT UITableViewController. Next, add a UITableView * property called tableView to PullToRefreshTableViewController and synthesize it. Lastly, modify your view controller so that it subclasses PullToRefreshTableViewController instead of UIViewController.

That should give you a working implementation of it.

0

精彩评论

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