当焦点在按钮上时,突出显示按钮 [英] highlight the buttons, when the focus is on it

查看:46
本文介绍了当焦点在按钮上时,突出显示按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个视图,其中有4个按钮,当我单击特定按钮时,该按钮上的焦点变为蓝色,并相应显示下一个视图.但是我想要一个视图,例如当我将鼠标保持在特定按钮上时,或者当我仅触摸特定按钮时,它应该被突出显示...类似于网页中的内容...在iphone中是可能的

I have a view hwre there are 4 buttons, when i click a particular button, the focus on that button changes to blue color, and the next view is displayed accordingly.. but i want a view , like when i just keep the mouse on the particular button, or when i just touch the particular button, it should get highlighted... similar to the one in web pages... is it possible in iphone

推荐答案

在您实际触摸之前,无法检测到手指悬停在按钮上.

There is no way to detect your finger hovering over the button until you actually touch..

但是您可以使用以下方法来更改按钮的状态,当按钮被按下但尚未释放时或您要处理的任何状态.

But you can use the following methods to change button appearances when its pressed but not yet released or whatever state you like to handle..

- (void)setTitle:(NSString *)title forState:(UIControlState)state;  
- (void)setTitleColor:(UIColor *)color forState:(UIControlState)state;
- (void)setTitleShadowColor:(UIColor *)color forState:(UIControlState)state;
- (void)setImage:(UIImage *)image forState:(UIControlState)state;           
- (void)setBackgroundImage:(UIImage *)image forState:(UIControlState)state; 

这篇关于当焦点在按钮上时,突出显示按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆