草庐IT

action-items

全部标签

swift - Action 的多个参数/参数 - Swift

我发现了一个与我最相似的问题,但没有得到彻底的回答。如果有人能帮助我,那就太好了。我发现类似问题的地方是here.我很清楚functest()是"test"而test(object:AnyObject)是"测试:"。感谢this.那么2个参数呢?swift不能为“action:”做2个参数吗?funcpopoverSelectedCode(code:AnyObject,desc:AnyObject)我尝试通过以下几种不同的方式对其进行测试,但无济于事:action:"popoverSelectedCode:,"action:"popoverSelectedCode:,:"action:

ios - 当用户快速点击一个单元格时触发一个 Action

我正在使用Swift创建一个应用程序。我有一个UITableView,我用数据库中的一些数据填充了它。当用户点击一个单元格时,我想触发一个Action。我做了什么:vararray:[String]=["example"]functableView(tableView:UITableView,numberOfRowsInSectionsection:Int)->Int{returnarray.count}functableView(tableView:UITableView,cellForRowAtIndexPathindexPath:NSIndexPath)->UITableView

ios - 当用户快速点击一个单元格时触发一个 Action

我正在使用Swift创建一个应用程序。我有一个UITableView,我用数据库中的一些数据填充了它。当用户点击一个单元格时,我想触发一个Action。我做了什么:vararray:[String]=["example"]functableView(tableView:UITableView,numberOfRowsInSectionsection:Int)->Int{returnarray.count}functableView(tableView:UITableView,cellForRowAtIndexPathindexPath:NSIndexPath)->UITableView

ios - 选择器与 Action Swift 4

Swift新手。我在下面有两个片段:NotificationCenter.default.addObserver(self,selector:#selector(ViewController.notificationReceived),name:Notification.Name(rawValue:name),object:nil)@objcfuncnotificationReceived(notification:Notification){letx=notification.userInfo!print("\(x["name"]!)")}最后letx:UITapGestureRec

ios - 选择器与 Action Swift 4

Swift新手。我在下面有两个片段:NotificationCenter.default.addObserver(self,selector:#selector(ViewController.notificationReceived),name:Notification.Name(rawValue:name),object:nil)@objcfuncnotificationReceived(notification:Notification){letx=notification.userInfo!print("\(x["name"]!)")}最后letx:UITapGestureRec

带有 pickerView 按钮 Action 的快速 UIAlertController 熬夜

我是swift的新手,我正在尝试使用PickerView制作UIAlertContoller但我的按钮有问题,这里有照片我正在尝试更改按钮的约束以保持向上。我在这里阅读了很多答案,但我没有找到任何解决方案这是我的代码:funcdistance(){leteditRadiusAlert=UIAlertController(title:"Choosedistance",message:"",preferredStyle:UIAlertControllerStyle.alert)letpickeViewFrame:CGRect=CGRect(x:0,y:0,width:250,height:

带有 pickerView 按钮 Action 的快速 UIAlertController 熬夜

我是swift的新手,我正在尝试使用PickerView制作UIAlertContoller但我的按钮有问题,这里有照片我正在尝试更改按钮的约束以保持向上。我在这里阅读了很多答案,但我没有找到任何解决方案这是我的代码:funcdistance(){leteditRadiusAlert=UIAlertController(title:"Choosedistance",message:"",preferredStyle:UIAlertControllerStyle.alert)letpickeViewFrame:CGRect=CGRect(x:0,y:0,width:250,height:

ios - 代码 : sharing content via Action Sheet

我想复制这种行为(见下图)并使用这种操作表分享我的应用中的内容。问题是:这真的是行动表吗?我在任何地方都找不到适用于iOS7或8的教程。不确定如何继续。共享选项是否取决于用户的配置?将不胜感激。 最佳答案 它不在UIActionSheet中,它在UIActivityController中,这是iOS中的默认函数。objective-C-(void)presentActivityController:(UIActivityViewController*)controller{//foriPad:makethepresentationa

ios - 代码 : sharing content via Action Sheet

我想复制这种行为(见下图)并使用这种操作表分享我的应用中的内容。问题是:这真的是行动表吗?我在任何地方都找不到适用于iOS7或8的教程。不确定如何继续。共享选项是否取决于用户的配置?将不胜感激。 最佳答案 它不在UIActionSheet中,它在UIActivityController中,这是iOS中的默认函数。objective-C-(void)presentActivityController:(UIActivityViewController*)controller{//foriPad:makethepresentationa

ios - 将 UIButton 连接到关闭? (快速,目标 Action )

我想将UIButton连接到一段代码——根据我的发现,在Swift中执行此操作的首选方法仍然是使用addTarget(target:AnyObject?,action:Selector,forControlEvents:UIControlEvents)函数。这使用Selector构造大概是为了向后兼容Obj-C库。我想我理解在Obj-C中使用@selector的原因——能够引用一个方法,因为在Obj-C中方法不是一流的值。不过在Swift中,函数是一等值。有没有办法将UIButton连接到闭包,类似于此://--SomecodeherethatsetsupanobjectXletbut