草庐IT

DISPID_VALUE

全部标签

swift - Firebase Value 和 ChildAdded(需要进一步解释)

我一遍又一遍地阅读了Firebase文档,只是需要一些说明。这不是关于我的具体代码,而是关于我对Firebase的一般理解。我知道.Value每次调用时都会检索所有数据,并继续监视数据库的变化。.ChildAdded查找引用的子项中的更改。.ChildAdded最初是否也检索所有值?我应该为同一路径同时实现.Value和.ChildAdded吗?如果不是,当我尝试执行.ChildAdded时,什么也没有显示,但是当我运行.Value时,我的所有项目都会按预期显示。我不希望每次更改或添加单个值时都从数据库中重新获取每个值,因为当我有数千个项目要获取时,这似乎会导致一些带宽问题。最好的工作

ios - UIDevice.current.setValue(value, forKey : "orientation") does not work if phone held in landscape and tilted 45 - 90 degrees

我在用letvalue=UIInterfaceOrientation.landscapeRight.rawValueUIDevice.current.setValue(value,forKey:"orientation")强制呈现ViewController以横向显示。这是导航Controller流程的一部分。这按预期工作,但如果手机横向放置并倾斜45到90度,View将以纵向显示。该方法被调用并且预期值是正确的,但景观没有发生变化。这可以在带有导航Controller的基本项目中重现。有谁知道是什么导致了这种行为? 最佳答案 我也

ios - 以编程方式将自定义 UIViewcontroller 添加到 subview 但收到错误消息 "Cannot convert value of type..."

我正在尝试在Swift中以编程方式将自定义UIViewController类(UIPickerView)添加到我的主ViewController(不使用Storyboard)但我收到以下错误消息..."Cannotconvertvalueoftype'HabitViewViewController'toexpectedargumenttype'UIView'自定义UIPicker类:importUIKitclassHabitViewController:UIViewController,UIPickerViewDataSource,UIPickerViewDelegate{@IBOut

swift - 无法推断通用参数 'Value' 在 swift 中创建基于 block 的 KVO

输入这个(人为的例子)代码importFoundationprotocolValueProviderProtocol{varamount:Int{get}}classValueProvider:NSObject,ValueProviderProtocol{@objcdynamicvaramount=0}let_provider=ValueProvider()varprovider:ValueProviderProtocol{return_provider}letsubject=provideras!NSObjectletobserver=subject.observe(\ValuePr

swift - "Cannot call value of non-function type"

我刚刚下载了Xcode8Beta,以便可以在我的应用程序中包含一些新的iOS10框架。然而,在将我的代码从Swift2转换为Swift3的过程中,我遇到了几个错误。除了一个super烦人的,我都修好了。我收到错误:Cannotcallvalueofnon-functiontype'JSQMessagesCollectionView!'atthefollowinglineofcode:letcell=super.collectionView(collectionView,cellForItemAtIndexPath:indexPath)as!JSQMessagesCollectionVi

iphone - 为什么在将 Float 转换为 CGFloat 时 Xcode 给我一个警告 "Cannot convert value of type ' CGFloat' to expected argument type 'UnsafeMutablePointer"?

我正在尝试将Float值转换为CGFloat值,这里是我的代码:letmyFloatForR=0letr=CGFloat(myFloatForR)letmyFloatForG=0letg=CGFloat(myFloatForG)letmyFloatForB=0letb=CGFloat(myFloatForB)letmyFloatForA=0leta=CGFloat(myFloatForA)tintColor.getRed(r,green:&g,blue:&b,alpha:&a)但Xcode突然给我一个警告说:“无法将类型'CGFloat'的值转换为“tintColor”行上的预期参数类

ios - Swift 中的 NSDictionary :Cannot subscript a value of type 'AnyObject?' with a index of type 'Int'

所以我正在尝试使用swift解析JSON中的一些数据。下面是我的代码varjsonResult:NSDictionary!=NSJSONSerialization.JSONObjectWithData(data,options:NSJSONReadingOptions.MutableContainers,error:nil)as!NSDictionaryprintln(jsonResult)上面的代码会返回这样的东西{count=100subjects=({alt="....."name="....."},{alt="....."name="....."},......)}然后我尝试使

swift - 在 OSX : class is not key value coding-compliant for the key {name of binding var} 中绑定(bind)

我试图按照B.A.LearningSwift书(创建笔记应用程序)中的说明进行操作。Paris&Co,但面临以下绑定(bind)问题。我主要练习iOS编程,所以绑定(bind)概念对我来说是新的。我执行的步骤(尝试了xcode9beta5和8.3.3):创建OSXCocoa应用程序(不使用Storyboard,基于文档的应用程序,文档扩展名“测试”,不要使用核心数据)将“vartext=NSAttributedString()”添加到Document.swift将NSTextView添加到Document.xib在NSTextView的绑定(bind)检查器中,将“属性字符串”设置为文

swift - 如何修复 'can not use mutating member on immutable value' ?

关闭。这个问题需要debuggingdetails.它目前不接受答案。编辑问题以包含desiredbehavior,aspecificproblemorerror,andtheshortestcodenecessarytoreproducetheproblem.这将有助于其他人回答问题。关闭5年前。Improvethisquestion获取错误:Error:cannotusemutatingmemberonimmutablevalue:'fromArray'isa'let'constant在下面的代码中:funcremoving(item:Int,fromArray:[Int])->[

swift 字典 : join key and value into string

我正在为此寻找最佳语法:letresponseParameters=["keyA":"valueA","keyB":"valueB"]varresponseString=""for(key,value)inresponseParameters{responseString+="\(key):\(value)"ifArray(responseParameters.keys).last!=key{responseString+="+"}}//responseString:keyA:valueA+keyB:valueB类似于数组joinWithSeparator,使用flatMap或类似的东