【发布时间】:2010-11-09 16:44:55
【问题描述】:
我正在扩展 UITableViewController 并在表格页脚中添加了一个 uibutton,由于某种原因,uibutton 仅在触摸顶部时触发......好像某些东西掩盖了它的其余部分,我无法理解这是什么 我在 viewForFooterInSection 函数中有以下代码:
CGRect screenRect = [[UIScreen mainScreen] applicationFrame];
UIView* footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, screenRect.size.width, 44.0)];
footerView.autoresizesSubviews = YES;
footerView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
footerView.userInteractionEnabled = YES;
goButton = [UIButton buttonWithType:UIButtonTypeCustom];
[goButton addTarget:self action:@selector(getReport)forControlEvents:UIControlEventTouchUpInside];
[goButton setTitle:@"GO!" forState:UIControlStateNormal];
[goButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
goButton.frame = CGRectMake(50, 20, 220.0, 50.0);
UIImage *bg = [UIImage imageNamed: @"but_go.png"];
[goButton setBackgroundImage:bg forState:UIControlStateNormal];
[goButton setBackgroundColor:[UIColor clearColor]];
if (self.optimizations == nil || self.optimizations.count < 1){
goButton.enabled = NO ;
}
[footerView addSubview: goButton];
return footerView;
【问题讨论】:
标签: iphone objective-c cocoa-touch uibutton