How can I switch views programmatically in a view controller? (Xcode, iPhone)

If you’re in a Navigation Controller: ViewController *viewController = [[ViewController alloc] init]; [self.navigationController pushViewController:viewController animated:YES]; or if you just want to present a new view: ViewController *viewController = [[ViewController alloc] init]; [self presentViewController:viewController animated:YES completion:nil];

How to put the UIPageControl element on top of the sliding pages within a UIPageViewController?

I didn’t have the rep to comment on the answer that originated this, but I really like it. I improved the code and converted it to swift for the below subclass of UIPageViewController: class UIPageViewControllerWithOverlayIndicator: UIPageViewController { override func viewDidLayoutSubviews() { for subView in self.view.subviews as! [UIView] { if subView is UIScrollView { subView.frame = … Read more

Dismissing both UINavigation views and Modal views at once programmatically

If you want, in iOS 6.0 (and later) projects you can use an unwind segue. For example, you can: In your top level view controller (the one you want to unwind to, not the controller you’re going to unwind from), write an unwind segue method, in this case called unwindToTopLevel (personally, I find it useful … Read more

Why don’t these animations work when I’m using a storyboard?

As it turns out, you can’t use property path syntax in this case, because the properties being animated aren’t properties of a FrameworkElement. At least, that’s how I interpret the remarkably bewildering exception that I get when I make the change that Anvaka suggested: Cannot automatically create animation clone for frozen property values on ‘System.Windows.Media.TranslateTransform’ … Read more

iOS – Push viewController from code and storyboard

Objective-C: PlaceViewController *newView = [self.storyboard instantiateViewControllerWithIdentifier:@”storyBoardIdentifier”]; [self.navigationController pushViewController:newView animated:YES]; Please do notice below points, your storyboard identifier is correct. The root view have navigation Controller. Swift: let newView = self.storyboard?.instantiateViewController(withIdentifier: “storyBoardIdentifier”) as! PlaceViewController self.navigationController?.pushViewController(newView, animated: true)