草庐IT

uibuttons

全部标签

ios - 多次调用 UITableViewCell 中的禁用/启用 UIButton

这是一个相当简单的情况:我有自定义的UITableViewCell类,它有自己的属性、socket和东西。其中有两个UIButtons->Like和Dislike。您可以将它们视为喜欢或不喜欢评论按钮。我已经像这样向它们添加了IBAction(在TableViewController中,而不是CustomCell类中):-(IBAction)likeComment:(UIButton*)sender{CustomTableCell*thisCell=(CustomTableCell*)[[[sendersuperview]superview]superview];//tofetchth

ios - 子类化 UIButton

我想知道您是否认为子类化UIButton在我的情况下是个好主意,如果是的话,具体应该怎么做?所以情况是,我的项目中有三个自定义按钮,如果不是全部的话,我的项目中的大多数ViewController都需要这些按钮。我目前采用的方法是在我的所有Controller中使用Storyboard构建它们,然后根据需要添加功能。然而,我发现这会导致痛苦的情况,即使我想做某事,比如改变高度,我也需要做8次。所以我的想法是,拥有3个uibutton子类(具有不同状态下的图像、宽度、高度、位置等所需的特征),然后我可以将它们添加到我的不同ViewController中,然后在需要时从它们执行segues

iOS UIButton 点击​​不起作用

我对iOSUIButton以编程方式处理点击有问题。我有一个UIButton:-(UIButton*)compareButton{if(!_compareButton){NSString*title=TITLE;NSDictionary*attributes=TITLE_ATTRIBUTES;NSAttributedString*attributedTitle=[[NSAttributedStringalloc]initWithString:titleattributes:attributes];_compareButton=[[UIButtonalloc]initWithFrame:

ios - 多次点击 UIButton 多次触发 Target 函数

我有一个UIButton。我绑定(bind)了一个目标如下。[buttonaddTarget:selfaction:@selector(myFunction)forControlEvents:UIControlEventTouchUpInside];当我快速多次单击我的按钮时,它会多次调用目标函数。在点击按钮上,我展示了一个新的ViewController。当我快速单击3次时,我的新ViewController将显示3次。这是愚蠢的事情。一旦View已转移到新的ViewController,再次触发该功能有什么意义。为什么hell苹果会做出如此愚蠢的事情?有什么帮助吗?

ios - 在已经有 png 图像的 UIButton 中画线

我知道有很多关于在View中绘制的问题/答案,但这是一种特殊情况,因为它结合了多种功能。我正在使用UIButton它有一个自定义类型它有一个png图像所以我需要保留所有这些,但另外,我需要沿着底部边缘画一条线(可能插入几个点),如下图所示。这是应用线之前这是应用线之后这是其中一个按钮的规范 最佳答案 如果你想在xib上画这个,你必须自定义你的按钮。@interfaceDrawLineButton()@property(nonatomic,strong)IBInspectableUIColor*fillColor;@property(

ios - 选择 UITableViewCell 时,UIButton 被覆盖

我在我的UITableViewCell中使用了一个UIButton,这个按钮可以被选中,金色星形,未被选中,灰色星形,如下所示。问题是,当单元格被选中时,无论按钮是否被选中,它都会变成灰色(这种灰色不同于星号未选中模式的灰色)。我一直在努力弄清楚为什么会发生这种情况,但没有成功。这里是单元格的实现,-(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndexPath*)indexPath{UITableViewCell*cell=[[UITableViewCellalloc]init

objective-c - Xcode 4 UIButton segue 推送到 TableView Controller

现在我的Storyboard中有一个UIButton设置,它推送到一个TableViewController。这按预期工作。我想要做的是让UIButton在按下时加载一个xml文件并仍然移动到TableViewController上。我该怎么做?我已经有了XML片段的代码,问题是代码的去向以及我如何为新的ViewController子类UIViewController添加.h和.m文件。如何将这些文件链接到我在Storyboard中创建的UIButton? 最佳答案 将您的按钮连接拖到新View并选择自定义Segue而不是Push或

ios - 如何更改 UIButton : The signup button in Parse`s PFLoginViewController 的颜色

如何更改ParsesPFLoginViewController`中注册按钮的(背景)颜色?我试过:PFLogInViewController*logInViewController=[[PFLogInViewControlleralloc]init];logInViewController.fields=PFLogInFieldsUsernameAndPassword|PFLogInFieldsLogInButton|PFLogInFieldsPasswordForgotten|PFLogInFieldsSignUpButton;logInViewController.logInVie

ios - 带有 UIControl/UIButton subview 的 ScrollView/TableView 在 iOS 8 下不可滚动

我有一个UIScrollView实例(scrollview),还有许多UIControl实例作为subview位于ScrollView上。在iOS8之前一切正常,但scrollview现在在iOS8下不可滚动。似乎UIControl实例吃掉了触摸事件,scrollview的delaysContentTouches在iOS8下被破坏了。刚发现UITableView也有这个问题。 最佳答案 搜索了一段时间,解决了这个问题scrollview.panGestureRecognizer.delaysTouchesBegan=YES;还有另一

ios - 我如何为 UIButton iOS 创建脉动动画?

我正在尝试为UIButton创建脉动动画到目前为止,这些是我的代码,但仍然无法执行此链接中显示的确切动画CSSpulsatingbutton我的代码UIButton*button=[UIButtonbuttonWithType:UIButtonTypeRoundedRect];button.backgroundColor=[UIColorlightGrayColor];[buttonsetTitleColor:[UIColorwhiteColor]forState:UIControlStateNormal];[buttonaddTarget:selfaction:@selector(m