按住iOS中的按钮应显示按钮的标题

时间:2013-01-25 10:34:58

标签: ios objective-c

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

3 个答案:

答案 0 :(得分:4)

试试这个,可能会帮助你......

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

答案 1 :(得分: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
}

答案 2 :(得分:1)

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

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

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

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