0

正如问题的标题所述,当我按住 iOS 中的按钮时,我希望显示按钮的标题。我该怎么做?需要一些建议。。

4

3 回答 3

3

试试这个,也许它会帮助你...

[btnName setTitle:@"Your Title" forState:UIControlStateHighlighted];
于 2013-01-25T10:45:43.300 回答
2

用这个:

-(IBAction)BtnTouchdown:(id)sender
{
    mytimer = [NSTimer scheduledTimerWithTimeInterval:3.0 target:self selector:@selector(showBtnTitle) userInfo:nil repeats:NO];                
}

-(void)showBtnTitle
{
   //use label to show title
}
于 2013-01-25T10:44:24.160 回答
1

只需为 UIControlStateHighlighted 设置标题...而对于其他状态应该没有标题...

[btnName setTitle:@"Title" forState:UIControlStateHighlighted];

[btnName setTitle:@"" forState:UIControlStateNormal];

[btnName setTitle:@"" forState:UIControlStateSelected];
于 2013-01-25T10:57:16.397 回答