我正在开发一个通用应用程序,并且里面有一个UIButton,它可以在iPhone上正常工作,但是当我在iPad中单击它时,需要多次点击尝试才能发生触摸事件。iPad:UIButton需要很多攻丝尝试才能捕捉到动作
例如点击5-6点后执行点击事件。
以下是UIButton代码。请帮忙。
UIView *footer = [[[UIView alloc] initWithFrame:(CGRectMake(0, 0, self.tableView.frame.size.width, 54))] autorelease];
float buttonWidth = (int)((self.tableView.frame.size.width - 12 - 12)/3);
float buttonHeight = 44;
if (clientState.Devicetype == 1) // 1=Ipad
buttonHeight = 90;
cash = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain];
cash.frame = CGRectMake(6, 10, buttonWidth, buttonHeight);
[cash setTitle:@"Cash" forState:UIControlStateNormal];
[cash setTitleColor:[UIColor lightGrayColor] forState:UIControlStateDisabled];
[cash addTarget:self action:@selector(handleCash:) forControlEvents:UIControlEventTouchUpInside];
cash.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleRightMargin;
if (clientState.Devicetype == 1) // 1=Ipad
{
cash.titleLabel.font = [UIFont systemFontOfSize:28];
}
[footer addSubview:cash];
self.tableView.tableFooterView = footer;
我曾经在处理UISlider的类似问题,结果发现iPad在触摸屏上滑动的区域存在问题。以防万一在另一台iPad上试用您的应用程序。 –