草庐IT

UIViewController_keyboard

全部标签

ios - 成功登录后无法关闭 UIViewController

登录完成后,我正在努力从NavigationStack中关闭UIViewController。登录屏幕是一个UIViewController,显示了这行代码letloginController=LoginController()self.present(loginController,animated:true,completion:nil)然后我运行这段代码让用户通过firebase登录。Auth.auth().signIn(withEmail:email,password:password){(user,err)inifleterr=err{print("Failedtosigni

uiviewcontroller - 在自定义单元格中点击 UIButton 后显示新的 ViewController

嘿嘿!我想显示一个带有Action的ViewController(自定义单元格中UIButton的tappedInside)。在这种情况下,我不能仅通过控制从自定义单元格中的UIButton拖动到NavigationController(嵌入了ViewController)。我如何才能意识到tableview一行中按钮(在自定义单元格中)上的“tappedInside”会显示一个新的ViewController?谢谢! 最佳答案 您可以在单击具有委托(delegate)的单元格时触发:functableView(tableView:

ios - 使用 Swift 和 Storyboard 在两个 UIViewController 之间传递数据

我使用下面的代码来选择UITableView以在UIViewController之间传递数据-(void)prepareForSegue:(UIStoryboardSegue*)seguesender:(id)sender{if([segue.identifierisEqualToString:@"showRecipeDetail"]){NSIndexPath*indexPath=[self.tableViewindexPathForSelectedRow];RecipeDetailViewController*destViewController=segue.destinationV

ios - 在不初始化新对象的情况下转到 UIViewController

我正在使用Swift2.0在iOS9中构建。我的起始UIViewController是我的菜单屏幕。它包含以下代码:overridefuncprepareForSegue(segue:UIStoryboardSegue,sender:AnyObject?){ifletid=segue.identifierwhereid=="GamePlayScene"{self.gameVC=segue.destinationViewControlleras?GameViewControllerself.gameVC!.delegate=selfiflets=senderas?GKTurnBasedM

ios - Swift:如何返回到我的 UIViewController 的同一个实例

我的SettingsViewController中有一个按钮,当按下该按钮时,我想在每次按下该按钮时显示我的TimerViewController的相同实例。我想我已经很接近这篇文章了,iOSSwift,returningtothesameinstanceofaviewcontroller.因此,如果您能指出我保存TimerViewController的实例,那将是最好的。这是我现在的代码-varyourVariable:UIViewController!ifyourVariable==nil{letstoryboard=UIStoryboard(name:"Main",bundle:

ios - 在 Swift 中将 UIPageViewController 的逻辑实现为 UIViewController 的 subview

我必须将UIPageViewController实现为我的UIViewController的subview。UIPageViewController内部有一些逻辑和其他ViewController。我的问题是如何连接下面这两段代码。所以这是我的主要UIViewController代码:classMyMainViewController:UIViewController{overridefuncviewDidLoad(){super.viewDidLoad()}overridefuncdidReceiveMemoryWarning(){super.didReceiveMemoryWarn

ios - 如何在 Swift 中从 UIViewController 卸载 self.view

根据ViewControllerProgrammingGuide,我们可以通过将nil分配给self.view来显式地从UIViewController卸载self.view。但是在Swift中,UIViewController中的view属性声明为varview:UIView它不是UIView!因此下面的代码无法编译overridefuncdidReceiveMemoryWarning(){super.didReceiveMemoryWarning()ifself.view.window==nil{self.view=nil//^Type'UIView'doesnotconformt

ios - 使用带有 SkScene 的 NSNotificationCenter 到 UIViewController

我正在使用SpriteKit使用Swift制作游戏。我正在使用界面生成器来定位我所有的按钮(菜单、重试等),这样我就可以使用自动布局。然后,我在游戏结束函数中使用NSNotificationCenter在SKScene中显示这些按钮。我可以毫无问题地使用NSNotificationCenter在SKScene中显示UIKit内容。这是我的问题,我会尽力解释。当您游戏结束时,会显示一个名为retry的UIButton。我在SKScene中为重试函数设置了一个NSNotificationCenter观察器,并在IBAction中为viewController中的按钮调用了postNotif

ios - UIViewController 类型的值永远不能为 nil,不允许比较

我正在学习有关多View应用程序的教程,它说要在其中一个ViewController中编写此函数。我在第二个if语句中收到错误消息,指出UIViewController不能为nil,并且不允许进行比较。这是我不需要再担心的事情了吗?这本书有点过时,所以我假设它的出现是因为Swift的变化。privatefuncswitchViewController(fromfromVC:UIViewController?,totoVC:UIViewController){iffromVC!=nil{fromVC!.willMoveToParentViewController(nil)fromVC!.

ios - 创建都继承自 BaseViewController 的 TableViewController 和 UIViewController

我有五个ViewController,它们都继承自一个基本ViewController。我的baseVC包含共享功能,例如启动或停止事件识别器或检查互联网事件。VC如下所示classBaseVC:UIViewController{}classNewsFeedVC:BaseViewController{}classMakePostVC:BaseViewController{}classNotificationVC:BaseViewController{}classMoreVC:BaseViewController{}classCollectionVC:BaseViewController