草庐IT

Invoke-customs

全部标签

ios - 让 VoiceOver 说 "Swipe Up or Down to Select a Custom Action, then double tap to activate"

我有一个UITextView,里面有两个不同的超链接。为了在VoiceOver打开时有机会在两个链接之间进行选择,我做了:classMyTextView{overridefuncawakeFromNib(){super.awakeFromNib()letstr="xxxxxxOption1yyyyOption2"letattrStr=NSMutableAttributedString(str)letrangeOption1=(strasNSString).range(of:"Option1")letrangeOption2=(strasNSString).range(of:"Optio

C#不能在控件上调用 Invoke 或 BeginInvoke

参考资料:https://www.cnblogs.com/idea555/articles/14808605.htmlhttps://blog.csdn.net/baidu_38995168/article/details/1154781821、现象:  今天关闭一个窗体,报出这样的一个错误:  "在创建窗口句柄之前,不能在控件上调用Invoke或BeginInvoke。"。  这个不用多想,肯定是那个地方没有释放掉。2、原因  winform最常见的是datagridview这个控件,不管重写还是怎么,很多数据的操作都是用datagridview来展示的,因此,它的异步调用也算是比较多的一类

uitableview - 'NSInvalidArgumentException',原因 : '-[UIImageView _isResizable] Exception with custom tableview cell

我在执行自定义单元格时收到NSInvalidArgumentException。调试器错误日志:2014-12-2521:39:11.397Codebuddies[24159:11353215]***由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[UIImageView_isResizable]:无法识别的选择器发送到实例0x7fa5f580b6a0”`相关的swift代码块:让cell=tableView.dequeueReusableCellWithIdentifier("Cell",forIndexPath:indexPath)

ios - Swift 错误 : Can't invoke (. .) 参数列表类型为 (([String) -> (Int, String))

我想创建一个数组扩展,将数组转换为具有通用键/值类型的字典。这是我的代码:extensionArray{functransformToDictionary(@noescapemappingFunction:(Array.Generator.Element)->(K,V))->[K:V]{vardict:[K:V]=[:]forelinself{letresult=mappingFunction(el)dict[result.0]=result.1}returndict}}这适用于某些情况,例如:letstringArray=["String1","String2"]stringArra

ios - 用户通知 : Custom Vibration pattern

是否可以为用户通知警报创建自定义振动模式?例如,我们可以为用户通知选择不同的音频。是否也可以有自定义振动模式?我的意思是在iOS上使用swift以编程方式执行此操作。 最佳答案 用于在iOS中创建自定义振动。使用AudioServicesPlaySystemSoundWithVibration和AudioServicesStopSystemSound。心跳振动示例NSMutableDictionary*pulsePatternsDict=[@{}mutableCopy];NSMutableArray*pulsePatternsArr

ios - Metal Custom CIFilter 不同的返回值

我正在编写CIFilter,但结果像素颜色与Metal函数的返回值不同。内核Metal#includeextern"C"{namespacecoreimage{float4foo(sample_trgb){returnfloat4(0.3f,0.5f,0.7f,1.0f);}}Metal过滤器.swiftimportCoreImageclassMetalFilter:CIFilter{privateletkernel:CIColorKernelvarinputImage:CIImage?overrideinit(){leturl=Bundle.main.url(forResource:

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

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

ios - MVC : Where do I place custom UICollectionCell

我是移动领域开发的新手,我对我的项目有一个架构问题:自定义UICollectionViewCell的正确位置在哪里?本能地,我会把它放在(V)view下。编辑我会这样使用它:funccollectionView(collectionView:UICollectionView,cellForItemAtIndexPathindexPath:NSIndexPath)->UICollectionViewCell{varcustomCell:CustomCell=collectionView.dequeueReusableCellWithReuseIdentifier(CustomCell.i

iOS swift : Formatting a custom Currency Number

用逗号分隔符格式化大数。已解决(代码已更新且完全可用)晚上,我有一个来自Double的类型别名Currency。我想用千位之间的逗号打印它。这是我做的:importFoundationtypealiasCurrency=DoubleextensionCurrency{varcredit:Double{returnself}varusd:Double{returnself*0.62}funcdescription()->String{letprice=selfasNSNumberletformatter=NumberFormatter()formatter.numberStyle=.cu

ios8/xcode6.1 : custom font ignored at runtime when set in storyboard

我将普通字体和粗体字体的2个*.ttf字体文件导入到xcode中,在.plist等中设置所有内容-现在我可以在Storyboard中完美地查看字体。不幸的是,当我将其设置为Storyboard模式时,属性TextView以及标签或按钮将忽略我的字体!如果我以编程方式生成某些东西,它可以正常工作,例如像这样:vartestButton=UIButton()testButton.setTitle("Abbrechen",forState:UIControlState.Normal)testButton.backgroundColor=UIColor.blueColor()testButto