草庐IT

Project-Swift

全部标签

ios - 如何修复 Realm for swift 2.0 安装报错?

我尝试为swift2.0安装realm,但显示错误。请告诉我如何解决这个问题。我已经完成了“sudogemupdatecocoapods”和“sudogeminstallcocoapods--pre”。/Users/*******/App/BandApp%pod--version0.36.4/Users/*******/App/BandApp%catPodfileuse_frameworks!pod'Realm',:git=>'https://github.com/realm/realm-cocoa.git',:branch=>'swift-2.0'pod'RealmSwift',:g

ios - SWRevealViewController 不与 swift 3 切换

我使用的是swift2.1的代码overridefuncviewDidLoad(){super.viewDidLoad()ifrevealViewController()!=nil{menuButton.target=revealViewController()menuButton.action="revealToggle:"view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())}}现在,我将Swift3用于:overridefuncviewDidLoad(){super.viewDid

ios - 在 webViewDidFinishLoad 上,我在 swift3 中获得了额外的内容高度

EventWebView.frame.size=EventWebView.sizeThatFits(CGSize.zero)EventWebView.scrollView.isScrollEnabled=false;varframe=EventWebView.frame;frame.size.width=EventTableView.frame.size.width-40;//Yourdesiredwidthhere.frame.size.height=1;//Settheheighttoasmallone.EventWebView.frame=frame;//SetwebView's

ios - 将html文件从swift 3中的本地自定义文件夹加载到WebView

我想从本地自定义文件夹将html文件加载到WebView-ProjectNameFolder/test/index.html。尝试此代码,但不起作用。mWebView.loadRequest(URLRequest(url:URL(fileURLWithPath:Bundle.main.path(forResource:"test/index",ofType:"html")!)asURL))已编辑当我没有文件夹名称时,效果很好。mWebView.loadRequest(URLRequest(url:URL(fileURLWithPath:Bundle.main.path(forResou

ios - Swift 3 CoreData 在 iOS 9 设备上崩溃

我有一个在iOS10上完美运行的CoreData应用程序,它是用Swift3编写的,支持iOS8.4及更高版本。当我尝试在iOS9.3.5上运行它时出现错误:2016-10-0717:47:20.596FormApp[710:179733]***Terminatingappduetouncaughtexception'NSInvalidArgumentException',reason:'***-[NSSetintersectsSet:]:setargumentisnotanNSSet'在线崩溃:form.addToOpenQuestions(openQuestion)我已经将@obj

在Swift 3中不同部分中的表观视图中执行互斥选择的最佳方法

我有一个带有不同部分的桌面视图,我需要能够从不同的部分进行多选择,但是每个部分中的行应该能够选择互斥的明智。例如:在下面的屏幕截图中,我应该能够从比萨饼中选择玛格丽塔酒或烧烤鸡,而对于深盘披萨,但我应该能够在披萨部分和深盘披萨之间进行多选择以下是我到目前为止的代码,我想知道什么是最好的方法。letsection=["Pizza","Deepdishpizza"]letitems=[["Margarita","BBQChicken"],["Sausage","meatlovers"]]overridefunctableView(_tableView:UITableView,titleForHea

如何用10行限制文本视图文本高度,然后剩下的文本以在swift中滚动3

在这里,我设计了文本视图,该文本视图将使用键盘上升并调整其高度取决于文本,在文本视图中没有滚动文本视图,现在我需要文本视图应限制10行,然后需要滚动。以下是我的代码:importUIKitclassViewController:UIViewController,UITextFieldDelegate,UITextViewDelegate{@IBOutletweakvarmsgTextViewheightConstraint:NSLayoutConstraint!@IBOutletweakvarmsgTextView:UITextView!@IBOutletweakvartextViewBott

ios - 如何在 Swift 2.0 iOS 9 中使用 requestAccessToEntityType 方法?

我正在尝试设置提醒并且需要在Swift2.0foriOS9中访问对实体类型方法的请求。但是,它给了我错误:Useofunresolvedidentifier@IBActionfuncsetReminder(sender:AnyObject){appDelegate=UIApplication.sharedApplication().delegateas?AppDelegateifappDelegate!.eventStore==nil{appDelegate!.eventStore=EKEventStore()appDelegate!.eventStore!.requestAccess

ios - Swift 2 - UICollectionViewFlowLayout 的行为未定义,因为 :

我正在使用UICollectionrView来显示视频。一切正常,除了我收到一条警告:2015-10-3014:00:39.893test[6451:90574]thebehavioroftheUICollectionViewFlowLayoutisnotdefinedbecause:2015-10-3014:00:39.893test[6451:90574]theitemwidthmustbelessthanthewidthoftheUICollectionViewminusthesectioninsetsleftandrightvalues,minusthecontentinset

ios - 在 Swift SpriteKit 中的场景之间显示 Admob Interstitial 广告

我想知道如何在展示GameOverScene时设置AdmobInterstitial广告。我应该怎么做才能在游戏结束时仅偶尔显示广告?我如何在Swift中实现它?我指的是这篇文章Howtocalladmobinterstitialadusingswift,spritekitandxcode?但我想知道如何在场景之间调用广告。编辑这是我用来展示广告的代码classGameViewController:UIViewController,GADInterstitialDelegate{varinterstitial=GADInterstitial()varintersitialRecieve