草庐IT

UIBUTTON

全部标签

iphone - 在没有淡入淡出效果的情况下禁用 UIButton

当我使用Button.enabled=NO;禁用按钮时,按钮会淡出。是否可以预防?我想禁用按钮的功能,但我希望它具有相同的外观。 最佳答案 尝试使用[ButtonsetUserInteractionEnabled:NO];希望对你有帮助! 关于iphone-在没有淡入淡出效果的情况下禁用UIButton,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/questions/13513887/

iphone - 禁用 UIButton 直到 UITextField 中有文本

如何在UITextField中有文本之前禁用UIButton。我的代码似乎不起作用。if([nameTextField.textisEqualToString:@""]){[myButtonsetEnabled:NO];} 最佳答案 这是来自kingthong'sblogpost的代码,这对我有用:-(void)viewDidLoad{[superviewDidLoad];[self.saveButtonsetEnabled:NO];[[selfmyTextField]becomeFirstResponder];[myTextFie

ios - 使用 UIButton 数组检测哪个按钮被按下

我有一个像这样的UIButton数组:@property(nonatomic,retain)IBOutletCollection(UIButton)NSArray*btn_Impact_Collection;我有这个功能:-(IBAction)impactAction:(id)sender;在XIB文件中我有九个按钮,每个按钮都连接到带有引用socket集合的btn_Impact_Collection数组。此外,每个按钮的Touch_inside属性都连接到函数ImpactAction。现在,当单击按钮时,将调用ImpactAction函数,但在该函数内,我如何知道按下了哪个按钮?预先

objective-c - 如何取消连接到 UIButton 的 segue

我正在研究这个tutorial,其中展示了如何使用Storyboard创建应用程序。我的viewController有两个UIButtons,我已经将一个segue连接到这些UIButtons。这些segues推送一个新的viewController。现在我正在寻找一种方法来在某个条件变为真时取消此segue。当我使用旧的xib文件创建我的界面时,我能够做这样的事情:-(IBAction)sendButton:(id)sender{if(TRUE){//STOP!!}}这不再起作用了。如何取消新viewController的推送? 最佳答案

ios - 点击 iOS 7 时更改背景图像并为 UIButton 设置动画

这个问题在这里已经有了答案:AnimatingonlytheimageinUIBarButtonItem(4个答案)关闭8年前。我有一个由以下代码创建的UIButtonbutton=[UIButtonbuttonWithType:UIButtonTypeCustom];[buttonsetImage:[UIImageimageNamed:@"refresh_icon.png"]forState:UIControlStateNormal];[buttonsetImage:[UIImageimageNamed:@"reload_selected.png"]forState:UIContro

ios - UIButton 在我不希望它是透明的时候是透明的

我有一个按钮,我将其放置在自定义UICollectionViewCell的顶角。出于某种原因,它看起来是半透明的,以便在我不希望出现这种情况时通过按钮显示单元格的边框。在我的CustomCollectionviewCell中:lazyvarfavoriteButton:UIButton={letbutton=UIButton(type:.system)button.setImage(#imageLiteral(resourceName:"star_white").withRenderingMode(.alwaysOriginal),for:.normal)button.addTarge

ios - UIButton 在 uiscrollView 中不起作用

我有一个scrollView,它有一个UIView作为subview。这具有作为UIViewsubview的UIButton。只有scrollView连接到socket,其余的都在代码中。该按钮不响应触摸,触摸时不会变成蓝色。我该怎么做才能让它发挥作用?这是代码:-(void)viewDidLoad{[superviewDidLoad];//......self.buttonHome=[UIButtonbuttonWithType:UIButtonTypeCustom];[self.buttonHomeaddTarget:selfaction:@selector(pressedHome

ios - 无法更改 UIButton 上的自定义 UIFont 大小

我有一个按钮,我使用自定义UIFont来显示文本。字体正确加载并正确应用于按钮标题。我的问题是我似乎无法更改字体大小:UIButton*button=[UIButtonbuttonWithType:UIButtonTypeRoundedRect];[buttonaddTarget:selfaction:@selector(loginButtonClicked:)forControlEvents:UIControlEventTouchUpInside];[buttonsetTitle:@"Login"forState:UIControlStateNormal];button.frame=

iphone - 以编程方式编写 UIButton 操作代码

我正在尝试创建一个按钮,点击后将显示另一个UIView的弹出窗口。为了对此进行测试,我的viewDidLoad部分中有以下代码:-(void)viewDidLoad{[superviewDidLoad];self.hard1=[UIButtonbuttonWithType:UIButtonTypeCustom];[self.hard1setFrame:CGRectMake(884,524,105,60)];//setthex,y,widthandheightbasedonyourspecsUIImage*buttonImage=[UIImageimageNamed:@"green.jp

objective-c - UIBarButtonItem with UIButton as CustomView - 从 UIButton,如何访问它的 UIBarButtonItem?

我有一个UIBarButtonItem和UIButton作为自定义View。UIButton上有一个addTarget:action:。在Action中,我展示了一个弹出窗口。我目前正在从sender.frame(UIButton的框架)进行展示,我想从UIBarButtonItem进行展示。如何从UIButton访问UIBarButtonItem? 最佳答案 如果您已将UIButton设置为UIBarButtonItem的customView或自定义View的subview,那么您可以向上走从按钮开始的View层次结构,直到找到包