草庐IT

converted

全部标签

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”行上的预期参数类

string - '(NSObject, AnyObject )' is not convertible to ' 字符串'

如何将(NSObject,AnyObject)类型的对象转换为String类型?在下面方法的第一行末尾,asString导致编译错误:'(NSObject,AnyObject)'isnotconvertibleto'String'将street转换为NSString而不是String编译,但我正在将street转换为String因为我想将它与placemark.name进行比较,后者的类型为String!,而不是NSString。我知道name和street是可选的,但我假设它们现在不是nil因为所有的地方都从MKLocalSearch似乎有非零名称和街道。funcformatPlac

ios - swift : How to convert String to string with time format?

我的字符串值包括时间,格式为"HH:mm"(16:50)我必须将此值转换为"hh:mm"格式(04:50)作为SWIFT中的字符串我试过NSDateFormatter之类的lettimeFormat=NSDateFormatter()timeFormat.dateFormat="hh:mm"vardateFromStr=timeFormat.dateFromString("16:50")varstrFromDate=timeFormat.stringFromDate(dateFromStr)但它不起作用..请告诉任何解决方案。 最佳答案

ios - swift 2 : "Bool' is not convertible to 'BooleanLiteralConvertible'

我在XCode6中创建了一个应用程序。今天我下载了XCode7并将我的应用更新为Swift2。有很多错误,但现在只有一个我无法解决。我不知道为什么,但是Xcode不喜欢animated的任何Bool选项并显示此错误-'Bool'isnotconvertibleto'BooleanLiteralConvertible'(如果你看一下函数本身,你会发现,它恰好采用了animated的Bool)varstartVC=self.viewControllerAtIndex(indexImage)asContentViewControllervarviewControllers=NSArray(o

swift - 错误 : Bool is not Convertible to Void:

我正在从Obj移动我的代码。C到SwiftC并尝试实现Twittersdk..但是,我收到一个错误...任何人都可以告诉我我做错了什么。请帮我解决这个问题。我花了2天的时间尝试了所有方法,但都不适合我。 最佳答案 您的代码块没有返回语句,因此编译器使用最后一条语句的结果UIApplication.sharedApplication().openURL(url)作为返回值,它是一个Bool而不是block签名中声明的Void。要解决这个问题,只需添加一个return语句:{(url:NSURL,oauthToken:String)->

ios - 转换为 Swift 3 错误 : "Convert to Current Swift Syntax Failed Could not find test host for..."

当我尝试运行在升级到Xcode8之前完美运行的项目时,我不断收到错误“UseLegacySwiftLanguageVersion”(SWIFT_VERSION)isrequiredtobeconfiguredcorrectlyfortargetswhichuseSwift.Usethe[Edit>Convert>ToCurrentSwiftSyntax…]menutochooseaSwiftversionorusetheBuildSettingseditortoconfigurethebuildsettingdirectly.尝试转换为swift3.0后,我不断收到错误消息:Conve

java - Netbeans 中的 "Convert to try-with-resources"- Cool Beans?

我在Netbeans7.1.2中有以下代码:BufferedOutputStreambos=newBufferedOutputStream(newFileOutputStream(filename));bos.write(newRawData);bos.close();警告提示我“转换为try-with-resources”。当我选择这样做时,我的代码变为:try(BufferedOutputStreambufferedFos=newBufferedOutputStream(newFileOutputStream(filename))){bufferedFos.write(newRaw

java - Java 8 收集器问题类型不匹配 : cannot convert from List<Object> to List<String>

我使用早期版本的java8工作代码,我用它从列表中获取唯一值,但自从我升级到JDK66后,它给了我一个错误类型不匹配:无法从List转换至ListListinstList=newArrayList();while(res.next()){instList.add(res.getString("INST").toString());}ListinstListF=instList.stream().distinct().collect(Collectors.toList());res是我从数据库中获取的结果集,不知道哪里出了问题? 最佳答案

java - Firebase Firestore : How to convert document object to a POJO on Android

使用实时数据库,可以做到这一点:MyPojopojo=dataSnapshot.getValue(MyPojo.Class);作为一种映射对象的方法,如何使用Firestore来实现这一点?代码:FirebaseFirestoredb=FirebaseFirestore.getInstance();db.collection("app/users/"+uid).document("notifications").get().addOnCompleteListener(task->{if(task.isSuccessful()){DocumentSnapshotdocument=task

java - 类型不匹配 : cannot convert from integer to boolean

publicbooleanclearSelection(){inti=0;if(!this.m_SelectedComps.isEmpty()){i=1;IteratorlocalIterator=this.m_SelectedComps.iterator();while(localIterator.hasNext())((AnnotComponent)localIterator.next()).remove();this.m_SelectedComps.clear();}returni;}如何将整数转为boolean值? 最佳答案