草庐IT

instantiateViewControllerWithIden

全部标签

ios - JASidePanels 示例 2 使用 Storyboard : crash

我正在尝试使用Storyboard实现JASidePanelsexample2。https://github.com/gotosleep/JASidePanels#example-2-storyboards-(void)awakeFromNib{[selfsetLeftPanel:[self.storyboardinstantiateViewControllerWithIdentifier:@"leftViewController"]];[selfsetCenterPanel:[self.storyboardinstantiateViewControllerWithIdentifier

ios - 在 Apple 方法中隐式解包可选

我正在尝试从Objective-C切换到Swift。我不明白声明函数以返回AnyObject!而不是AnyObject?的意义。例如:funcinstantiateViewControllerWithIdentifier(identifier:String)->AnyObject!为什么这个方法返回一个隐式展开的可选而不是一个简单的可选?我得到了AnyObject部分,但是允许我们避免使用!解包可选的(如果它可能为nil)有什么意义呢?(因此使应用程序崩溃,即使这种情况极不可能发生)我错过了什么?这只是一种使用此方法的返回值而无需使用!的便捷方式,还是有其他我看不到的东西?在这种情况下

ios - 在 Swift 2.2 中呈现弹出窗口时在闭包错误中隐式使用 'self'

如果用户成功重置密码,我会尝试将ViewController呈现为弹出窗口。基本上,如果通过电子邮件发送密码重置说明电子邮件一切正常,那么将运行以下代码。但是,我收到了错误闭包中“self”的隐式用户;使用“.self”使捕获语义明确在下面的第一行:letVC=storyboard?.instantiateViewControllerWithIdentifier("ResetPasswordSuccessPopOver")as!ResetPasswordSuccessPopOverViewControllerVC.preferredContentSize=CGSize(width:UI

ios - swift 2 : How to Load UITabBarController after Showing LoginViewController

我是Swift和Storyboard的新手。最初我必须显示登录页面并从登录页面显示到UITabBarController。一旦用户记住了登录详细信息,我必须检查AppDelegate中的登录详细信息,如果用户已经登录,则直接显示UITabBarController。我已经提到了一些SOF问题,但没有得到结果。IdesignedtheLoginViewControllerembeddedwithUINavigationController.AndIhaveoneUITabBarControllerwith2viewcontrollers.IsettheLoginViewControlle

ios - 在 Swift for iOS 中使用 BWWWalkthroughController 的转换错误

我正在尝试使用开源框架BWWWalkthroughController(链接:https://github.com/ariok/BWWalkthrough)为我的iOS应用程序创建自定义演练,但我无法让它工作!这是发生错误的类:importUIKitclassStartPageViewController:UIViewController,BWWalkthroughViewControllerDelegate{overridefuncviewDidLoad(){super.viewDidLoad()}overridefuncviewDidAppear(animated:Bool){su

ios - 基于逻辑快速进行Segue

我想在应用程序首次启动时基于if语句在swift中显示两个View之一,我该怎么做这是逻辑ifsignupconfirmed==true{//havetoshowoneview}else{//havetoshowanotherview} 最佳答案 一种方法是您可以使用以下代码启动带有标识符的viewController:varsignupconfirmed=true@IBActionfuncsignUpPressed(sender:AnyObject){ifsignupconfirmed{//havetoshowoneviewlet

ios - 如何从非 ViewController 帮助程序类显示 ViewController?

通常我们从一些UIViewController对象调用self.presentViewController(...),但是如何从不是UIViewController的辅助类中的类类型(静态)函数显示新的ViewController。 最佳答案 您可以将辅助类中的viewController显示为navigationcontroller的RootViewControllerUIStoryboard*storyBoard=[UIStoryboardstoryboardWithName:@"Main"bundle:[NSBundlemai

ios - performSegueWithIdentifier 与 instantiateViewControllerWithIdentifier 对比

我似乎没有收到这个SIGABRT,我一直收到。我有这个StoryboardiOS应用程序,在Storyboard中我有一个UITableViewController。现在,我可以获取TVC的一个单元格并使其推送“segue”ViewController,但是如果我需要在某些条件下停止“segue”操作怎么办?显然你不能,因为prepareForSegue:sender:方法不允许这样做,而且它似乎是在即将执行转换时调用的唯一回调。所以我想我可以进入tableView:didSelectRowAtIndexPath:并以编程方式执行segue。次优,但仍然......嗯,原来我猜错了。或

ios - performSegueWithIdentifier 与 instantiateViewControllerWithIdentifier 对比

我似乎没有收到这个SIGABRT,我一直收到。我有这个StoryboardiOS应用程序,在Storyboard中我有一个UITableViewController。现在,我可以获取TVC的一个单元格并使其推送“segue”ViewController,但是如果我需要在某些条件下停止“segue”操作怎么办?显然你不能,因为prepareForSegue:sender:方法不允许这样做,而且它似乎是在即将执行转换时调用的唯一回调。所以我想我可以进入tableView:didSelectRowAtIndexPath:并以编程方式执行segue。次优,但仍然......嗯,原来我猜错了。或

ios - Storyboard instantiateViewControllerWithIdentifier 不设置 IBOutlets

我正在使用StoryboardinstantiateViewControllerWithIdentifier:并且我注意到我连接的所有IBOutlets仍然为零。但是,我连接的IBActions可以正常工作。View和Controller是链接的(即controller.view不是nil),如果我显示View,它会显示我所期望的内容。我错过了什么?这是我的设置:我在Storyboard中定义了一个ViewController。我给了它一个标识符,它与调用instantiateViewControllerWithIdentifier:时使用的标识符相同我已经通过点击ViewContro