Button not working in a table header
Any help will be appreciated.
Thanks
MAc Mini, Mac OS X (10.5.2)
MAc Mini, Mac OS X (10.5.2)
CTopView *top = [[CTopView alloc] initWithWidth: self.view.bounds.size.width andCDef:chdef andIndex:self.cIndex ];
top.userInteractionEnabled = YES;
mListView.tableHeaderView = top;
[top release];
//add the previous arrow button
button = [[UIButton alloc] initWithFrame:CGRectZero];
[button setImage:leftArrow forState:UIControlStateNormal];
[button addTarget:self action:@selector(previousChannel:) forControlEvents:UIControlEventTouchUpInside];
button.tag = CHANNELLEFT_ARROWTAG;
[self addSubview:button];
[button release];
- (void)doStuff:(id)sender
{
NSLog(@"Logo Touched!");
}
- (void)viewDidLoad {
// loadingView is a UIView that becomes the tableHeaderView
self.tableView.tableHeaderView = loadingView;
[loadingActivity startAnimating];
// setup a sample button (declared in header)
logoButton = [[UIButton alloc] initWithFrame:CGRectZero];
[logoButton setImage:[UIImage imageNamed:@"logo_webclip.png"] forState:UIControlStateNormal];
[logoButton addTarget:self action:@selector(doStuff:) forControlEvents:UIControlEventTouchUpInside];
logoButton.tag = 100;
[loadingView addSubview:logoButton];
}
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
logoButton.frame = CGRectMake(50., 50., 64., 64.);
}
button = [[UIButton alloc] initWithFrame:CGRectMake(0,0,width,height)];
UIButton *credit = [UIButton buttonWithType:UIButtonTypeCustom];
credit.frame = CGRectMake(0, 0, 480, 60);
[credit setImage:[UIImage imageNamed:@"..."] forState:UIControlStateNormal];
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [[event allTouches] anyObject];
lastLocation = [touch locationInView:self];
[super touchesEnded:touches withEvent:event];
}
[super touchesBegan:touches withEvent:event];
Button not working in a table header