草庐IT

addtarget

全部标签

ios - 具有 swift 3 和本地功能的 UIButton.addTarget

我正在尝试以编程方式生成多个按钮。目前,这是我所拥有的:foriinPOIArray{letnewI=i.replacingOccurrences(of:"GPS30",with:"")letbutton=UIButton(type:.custom)button.setImage(UIImage(named:newI),for:.normal)button.frame.size.height=30button.frame.size.width=30button.addTarget(self,action:#selector(buttonAction(texte:newI)),for:U

iphone - 如何在按钮 addTarget 方法上将 NSString 值从一种方法传递到另一种方法?

如何使用UIButtonaddTarget将NSString对象作为参数传递给另一个方法:这是我的代码:-(void)vision:(PBJVision*)visioncapturedVideo:(NSDictionary*)videoDicterror:(NSError*)error{_recording=NO;if(error){NSLog(@"encountedanerrorinvideocapture(%@)",error);return;}_currentVideo=videoDict;NSString*videoPath=[_currentVideoobjectForKey

objective-c - ios 中的 UIButton AddTarget(不工作-崩溃)

我已经以编程方式创建了UIButton,它被添加到也是以编程方式创建的UIViewController中。我不知道要传递什么作为AddTarget。我目前已经在addtarget中传递了optionView.selfUIWindow*window1=[[UIApplicationsharedApplication]keyWindow];optionView=[[UIViewControlleralloc]init];optionView.view.frame=CGRectMake(0,0,960,640);UIButton*button=[UIButtonbuttonWithType:

ios - GPUImageAlphaBlendFilter实时处理来自GPUImageStillCamera源码

我正在使用GPUImage库,我正在尝试实时混合两个图像,并将它们显示在GPUImageView上。我正在尝试将普通相机输入与其过滤版本进行alpha混合。这是我正在尝试做的事情:----------------->----v--camera--|alphablend---->imageview----->colorfilter--^我找到了一些关于使用混合过滤器的帖子,但它们似乎不是实时处理的方法。我找到了https://github.com/BradLarson/GPUImage/issues/319,GPUImage:blendingtwoimages,和https://gith

ios - GPUImage 在另一个 View 中显示直方图

我目前正在尝试使用GPUImage显示直方图。我目前有以下代码:GPUImageOutput*filter=[[GPUImageHistogramFilteralloc]initWithHistogramType:kGPUImageHistogramLuminance];[self.stillCameraremoveTarget:filter];GPUImageGammaFilter*gammaFilter=[[GPUImageGammaFilteralloc]init];[self.stillCameraaddTarget:gammaFilter];[gammaFilteraddTa

ios - UIButton addTarget 的替代选项 :action:forControlEvents: method in IOS

我知道这个问题已被问过很多次,但我想在单击按钮时将自定义对象作为参数传递。UIButtonaddTarget:action:forControlEvents:不允许我们这样做,但这对我来说很重要,因此我可以在自定义对象的基础上做更多的事情。如果添加目标的替代方案是可能的,那么请给出解决方案。代码是这样的:自定义对象:HeaderData*cell;按钮:_forward=[UIButtonbuttonWithType:UIButtonTypeRoundedRect];[_forwardsetTitle:@"F"forState:UIControlStateNormal];_forwar

objective-c - addTarget :action:forControlEvents - UISwitch in TableView - sender ok, 事件始终为 0x0

利用这个论坛中的精彩帖子,我在tableView中创建了一个开关作为accessoryView。当触摸开关时,我的Action(switchChanged)被调用。只有发送方有有效值,事件为0x0。将目标添加到switchView:[switchViewaddTarget:selfaction:@selector(switchChanged:forEvent:)forControlEvents:(UIControlEventValueChanged|UIControlEventTouchDragInside)];行动:-(void)switchChanged:(id)senderfor

iphone - 在 iOS 上,有没有办法将方法 addTarget 添加到 UIImageView?

我刚刚发现UIButton对象有一个方法addTarget来处理UI事件,但是UIImageView对象没有这样的方法方法,因此我们不能在代码中执行此操作,也不能使用InterfaceBuilder为UIImageView对象添加这样的操作。可以使用手势识别器,但是有没有一种简单的方法可以将addTarget添加到UIImageView中,这样我们的代码就不会部分由手势识别器处理,而部分由处理>addTarget方法? 最佳答案 添加一个调用与按钮调用相同的选择器的手势识别器应该不会太麻烦:UIButton*button=[[UIB

iphone - 使用 GPUImage,我如何将图像分成 4 份并对所有 4 个角应用不同的过滤器并重新组合?

我想要类似于GPULogo的东西,每个角都有不同的滤镜。到目前为止,我已经设法实现了这一点,但图像大小是原始图像的一半。这是我的代码的简化:_cropTopLeft=[[GPUImageCropFilteralloc]initWithCropRegion:CGRectMake(0.0,0.0,0.5,0.5)];CGAffineTransformtopLeftTransform=CGAffineTransformMakeTranslation(-1,-1);topLeftTransform=CGAffineTransformScale(topLeftTransform,0.5,0.5)

ios - UITapGestureRecognizer 和 addTarget 之间的区别

谁能阐明这两种在点击View时触发功能的方式之间的区别?1)myView.addTarget(self,action:#selector(myFunctionToTrigger(_:)),forControlEvents:UIControlEvents.TouchUpInside)2)让tapGesture=UITapGestureRecognizer(目标:self,Action:#selector(myFunctionToTrigger(_:)))myView.addGestureRecognizer(tapGesture) 最佳答案