Dynamicly added subview disappears

I have a UIView that gets created and added as a subview dynamically, not in interface builder. Problem is the subview disappears eventually and all that is left on the screen is the objects that are defined in the xib that is being loaded.

It seems to occur once the retainCount of the subview drops from 3 to 2. I'm fairly new to iPhone development and don't fully understand the memory management complexities so I may be missing something obvious. Can anyone shed some light on what my problem could be? Any help would be greatly appreciated. Thanks.


This is just a wild guess, but a low memory warning might be causing the view to get purged from memory, and when it's reloaded the view is no longer there because there's nothing in viewDidLoad to redisplay it if this happens. You may need to store the view in an ivar, then have viewDidLoad add it again if it exists.

You could test this theory by running in the simulator, then causing it to generate a low memory warning to see if that makes the view disappear. I don't think this should happen if the view is currently displayed though so make sure some other view is displayed at the time.

Need Your Help

Extending Minibuffer Message for save-buffer

emacs elisp minibuffer

Is it possible the extend the minibuffer message for save-buffer to instead print something like

Can MYSQL support databases with sizes around 4 GB? Will I have any performance issues?

mysql performance

I am planning to have a database of size more than 12 million records all of them in a single table and no other joins etc, used for search, filtered based on field names of the table, approximatel...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.