New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
work with existing viewcontrollers in storyboard? #5
Comments
Can you show me which line it was at? |
It was at the very first few lines of my first view controller. captionTextField.delegate = self |
I don't know what a captionTextField is. I need more info, this doesn't seem to be related to EZSwipeController |
Everything in EZSwipeController seems to work fine, but the error was thrown when it tried to access my existing view controllers. captionTextField is a UITextField in one of my existing view controllers, as soon as I comment all IBoutlets everything works fine. I was just wondering if there was a way to integrate existing view controllers in storyboard with EZSwipeController. In the demo project, it looks like everything was added programmatically, but can i use storyboard tho? |
Are you trying to create this inside a small textfield? You can't use storyboard without making some edits but you can call from a button that is inside the storyboard |
Hello, have you been able to solve this problem? |
No, I just used a UIPageViewController instead |
😢 |
I will try! On Jan 23, 2016, at 10:59 PM, Goktug Yilmaz <notifications@github.commailto:notifications@github.com> wrote: [:cry:] — |
http://stackoverflow.com/questions/tagged/ezswipecontroller You can ask your question here if you want to. If you solved the problem please send a pull request. Thanks! |
I had run into this issue as well. I believe it is because Jackson and I both have previously made ViewControllers in a Storyboard file, and are now trying to use them in the EZSwipeController. However, if you have objects that were outletted to the ViewController class, since it hasn't been instantiated from the storyboard, it is nil and therefore causes a crash. To fix this, in my custom subclass of EZSwipeController's setupView() function, I instantiate the three ViewController's I need from the storyboard (using storyboard.instantiateViewControllerWithIdentifier), save it to my custom subclass of the EZSwipeController and then reference that array of ViewControllers in the viewControllerData() extension func. |
@blazierkyle @goktugyil can you provide code example? I did that and still get nil import UIKit
import EZSwipeController
class MainViewController: EZSwipeController {
var swipeArray: [UIViewController]!
override func setupView() {
datasource = self
let storyboard = UIStoryboard(name: "Main", bundle: nil)
let stream = storyboard.instantiateViewControllerWithIdentifier("Stream") as! StreamViewController
let camera = storyboard.instantiateViewControllerWithIdentifier("Camera") as! CameraViewController
self.swipeArray = [stream, camera]
}
override func viewDidLoad() {
super.viewDidLoad()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}
extension MainViewController: EZSwipeControllerDataSource {
func viewControllerData() -> [UIViewController] {
return self.swipeArray
}
func indexOfStartingPage() -> Int {
return 0
}
}
//**UPDATE**: In app delegate, I had the wrong viewController in window!.rootViewController. It works now!.
window = UIWindow(frame: UIScreen.mainScreen().bounds)
window!.rootViewController = MainViewController()
window!.makeKeyAndVisible() |
@otymartin Happy to hear you got it working! |
@blazierkyle Thanks for the solution, i was so happy to finally get it to work. Im curious though if you ever managed to get rid of bounces in first & last VC. Thats what im struggling with now in #38 |
Is there a way to integrate EZSwipeController with existing view controllers in storyboard? I tried to do this but received an error when EZSwipeController tried to access view controllers. error : fatal error: unexpectedly found nil while unwrapping an Optional value
The text was updated successfully, but these errors were encountered: