草庐IT

UIBUTTON

全部标签

ios - CGAffineTransformMakeScale animation on a cornerRadius rounded UIButton

我正在舍入一个UIBUtton,这很好(self是一个uibutton子类):self.layer.cornerRadius=self.frame.size.width/2;self.layer.masksToBounds=YES;self.clipsToBounds=YES;但我也在尝试为按钮设置动画以缩小比例然后返回到原始大小,如下所示:[UIViewanimateWithDuration:0.1delay:0.0options:UIViewAnimationOptionCurveEaseInOutanimations:^{self.layer.affineTransform=CG

c# - Xamarin iOS UIButton 如何以编程方式单击按钮?

我试图通过在我的ViewWillAppear()函数中以编程方式调用它来伪造单击按钮的行为。onclick函数在我的ViewDidLoad()中定义,您可以看到我正在尝试使用PerformSelector手动调用按钮。按钮似乎没有运行。有什么想法吗?publicoverridevoidViewDidLoad(){base.ViewDidLoad();idButtonScanLoad.TouchUpInside+=async(sender,ea)=>{System.Console.WriteLine("Scanbuttonpressed");};}[Export("TouchUpInsi

ios - UITableViewCell 中的 UIButton(在 UIView 内)单击事件不起作用

上图是UITableViewCell设计器预览图。Button(Refer1)touchupinside事件工作正常。但是,Button(Refer2)touchupinside事件没有触发。它在一个View中。我禁用了Button(引用2)View的UserInteractionEnabled属性。但是,运气不好。不工作。 最佳答案 您的View高度为0,这就是您无法点击它的原因为了测试它,将clips的绑定(bind)值设置为yes你还需要为你的View设置高度来解决这个问题 关于i

ios - 如何在 Interface Builder 中使用自定义 UIButton?

我有一个加载Nib的UIButton子类:@implementationBlaButtonVC-(id)initWithFrame:(CGRect)frame{self=[superinitWithFrame:frame];if(self){NSArray*subViews=[[NSBundlemainBundle]loadNibNamed:@"BlaButton"owner:selfoptions:nil];[selfaddSubview:subViews[0]];}returnself;}@end我可以将此按钮添加到View中,如下所示://ViewController.mBlaB

ios - 向 UIButton 添加 subview

我正在尝试将customBadge添加为UIButton的subview-到目前为止,这是我的代码-//msgcountinitiaition//CustomBadge*customBadge1=[CustomBadgecustomBadgeWithString:@"2"];CustomBadge*customBadge1=[CustomBadgecustomBadgeWithString:@"2"withStringColor:[UIColorwhiteColor]withInsetColor:[UIColorredColor]withBadgeFrame:YESwithBadgeF

ios - 将 UIButton 添加为 UIWebView 的 subview 并在缩放时调整其大小

我在.svg中有世界地图的图像,我将其加载到UIWebView中。(我使用了svg格式和UIWebView,因为图片太大无法加载到UIImageView)我想在这张map上固定位置放置一堆Pin。例如,如果我在巴西放置一个图钉,则无论我滚动还是缩放UIWebView,该图钉都必须始终位于巴西如何做到这一点?现在滚动不是问题,只是缩放NSString*path=[[NSBundlemainBundle]pathForResource:@"map"ofType:@"svg"];NSURL*url=[[NSURLalloc]initFileURLWithPath:path];NSURLReq

ios - Objective-C - UIButton 保持高亮/选中状态,背景颜色和字体颜色在高亮/选中时发生变化

我使用界面构建器为不同的时间段创建了以下UIButton和为Search创建了一个UIButton。我希望不同时间段的UIButton在用户点击它时保持选中/突出显示。背景颜色和字体颜色也会发生变化(参见图片说明)。此外,用户一次只能选择其中一个时间段。UIButton不同时隙我想要实现的按钮代码#import"Search.h"#import@interfaceSearch(){}@end@implementationSearch@synthesizebtn1;@synthesizebtn2;@synthesizebtn3;@synthesizebtn4;@synthesizebtn

iphone - UIButton 选择颜色

这个问题在这里已经有了答案:IsitpossibletochangeaUIButtonsbackgroundcolor?(17个答案)关闭8年前。我正在绘制自定义UIButton并希望在突出显示时设置蓝色。我怎样才能做到这一点?UIButton*myButton=[UIButtonbuttonWithType:UIButtonTypeCustom];[myButtonsetBackgroundImage:[[UIImageimageNamed:@"test.png"]stretchableImageWithLeftCapWidth:100topCapHeight:0]forState:

iphone - 具有固定大小自定义图像的 UIButton

我有一个自定义的UIButton,如下所示:UIButton*action=[UIButtonbuttonWithType:UIButtonTypeCustom];[actionsetSize:CGSizeMake(30,30)];[actionsetBackgroundImage:[UIImageimageNamed:@"contextaction.png"]forState:UIControlStateNormal];[actionsetContentMode:UIViewContentModeCenter];[actionaddTarget:selfaction:@selecto

iOS UIButton Touch Drag Enter 没有按预期工作?

我正在尝试创建一个按钮,当用户触摸按钮的任何位置时(无论是在按钮内部触碰,还是从按钮外部拖到按钮内部),该按钮都会触发一个Action。本质上,我需要创建一种方法来在手指位于按钮内部时触发操作。“Touchdragenter”与“touchdowninside”相结合听起来可以完成这项工作,但它的工作方式似乎与我需要的不同。此外,如果它可以在Storyboard中完成而不是硬代码(如touchesBegan/moved),我更愿意,但如果没有其他方法也没关系。 最佳答案 Touchdragenter只会被调用,当你在控件内开始触摸并