Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I add TTTableViewDragRefreshDelegate only for one page in UITabBarController?

Hi I have a tabbar controller which includes two pages A and B. Now I just want to add TTTableViewDragRefreshDelegate to page A.

If I put the code:

- (id<TTTableViewDelegate>) createDelegate {
  TTTableViewDragRefreshDelegate *delegate = [[TTTableViewDragRefreshDelegate alloc] initWithController:self];

  return [delegate autorelease];
}

Into UITabBarController then both A and B got refresh, so I put above code into A's view controller and call A's view controller in UITabBarController like this:

if (_page == APage) {
  AViewController *_aViewController = [[[AViewController alloc] init] autorelease];             

  self.dataSource = _aViewController.dataSource; 
  ...
}

But seems not work, page A still not get drag and refresh. So how can I get TTTableViewDragRefreshDelegate only for page A in a UITabBarController?

This is AViewController init code:

- (id)init {
  if (self = [super init]) {
    self.variableHeightRows = YES;
    id<TTTableViewDataSource> ds = [APageDataSource dataSourceWithItems:nil];
    ds.model = CreateTabModelWithCurrentSettings();
    self.dataSource = ds;
  }

  return self;
}

How to let make page A get all AViewController's properties? Like AViewController's model, dataSource, something like that?

like image 540
Jason Zhao Avatar asked Nov 14 '22 20:11

Jason Zhao


1 Answers

AViewController should be a subclass of TTTableViewController

like image 58
disorderdev Avatar answered May 16 '23 08:05

disorderdev