草庐IT

argument-passing

全部标签

ios swift : Passing data from tableView to view controller

enterimagedescriptionhere好吧,这是我第一次发布问题,所以不确定它是如何工作的。我正在swift上做作业。我被困在需要将数据从tableview传递到viewcontroller的地方。在我的第一个ViewController上,我有一个来自数据库表的数据列表(类别),当用户单击任何单元格时,它应该转到下一个viewcontroller,标签成为标题。请找到我的屏幕截图。谢谢functableView(tableView:UITableView,numberOfRowsInSectionsection:Int)->Int{returnvalues.count;}

swift - Mixpanel初始化错误: argument passed to call that takes no arguments

我有一个非常简单的问题,希望有一个非常简单的解决方案。Mixpanel的官方文档说要在'didFinishLaunchingWithOptions'中初始化:Mixpanel.initialize(token:"MIXPANEL_TOKEN")当我把它和我的token放在一起时,我得到这个错误:“传递给不带参数的调用的参数”funcapplication(_application:UIApplication,didFinishLaunchingWithOptionslaunchOptions:[UIApplicationLaunchOptionsKey:Any]?)->Bool{Mix

swift 2 : Cannot convert value of type '[NSObject : AnyObject]' to expected argument type '[String : AnyObject]'

我有一个用Swift1构建的项目。但是在自动转换为Swift2后,它显示错误:无法将类型'[NSObject:AnyObject]'的值转换为预期的参数类型'[String:AnyObject]'。函数代码:funccreateViewContainers()->NSDictionary{varcontainersDict=NSMutableDictionary()letitemsCount:Int=tabBar.items!.countasInt-1forindexin0...itemsCount{varviewContainer=createViewContainer()conta

ios - NSURL "missing argument for parameter in call" swift

我同时使用obj-c和swift类。在一个swift类(class)中,我尝试将objectivec代码转换为swift。但是,我对NSURL有疑问。原代码为:NSURL*url=[NSURLURLWithString:[NSStringstringWithFormat:@"%@://",appItem.URLSchema]];URLSchema在头文件中声明如下:@property(nonatomic,copy)NSString*URLSchema;我将上面的objective-c代码转换为swift:varurl:NSURL=NSURL(string:"%@://",relativ

深度剖析问题:Could not run ‘torchvision::nms‘ with arguments from the ‘CUDA‘ backend.

问题:使用YOLOv5进行测试的时候,报错:Couldnotrun'torchvision::nms'withargumentsfromthe'CUDA'backend.(如下图所示) 解决方法:(1)按照网上绝大多数的做法,重新安装torch和torchvision,我的另外一篇博客有讲解,注意CUDA、torch、torchvision和其他可能的安装包的版本要对应,链接直达:https://blog.csdn.net/qq_54185421/article/details/124759003?spm=1001.2014.3001.5501https://blog.csdn.net/qq_

swift - Metal/Metal 2 + swift : How to pass complex Swift structure as shader argument?

我在Metal中有一个结构:structBlurDesc{shortfenceRows;shortoffs;shortsampleCnt;floatmuls[64];};它用作着色器参数:kernelvoidhBlurCompute(constantBlurDesc&blurDesc[[buffer(0)]],texture2dsrcTexture[[texture(0)]],texture2dhBlurTexture[[texture(1)]],ushortgid[[thread_position_in_grid]]){这是相应的Swift结构:structBlurDesc{varf

ios - MKPolygon 初始化错误 "Missing argument for parameter ' interiorPolygons' in call"/"Extra argument in call"

我正在尝试转换MapKitMKPolygon中的Objective-C代码,引用Listing6-9进入swift。当我调用函数时init(coordinates:count:)初始化函数,我得到错误:Missingargumentforparameter'interiorPolygons'incall当我使用interiorPolygons参数调用该函数时,出现错误:Extraargumentincall这是我正在使用的代码。varpoints:[CLLocationCoordinate2D]=[CLLocationCoordinate2D]()points[0]=CLLocatio

Swift:更新并出现错误: "cannot invoke '! =' with argument list of type.."

在Xcodebeta5中一切都很好,但现在在成熟的Xcode中,我的AppDelegate中出现了2个类似的错误:“无法使用类型为‘(NSManagedObjectContext,NilLiteralConvertible’)的参数列表调用‘!=’”“无法使用类型为‘(NSPersistentStoreCoordinator,NilLiteralConvertible’)的参数列表调用‘!=’”我尝试将!=替换为!==,但出现了不同的错误。我不明白!=有什么问题。代码:funcsaveContext(){varerror:NSError?=nilletmanagedObjectCont

swift - (lldb) 错误 : anonymous closure argument not contained in a closure

类似于Anonymousclosureargumentnotcontainedinaclosure但lldb相关tableViews.forEach{$0.dataSource=self$0.delegate=self$0.estimatedRowHeight=30^^^^^^^^^^^^^^breakpointishere}尝试调试(lldb)p$0.delegateerror::3:1:error:anonymousclosureargumentnotcontainedinaclosure$0.delegate(lldb)po$0.delegateerror::3:1:error:

ios - Realm iOS : Cannot Convert value of type 'Dogs.Type' to expected argument type 'T.Type'

这是我的DBManager.swiftimportRealmSwiftclassDBManager{classfuncgetAllDogs()->[Dog]{letrealm=try!Realm()//COMPILERERROR:CannotConvertvalueoftype'Dogs.Type'toexpectedargumenttype'T.Type'returnrealm.objects(Dog.self)}}这是我的Dog.swift:importFoundationimportRealmSwiftclassDog:Object{dynamicvarfirstName=""d