How can I check if a TTTabItem gets selected?

Posted by schoash on Stack Overflow See other posts from Stack Overflow or by schoash
Published on 2010-04-22T23:18:30Z Indexed on 2010/04/22 23:23 UTC
Read the original article Hit count: 247

Filed under:
|
|

I have several TTTabGrids in my view and now I am stuck with the problem, that I can't figure out, how to detect, when a TTTabItem gets touched. If someone selects an item in one of the TTTabGrids I should upadate some labels. Can someone tell me a way how to detect, when the selection in a TTTabGrid gets changed?

My code looks like this:

@interface MyTTTabGrid : TTTabGrid
@end

@implementation MyTTTabGrid

- (id)initWithFrame:(CGRect)frame  columns:(NSInteger)columns{
  if (self = [super initWithFrame:frame]) {
   self.style = TTSTYLE(tabGrid);
   _columnCount = columns;
  }
  return self;
}

@end

- (void)viewDidLoad {
[super viewDidLoad];

_tabBarHours = [[MyTTTabGrid alloc] initWithFrame:CGRectMake(10, _tabBarZone.bottom+10, 300, 0) columns:7];
_tabBarHours.backgroundColor = [UIColor clearColor];
NSMutableArray *tmpHours = [[NSMutableArray alloc] init];
int i=6;
while (i<20) {
  [tmpHours addObject:[[[TTTabItem alloc] initWithTitle:[NSString stringWithFormat:@"%d", i]] autorelease]];
  i++; 
}
_tabBarHours.tabItems = tmpHours;
[_tabBarHours sizeToFit];
[self.view addSubview:_tabBarHours];
[tmpHours release];
}

© Stack Overflow or respective owner

Related posts about three20

Related posts about iphone