Closed relaxsus closed 6 years ago
You can init the SwipeViewController simply like this:
let pageController = UIPageViewController(transitionStyle: .scroll, navigationOrientation: .horizontal, options: nil)
let navigationController = YourViewControllerName(rootViewController: pageController)
You can do this wherever you want, I guess I should make it more clear from the documentation.
override func viewDidAppear(_ animated: Bool) {
super .viewDidAppear(animated)
let pageController = UIPageViewController(transitionStyle: .scroll, navigationOrientation: .horizontal, options: nil)
let navigationController = ViewController(rootViewController: pageController)
self.present(navigationController, animated:false, completion: nil)
}
this code does not work :( Please tell me what my mistake is, or how to write better :( I'm a beginner programmer, please forgive me :(
And what exactly does not work? I tried to present SwipeViewController in my code and it worked. Maybe there is something wrong in your ViewController regarding the setting of SwipeViewController.
But if you have authorization window, I think it would be better to first set AuthorizationViewController and then set it rootViewController to whatever your next viewcontroller is. Like this:
let window = UIApplication.shared.keyWindow
window?.rootViewController = YourViewController()
window?.makeKeyAndVisible()
Only the first screen is displayed, but nothing is pressed. If you put 'animated: true', then an infinite number of times is shown
...are you calling that in ViewController? Because then it would make sense (every time the view appears, it calls viewDidAppear again, etc., etc.)
Yes, you are right. How then to be? at what point it is better to call?
I do not really understand what you are trying to achieve. You said that you have an authorizationviewcontroller from which you want to present SwipeViewController, is that right? Well, then in you AuthorizationViewController, for example when user taps loginButton, present SwipeViewController.
Oh my God, forgive me for taking your time, I,ve found a mistake after your last message. That was such a petty mistake .... You are a wonderful person and a programmer! Thank you very much! Everything is working!
Great! Glad to be of help, hit me up if you encounter any more problems 😉
Could you tell me pleeeease, how I can add the TabBarController to the hierarchy? I mean that the main Navigation is my TabBar with bottom switching. And after that is SwipeViewController.
I do not use storyboard and I have not tried that yet, you have to basically replicate this part:
let pageController = UIPageViewController(transitionStyle: .scroll, navigationOrientation: .horizontal, options: nil)
let navigationController = YourViewControllerName(rootViewController: pageController)
My guess is that it would go something like this: TabBarController -> SwipeViewController -> (rootViewController) UIPageViewController
Umm, you do not have to present navigationController from your tabBarController, that is handled by UIKit itself. Just set tabBarController.viewCountrollers = Array
On Dec 19, 2017, at 8:59 AM, relaxsus notifications@github.com wrote:
Good afternoon. Could you tell me please, how is it possible to write the code? :( I wrote this code, but it does not work, because I do not know how to process tabBar = ( I excuse me for taking your time :( override func prepare(for segue: UIStoryboardSegue, sender: Any?) { if (segue.identifier == "show") { if let tabBarController = segue.destination as? UITabBarController { let pageController = UIPageViewController(transitionStyle: .scroll, navigationOrientation: .horizontal, options: nil) let navigationController = ViewController(rootViewController: pageController) self.present(navigationController, animated: true, completion: nil) } } }
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/fortmarek/SwipeViewController/issues/26#issuecomment-352667421, or mute the thread https://github.com/notifications/unsubscribe-auth/AI8AL1E2RyzQNyjixctl13TUF7vcybBSks5tB2zigaJpZM4RFQ41.
Yes, I eventually read a lot of information, and did the same. Therefore, I deleted the question. You are a great person. I feel uncomfortable. Thank you very much.
I see, I answered right from the email, so I did not notice it had been already deleted. Anyway, starting programming is a difficult task, so do not feel bad for asking questions and no question is stupid. Keep learning ✌
On Dec 19, 2017, at 12:52 PM, relaxsus notifications@github.com wrote:
Yes, I eventually read a lot of information, and did the same. Therefore, I deleted the question. You are a great person. I feel uncomfortable. Thank you very much.
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/fortmarek/SwipeViewController/issues/26#issuecomment-352728023, or mute the thread https://github.com/notifications/unsubscribe-auth/AI8AL8OLBBNSQ8cq4eHsJs7wUY9DELcOks5tB6NmgaJpZM4RFQ41.
I see, I answered right from the email, so I did not notice it had been already deleted. Anyway, starting programming is a difficult task, so do not feel bad for asking questions and no question is stupid. Keep learning ✌
On Dec 19, 2017, at 12:52 PM, relaxsus <notifications@github.com mailto:notifications@github.com> wrote:
Yes, I eventually read a lot of information, and did the same. Therefore, I deleted the question. You are a great person. I feel uncomfortable. Thank you very much.
— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/fortmarek/SwipeViewController/issues/26#issuecomment-352728023, or mute the thread https://github.com/notifications/unsubscribe-auth/AI8AL8OLBBNSQ8cq4eHsJs7wUY9DELcOks5tB6NmgaJpZM4RFQ41.
How can I do without "didFinishLaunchingWithOptions"? For example, how can I call my SwipeViewController in the viewDidAppear method? When the application starts, the first window I have authorization, and then I need to work with SwipeViewController.