Iphone 在代码中点击UIBUtton的反馈?

Iphone 在代码中点击UIBUtton的反馈?,iphone,objective-c,ios,ipad,Iphone,Objective C,Ios,Ipad,我有按钮和按钮选择器,代码如下所示: [cell.secondColumnButton addTarget:self action:@selector(whichButtonDidMasterPressed:) forControlEvents:UIControlEventTouchUpInside]; [cell.secondColumnButton addTarget:self action:@selector(moreResponsiveButto

我有按钮和按钮选择器,代码如下所示:

[cell.secondColumnButton addTarget:self action:@selector(whichButtonDidMasterPressed:)    
                 forControlEvents:UIControlEventTouchUpInside];
[cell.secondColumnButton addTarget:self action:@selector(moreResponsiveButtons:)    
                 forControlEvents:UIControlEventTouchDown];
[cell.secondColumnButton addTarget:self action:@selector(moreResponsiveButtons:)    
                 forControlEvents:UIControlEventTouchUpInside];
现在,我在“更具响应性”选择器中有以下内容:

-(void)moreResponsiveButtons:(UIButton*)sender{
   NSLog(@"responsiveButton");
   [sender setAlpha:0.5];
   [sender setBackgroundColor:[UIColor lightGrayColor]];
}
当按钮处于正常状态时,它是不可见的,但我想更改状态,以便在用户点击它时获得反馈

所以问题有两个方面,我应该使用哪一个forControlEvents

我应该在选择器中输入什么代码


按钮很大,250 x 175点。

如果按钮隐藏,用户如何知道在何处点击按钮

尝试使用UIControlEventTouchUpInside,如下所示:

[cell.secondColumnButton addTarget:self action:@selector(whichButtonDidMasterPressed:)    
                 forControlEvents:UIControlEventTouchUpInside];
[cell.secondColumnButton addTarget:self action:@selector(moreResponsiveButtons:)    
                 forControlEvents:UIControlEventTouchDown];
[cell.secondColumnButton addTarget:self action:@selector(moreResponsiveButtons:)    
                 forControlEvents:UIControlEventTouchUpInside];
编辑

[sender setHidden:NO];
[sender setTitle:@"Hey you pressed this button" forState:UIControlStateNormal];

你们可以在触摸之前设置按钮的标题,因为按钮是隐藏的,所以它将不可见。触摸后,您只需将“隐藏”设置为“否”,然后瞧。按钮显示为内部文本。

按钮只是下面更多内容的叠加,但是如果我应该在whichbuttonddmasterpressed选择器中放置响应性更强的代码,建议我将哪个代码放在那里?我不太理解你。但是如果你想显示这个按钮,你应该设置属性setHidden:NO或者setAplha:1.0。如果您将alpha设置为1.0,但按钮以前是隐藏的,您将看不到它。该按钮应仅在用户点击时可见,然后它应仅向用户提供反馈,如“嘿,您按下了此按钮”。这是我的问题,让我担心按钮处于正常状态;-)只需注意,将按钮设置为隐藏将禁用用户在其上的交互。我不是100%确定,但我认为将alpha设置为0.0也有类似的效果。相反,更改按钮的颜色/背景以匹配具有类似视觉效果的背景,但不要禁用按钮。你是对的。将对象设置为隐藏也会禁用用户交互。但我不确定alpha=0.0是否也是如此。。。