私は SOF に関する他の質問を調べました。それらは私の問題に近いですが、まったく同じではありません。
PFLogInViewControllerでサブクラス化してParseUI をロードしようとしてMyLogInViewControllerいますviewDidLoadが、アニメーションが表示されず (すでにロードされていると思われるため)、以下のウィンドウ階層警告が表示されますviewDidAppear。たぶん、ビューが表示され続けるためですか?)
試してみましたがviewWillApear、アニメーションが機能しませんでした。
Warning: Attempt to present <myloginbeta1.MyLogInViewController: 0x7fa0185f0b30> on <myloginbeta1.MyLogInViewController: 0x7fa0185d4110> whose view is not in the window hierarchy!
viewWillLayoutSubviewsノンストップリピートしてみました。
試してみましたがviewDidLayoutSubviews、アニメーションが機能しませんでした。
Warning: Attempt to present <myloginbeta1.MyLogInViewController: 0x7fa0185f0b30> on <myloginbeta1.MyLogInViewController: 0x7fa0185d4110> whose view is not in the window hierarchy!
アニメーションが適切に表示され、警告メッセージが表示されないようにする必要がある場所はありますか?
これが私のコードです:
import UIKit
import ParseUI
class MyLogInViewController: PFLogInViewController, PFLogInViewControllerDelegate, FBLoginViewDelegate, PFSignUpViewControllerDelegate {
override func viewDidLoad() {
super.viewDidLoad()
//This func works with warning below and the animation part is not working since it is called before the view appear.
//Warning: Attempt to present <myloginbeta1.MyLogInViewController: 0x7fa0185f0b30> on <myloginbeta1.MyLogInViewController: 0x7fa0185d4110> whose view is not in the window hierarchy!
// Do any additional setup after loading the view.
}
override func viewDidAppear(animated: Bool) {
//This func doesn't work, viewDidAppear will keep repeating
}
override func viewWillAppear(animated: Bool) {
//This func works but the animation part is not working since it is called before the view appear.
self.view.backgroundColor = UIColor(red: 241/255.0, green: 224/255.0, blue: 174/255.0, alpha: 1.0)
var logInController:MyLogInViewController = MyLogInViewController()
logInController.fields = (PFLogInFields.UsernameAndPassword
| PFLogInFields.LogInButton
| PFLogInFields.SignUpButton
| PFLogInFields.PasswordForgotten
| PFLogInFields.DismissButton
| PFLogInFields.Facebook
| PFLogInFields.Twitter)
logInController.delegate = self
logInController.facebookPermissions = ["public_profile", "email", "user_friends"]
let logoView = UIImageView(image: UIImage(named:"logo.png"))
self.logInView.logo = logoView
self.presentViewController(logInController, animated:true, completion: nil)
}
func logInViewController(controller: MyLogInViewController, didLogInUser user: PFUser!) -> Void {
self.dismissViewControllerAnimated(true, completion: nil)
println("Login Successful")
}
func logInViewControllerDidCancelLogIn(controller: MyLogInViewController) -> Void {
self.dismissViewControllerAnimated(true, completion: nil)
}
ありがとう、そして助けていただければ幸いです!:-)
更新:この質問を投稿する前に、ウィンドウ階層にないビューを確認しました。viewDidAppear を使用した解決策は役に立たず、loginView が繰り返し表示され続けます。