草庐IT

xcode-storyboard

全部标签

swift - Xcode8 beta 6 - 带有 completionHandler 参数的 URLSession 不起作用

从beta5更改为beta6后,我似乎根本无法在我的代码中使用此方法。openfuncdataTask(withrequest:URLRequest,completionHandler:@escaping(Data?,URLResponse?,Error?)->Swift.Void)->URLSessionDataTask我的代码:lettask=self.createSession().dataTask(with:request,completionHandler:{(data,response,error)inself.handleTaskResult(data:data,resp

ios - Xcode:持久性段错误:使用 Firebase 时为 11

我很生气Commandfailedduetosignal:Segmentationfault:11当我在项目中使用Firebase时。我在这里阅读了多个有关此Xcode错误的问题,但在使用Firebase时它非常顽固。我尝试了很多解决方案,比如清理项目、重建、禁用位码、删除派生数据等。我的代码:@IBActionfuncsaveBook(sender:UIBarButtonItem){vararrayOfNames:[String]=[String]()foriin0.. 最佳答案 正如通常在类似问题中提到的那样,当Xcode由于某

swift - 如何通过代码而不是拖放将 Storyboard中的多个按钮连接到一个 Action ?

我目前正在使用Xcode7.3,我只是想知道如何跨不同的UIView选择多个按钮,但在单个ViewController下。CMD点击似乎不起作用。我需要此功能,因为在Xcode7.3中,让IB上的两个按钮共享相同操作的唯一方法是一次选择它们,然后将操作拖动到ViewController。我是通过代码来做的,没有拖放classLogIn:UIViewController{varmail_tf:UITextField!varpass_tf:UITextField!varbtnL:UIButton!varbtnC:UIButton!letcl1=UIColor(red:255/255.0,g

ios - Xcode 模拟器 TableView 是黑色的

在模拟器中运行我的Xcode项目时,我的UIViewController(不是UITableViewController)中的UITableView是黑色的。这是我的模拟器的图片:我的cellForRowAtIndexPath方法的代码:functableView(tableView:UITableView,cellForRowAtIndexPathindexPath:NSIndexPath)->UITableViewCell{letcellIdentifier="Cell"letcell=tableView.dequeueReusableCellWithIdentifier(cell

ios - 如何以编程方式快速创建 uicollectionview(没有 Storyboard)

我正在尝试以编程方式快速创建一个uicollectionview,没有任何Storyboard。我需要它是多个uicollectionview。这是我的代码classjobtypeViewController:UIViewController,UICollectionViewDelegate,UICollectionViewDataSource{varcollectionview1=UICollectionView()varcollectionview2=UICollectionView()overridefuncviewDidLoad(){super.viewDidLoad()let

swift - Xcode 8.1 因特征而变化时变慢

当我尝试使用varyfortraits更改iPad大小类的Storyboard时,Xcode8.1变得非常慢。我无法在界面生成器中四处移动View。请帮忙。提前致谢。 最佳答案 我已经解决了。对于将来遇到此问题的任何人,请将其视为iPadpro12.9"而不是iPadpro9.7",同时改变特性。 关于swift-Xcode8.1因特征而变化时变慢,我们在StackOverflow上找到一个类似的问题: https://stackoverflow.com/qu

ios - Xcode Swift 将 String 从 popover View 传递给主 VC

我试图将数据从我的popOverViewController中的字符串传递回我的mainVC作为字符串。但我不知道该怎么做,所以请帮助任何人。我的mainVCsegue函数:overridefuncprepareForSegue(segue:UIStoryboardSegue,sender:AnyObject?){ifsegue.identifier=="popoverSegue"{letpopoverViewController=segue.destinationViewControllerpopoverViewController.modalPresentationStyle=UI

Swift:在 GameScene 中使用 StoryBoards 和 UIViewControllers 满足条件后返回主菜单?

上下文这个问题与Swift:SKSpriteKit,usingStoryboards,UIViewControllerandUIButtontosetingameparameters?有关并使用相同的M.W.E.(下面的链接)。看看Main.storyboard我们看到以下内容:虽然这个Storyboard允许通过单击从左到右前进:play->(easy/hard)->GameSceneUIViewController->MyUIViewController->GameViewController然后从右到左单击最后一个UIViewController上的UIButton和UILabe

swift - `?` 在 Xcode 8.3.2 的 Swift 编译器中导致段错误

我有这行Swift可以毫无问题地编译letlayoutSettings=tryLayoutSettings.deserialize(params:layoutSettingsParamsasDictionary)从Xcode8.3.2开始我得到错误SwiftCompilerErrorCommandfailedduetosignal:Segmentationfault:11如果我删除代码行末尾的?,它可以毫无问题地编译。如何在不使编译器崩溃的情况下使用可空类型? 最佳答案 AnyObject和AnyObject?不是一回事。AnyOb

swift - 当我之前打开它后返回到 View Controller 时,它不会为标签设置动画 Xcode Swift

当我打开我的应用程序时,我有一个从屏幕外动画的标签。当我第一次打开ViewController时,它起作用了。但是,当我转到另一个ViewController,然后返回到初始ViewController时,这个标签将只在那里,而不是动画。levelsLabel.center=CGPoint(x:levelsLabel.center.x-500,y:levelsLabel.center.y)UIView.animate(withDuration:2){self.levelsLabel.center=CGPoint(x:self.levelsLabel.center.x+500,y:sel