这是我收到错误的行:
func logInVIEwController(logInController: PFLogInVIEwController,dIDLogInUser user: PFUser) { self.dismissVIEwControllerAnimated(true,completion: nil) self.presentVIEwController(TimelinetableVIEwController,animated: true,completion: nil)}
这是整个代码:
// Created by Ojas Sethi on 12/10/15.// copyright © 2015 Jell Apps. All rights reserved.//import UIKitimport Parseimport ParseUIclass LoginSignupVIEwController: UIVIEwController,PFLogInVIEwControllerDelegate,PFSignUpVIEwControllerDelegate { var logInVIEwController: PFLogInVIEwController = PFLogInVIEwController() var signUpVIEwController: PFSignUpVIEwController = PFSignUpVIEwController() overrIDe func vIEwDIDLoad() { super.vIEwDIDLoad() // Do any additional setup after loading the vIEw. } overrIDe func vIEwDIDAppear(animated: Bool) { super.vIEwDIDAppear(animated) if (PFUser.currentUser() == nil){ self.logInVIEwController.fIElds = PFLogInFIElds.UsernameAndPassword self.logInVIEwController.fIElds = PFLogInFIElds.LogInbutton self.logInVIEwController.fIElds = PFLogInFIElds.SignUpbutton self.logInVIEwController.fIElds = PFLogInFIElds.PasswordForgotten self.logInVIEwController.fIElds = PFLogInFIElds.dismissbutton /*| PFLogInFIElds.LogInbutton | PFLogInFIElds.SignUpbutton | PFLogInFIElds.PasswordForgotten | PFLogInFIElds.dismissbutton*/ let logoInlogoTitle = UILabel() logoInlogoTitle.text = "Ziffer" logoInlogoTitle.Font = UIFont.systemFontOfSize(25)self.logInVIEwController.logInVIEw?.logo = logoInlogoTitle self.logInVIEwController.delegate = self let signUplogoTitle = UILabel() signUplogoTitle.text = "Ziffer" logoInlogoTitle.Font = UIFont.systemFontOfSize(25) self.signUpVIEwController.signUpVIEw?.logo = signUplogoTitle self.signUpVIEwController.delegate = self self.logInVIEwController.signUpController = self.signUpVIEwController } } overrIDe func dIDReceiveMemoryWarning() { super.dIDReceiveMemoryWarning() // dispose of any resources that can be recreated. } func logInVIEwController(logInController: PFLogInVIEwController,shouldBeginLogInWithUsername username: String,password: String) -> Bool { if (!username.isEmpty || !password.isEmpty){ return true }else{ return false } } func logInVIEwController(logInController: PFLogInVIEwController,dIDLogInUser user: PFUser) { self.dismissVIEwControllerAnimated(true,completion: nil) self.presentVIEwController(TimelinetableVIEwController,completion: nil) } func logInVIEwController(logInController: PFLogInVIEwController,dIDFailTologInWithError error: NSError?) { print("Failed to login") } func signUpVIEwController(signUpController: PFSignUpVIEwController,dIDSignUpUser user: PFUser) { self.dismissVIEwControllerAnimated(true,completion: nil) self.presentVIEwController(logInVIEwController,completion: nil) SignUpSuccessfulAlert() } func signUpVIEwController(signUpController: PFSignUpVIEwController,dIDFailToSignUpWithError error: NSError?) { print("Failed to signup...") SignUpFalIEDalert() } func signUpVIEwControllerDIDCancelSignUp(signUpController: PFSignUpVIEwController) { print("User dismissed sign up.") } func SignUpSuccessfulAlert(){ var alertController : UIAlertController alertController = UIAlertController(Title: "Sign Up Successful",message: "Yay! Sign up was successful! Now you can start using Ziffer!",preferredStyle: .Alert) let doneAction = UIAlertAction(Title: "Ok",style: .Default,handler: nil) alertController.addAction(doneAction) self.presentVIEwController(alertController,completion: nil) } func SignUpFalIEDalert(){ var signUpalertFail : UIAlertController signUpalertFail = UIAlertController(Title: "Failed",message: "Sorry! Sign up faIEld. Check the connections and try again later",preferredStyle: .Alert) let okAction = UIAlertAction(Title: "Ok",handler: nil) signUpalertFail.addAction(okAction) self.presentVIEwController(signUpalertFail,completion: nil) }}解决方法 首先,您尝试从登录视图控制器呈现您的新视图控制器即将解散.那是不对的.您可能希望从呈现登录视图控制器的稳定视图控制器呈现它.这是关于如何做到这一点的 nice example.这是基于objective-c所以请耐心等待.
其次,您需要创建一个TimelinetableVIEwController对象以显示在视图层次结构中(再次查看我上面分享的链接).像这样的东西:
let timelinetableVC = TimelinetableVIEwController()self.presentVIEwController(timelinetableVC,completion: nil)总结
以上是内存溢出为你收集整理的ios – 无法将值类型’TableViewController.Type’转换为预期的参数类型’UIViewController’全部内容,希望文章能够帮你解决ios – 无法将值类型’TableViewController.Type’转换为预期的参数类型’UIViewController’所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)