Skip to content
Tags

Warning :-Presenting view controllers on detached view controllers is discouraged

December 5, 2014

This log message I received when I was running my app  and it led to a strange UI glitch, where one of my  view in the application lost all of its subviews.

Context:

This error occurred once the modal view controller was dismissed.

Reason:

I had legacy code from the days of iOS 4.0. The view which was losing its subviews is a View controlled  by a UIViewController. So this view controller was not added as a ChildViewController of the Parent Controller.

Fix:

Added the viewcontroller responsible for this problem as a child of the parent controller and the problem was resolved

Advertisements

From → iOS

One Comment
  1. StanleyGao permalink

    How do you add child parent relationship to view controllers?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: