草庐IT

fisrt_value

全部标签

ios - swift 3 : How to access the value of matrix_float3x3 in a 48-byte CFData?

我正在尝试访问此answer之后的内在矩阵.通过运行下面的指令,我能够得到一个48字节的AnyObject。,我进一步将其转换为CFData.letcamData=CMGetAttachment(sampleBuffer,kCMSampleBufferAttachmentKey_CameraIntrinsicMatrix,nil)但是,我检查了CMSampleBuffer.h中sampleBuffer的输出:/*!@constantkCMSampleBufferAttachmentKey_CameraIntrinsicMatrix@abstractIndicatesthe3x3came

swift - 无法使用类型为 (Int, @value Int) 的参数列表调用 "+="

我有一个Transaction类,它有一个类型为Int的varamount。我想从另一个类访问它,我有一个交易数组并对它们的所有金额求和。所以我有这段代码funccomputeTotal()->Int{lettotal=0fortransactionintransactions{//gettheamountsofeachandsumallofthemuptotal+=transaction.amount}returntotal}但它给了我一个错误无法使用类型为(Int,@valueInt)的参数列表调用“+=”是什么原因造成的?我知道在Swift中两个操作数必须是同一类型,但在我的代码

ios - 为什么我会收到此错误 : Result values in '? :' expression have mismatching types '[String]?' and 'String'

所以我是swift的新手,我正在尝试使用谷歌地图。我无法弄清楚为什么这条线有效:让state=p?.administrativeArea!=nil?p?.administrativeArea:"nil6"但不是这一行:让areaOfInterest=p?.areasOfInterest!=nil?p?.areasOfInterest:"nil7"我在areaOfInterest行收到此错误消息:'?中的结果值:'表达式有不匹配的类型'[String]?'和“字符串”提前致谢。CLGeocoder().reverseGeocodeLocation(userLocation){(place

ios - Swift 编译器 : cannot subscript a value of type '[NSObject]' with an index of type '()'

关闭。这个问题是notreproducibleorwascausedbytypos.它目前不接受答案。这个问题是由于错别字或无法再重现的问题引起的。虽然类似的问题可能是on-topic在这里,这个问题的解决方式不太可能帮助future的读者。关闭7年前。Improvethisquestion场景:第1步:第2步:第3步:问题总结:我开始使用swift及其基本概念。首先,我尝试用多个不同类型的元素制作一个数组ab(不确定它是否应该被称为数组)。然后我尝试测试一个索引值ab[2]。成功测试索引值后,我制作了一个字典dictAbc,其中我使用不同的索引ab[4]ab[6]指向到它的键。它引入

ios - Swift 2.2 语法错误 : Cannot call value of non-function type 'UITableView!'

我在UITableView单元格中使用Tab手势,但出现以下错误。“无法调用非函数类型‘UITableView!’的值!”我正在使用从我以前的ObjectiveC项目继承的以下代码:varp:CGPoint=sender.locationInView(self.tableView)varindexPath:NSIndexPath=self.tableView(forRowAtPoint:p)varbuttonTag:Int=indexPath.rowvarselectView=self.storyboard?.instantiateViewControllerWithIdentifie

ios - swift 3.0 : Value of type 'IndexSet' has no member 'enumerateIndexesUsingBlock'

接收“IndexSet”类型的值在enumerateIndexesUsingBlock处没有成员“enumerateIndexesUsingBlock”错误。/**Extensionforcreatingindexpathsfromanindexset*/extensionIndexSet{/**-parametersection:ThesectionforthecreatedNSIndexPaths-return:AnarraywithNSIndexPaths*/funcbs_indexPathsForSection(_section:Int)->[IndexPath]{varind

ios - 你如何使用 perform(#selector(setter :)) to set the value of a property using swift 4?

我正在尝试运行这段代码,但它产生了意想不到的结果。classTest:NSObject{@objcvarproperty:Int=0}vart=Test()t.perform(#selector(setter:Test.property),with:100)print(t.property)正在打印的值是一些垃圾号码-5764607523034233277。如何使用perform方法设置属性的值? 最佳答案 performSelector:withObject:方法需要一个对象参数,因此Swift将基本类型100转换为对象引用。se

ios - fatal error : unexpectedly found nil while unwrapping an Optional value (lldb)

overridefuncprepareForSegue(segue:UIStoryboardSegue,sender:AnyObject!){ifsegue.identifier=="showLocalMenuDetail"{ifletindexPath=self.tableView.indexPathForSelectedRow(){self.slideMenuController()?.closeLeft()letdestinationController=segue.destinationViewControllerasDetailViewControllerdestinatio

arrays - 选择要附加到三元运算符 'if' 运算符 : "Immutable value... only has mutating members" 的数组

我有两个数组:varaddedToIgnoreList:[String]=[]varremovedFromIgnoreList:[String]=[]我想将一个值附加到这些数组之一。如果我这样做:(isUserIgnored?removedFromIgnoreList:addedToIgnoreList).append("username")我得到Immutablevalueoftype'[String]'onlyhasmutatingmembersnamed'append'如果我使用中间变量,它会起作用:varwhich=isUserIgnored?removedFromIgnore

ios - 准备 segue : Cannot convert value of type 'UIViewController' to specified type 'SecondViewController'

我知道我肯定在这里遗漏了一些明显的东西,但我似乎无法通过它的实际类型来引用目标ViewController。我按照以下步骤从头开始创建了一个新项目来对此进行测试:创建一个新的单View应用程序项目添加一个新的ViewController创建一个新类,子类化UIViewController,并将其命名为SecondViewController将这个新类设置为第二个ViewController的自定义类(现在它的标题是第二个ViewController)向第一个ViewController添加一个按钮,然后按住Ctrl键单击它到第二个ViewController,然后从ActionSegu