草庐IT

text_value

全部标签

iOS PDFKit : make Text Widget PDFAnnotation readonly

我想将文本小部件PDFAnnotation设置为只读。我尝试将isReadOnly标志设置为true,但似乎没有任何区别。用户在点击后仍然可以编辑注释。 最佳答案 我已经研究这个问题一段时间了,我终于找到了可行的方法。我的解决方案是在.freeText上使用.widget。此方法可防止文本在导出后被选中和修改。我应该指出,PDF并非万无一失,任何PDF都可以反编译,但对于日常办公室工作人员来说,这是一个完美的解决方案。//Don'tusethis-Thisiswhatmosttutorialsshow//Whichcanbeeasi

macos - swift 错误 : Cannot assign to immutable value

此代码段出现上述错误:funcstore(name:String,inoutarray:[AnyObject]){forobjectinarray{ifobjectis[AnyObject]{store(name,&object)return}}array.append(name)}有什么想法吗? 最佳答案 用for提取的项目object是不可变的。您应该改为迭代数组的indices。并且,该项目是AnyObject,您不能在不强制转换的情况下将其传递给inoutarray:[AnyObject]参数。在这种情况下,您应该将其转换为

ios - Swift 在 Optional() 中获取值(value)

关闭。这个问题是notreproducibleorwascausedbytypos.它目前不接受答案。这个问题是由于错别字或无法再重现的问题引起的。虽然类似的问题可能是on-topic在这里,这个问题的解决方式不太可能帮助future的读者。关闭6年前。Improvethisquestion当我从我正在访问的API中获取返回值时,当我打印数据时,它显示为Optional((jknjknjkn))例如。我使用选择器在返回数据时运行方法funcresult(data:AnyObject){println(data["info"])}打印出来的就是上面的Optional的东西。如果没有Opt

ios - SWIFT:var someVariable:int = textfield.text.toInt() x textfield2.text.toInt() 并强制展开

第一次发帖,请多多关照。我对编码相当陌生,正在努力了解SWIFT及其可选项目。非常感谢专业人士的一些建议!我正在编写一个简单的应用程序,用户在其中输入文本字段,然后在应用程序中进行一些乘法运算,然后按下按钮“calculateTM”将答案吐出到另一个文本字段中。我在计算本身时遇到了一些问题,也许是因为我试图在一行上做太多-获取文本字段条目,转换为整数,与另一个转换为整数的文本字段条目相乘,基本上是我写的在标题中:varsomeVariable:Int=textfield.text.toInt()*textfield2.text.toInt()问题是,Xcode希望我强制解包并添加一个!

ios - swift 错误 : Value of type 'NSObject -> () ' AnimalListTableViewController' has no member 'tableView'

我正试图在swiftxcode中消除这些错误如果截图太小,这里是代码importUIKitclassAnimalListTableViewController:UITableViewController{overridefunctableView(tableView:UITableView,numberOfRowsInSectionsection:Int)->Int{return4}letindexPath=self.tableView.indexPathForSelectedRow()//thisiswheretheerrorappears,itsaysValueoftype'NSO

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 - swift 错误 : Could not cast value of type 'NSTaggedPointerString' (0x1a1264378) to 'NSNumber' (0x1a126f900)

我在Xcode(swift)中遇到这个错误:Couldnotcastvalueoftype'NSTaggedPointerString'(0x1a1264378)to'NSNumber'(0x1a126f900).我用//ERROR:("...")明确了错误在哪里代码:importUIKitimportiAdimportAVFoundationimportAudioToolboxletMAX:UInt32=4letMIN:UInt32=1classViewController:UIViewController,ADBannerViewDelegate{varchances=10varw

swift - 错误 : cannot convert value of type '() -> ()' to closure result type 'String' using Swift + PromiseKit

我不熟悉Swift中的promise,并使用PromiseKit尝试在Playground上创建一个非常简单的响应并尝试使用它。我有以下代码:importUIKitimportPromiseKitfuncfoo(_error:Bool)->Promise{returnPromise{fulfill,rejectinif(!error){fulfill("foo")}else{reject(Error(domain:"",code:1,userInfo:nil))}}}foo(true).then{response->Stringin{print(response)}}但是我得到以下错误

ios - swift 3 : How to export video with text using AVVideoComposition

我正在尝试使用AVVideoComposition在视频顶部添加一些文本并保存视频。这是我使用的代码:我创建一个AVMutableComposition和AVVideoCompositionvarmutableComp=AVMutableComposition()varmutableVidComp=AVMutableVideoComposition()varcompositionSize:CGSize?funcconfigureAsset(){letoptions=[AVURLAssetPreferPreciseDurationAndTimingKey:"true"]letvideoA

Swift tableview Cell label change Text by button 标签

我在tableview单元格上创建了​​一个按钮和两个标签,当单击按钮时然后更改tableview标签文本这是我的代码funcbuttonLike_ww(sender:AnyObject?){vartag:NSInteger=sender!.tag;tag_last_button_clicked=tag;//foundtableletcell=TableViewCell_trandingjive(style:UITableViewCellStyle.Default,reuseIdentifier:"Cell")cell.label_dislike.text="20"cell.label