在我的应用程序的开发过程中发生了一些奇怪的事情。我有一个观点,其中有几个UIButtons。所有使用自定义艺术作品,并与CostumType UIButton。 对我来说一切都感觉很对。在模拟器和手机上。与自定义类型的UIButton似乎不能正常工作
但是,当我将应用程序放在别人的手中时,该人点击一个按钮,它将无法工作。它感觉就像按钮只是对某个水龙头的反应,实际上感觉不对(如果将其与正常行为进行比较)。
我该怎么做才能使其表现正常?正常意味着用于iOS应用的人可以像使用它一样使用它,除非它工作。
这里是一个按钮的示例代码:
focusButton = [UIButton buttonWithType:UIButtonTypeCustom];
[focusButton setFrame:CGRectMake(self.bounds.size.width-(self.bounds.size.width/widthFactor)+108, self.bounds.origin.y+(self.bounds.size.height/(heightFactor*2))+2, 36, 40)];
focusButton.contentHorizontalAlignment = false; // I think these lines doesn't effect the behavior
focusButton.contentVerticalAlignment = false;
[focusButton setBackgroundImage:[UIImage imageNamed:@"arrowUp.png"] forState:UIControlStateNormal];
[focusButton setBackgroundImage:[UIImage imageNamed:@"arrowUpH.png"] forState:UIControlStateHighlighted];
[focusButton addTarget:self action:@selector(focusOrDefocusCourse) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:focusButton];
按钮背景是这样的:
一旦与像正常帧试验[btn_foucs SETFRAME:CGRectMake(20,20,200,40)]; –