ユニバーサルアプリケーションを開発していて、iPhoneでうまく動作するUIButtonがありますが、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で試してみてください。 –