I'm adding a ViewController (MainViewController
) inside a scroll view (TourViewController
) with the Storyboard below.
The following code is how I add the MainViewController
to the TourViewController
let subView = UIScrollView(frame: CGRectMake(
(self.scrollView.frame.width * CGFloat(pageImages.count)),
0,
self.scrollView.frame.width,
(self.scrollView.frame.height)))
//Set the size of the content view
let contentView = UIView(frame: CGRectMake(0, 0, self.view.frame.width, self.view.frame.height))
subView.contentSize = CGSizeMake(contentView.frame.width, self.view.frame.height)
let newView = self.storyboard?.instantiateViewControllerWithIdentifier("MainView") as? MainViewController
contentView.addSubview(newView!.view)
subView.addSubview(contentView)
scrollView.addSubview(subView)
It appears to work well but I'm not able to add any segue from the MainViewController
to any other view as it will raise an exception at runtime.
In my MainViewController I have the following code on the viewDidLoad
login.addTarget(self, action: "buttonAction:", forControlEvents: UIControlEvents.TouchUpInside)
When I click on the button it raise the error