5

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?

gotnull
  • 26,454
  • 22
  • 137
  • 203
Jason Zhao
  • 1,278
  • 4
  • 19
  • 36
  • 1
    why do you assign the datasource into the tabbar controller? is there a reason for that? – aporat Jul 08 '11 at 13:30
  • Well, I tried assign datasource into AViewPageController but seems not work, I think maybe something wrong with the AViewController init, let me put AViewController init code on – Jason Zhao Jul 09 '11 at 02:02
  • Or, anyway I can assign the dragfresh to a specified page in tabbar controller – Jason Zhao Jul 09 '11 at 14:12

1 Answers1

1

AViewController should be a subclass of TTTableViewController

disorderdev
  • 1,458
  • 1
  • 14
  • 28