I have been developing a concept lately in which I thought I got all of the kinks worked out, but it looks like I am having some issues. Basically in my iOS application I have a model that holds all of the data for my application and in that model I have a UIModel that inherits from my model where I build out all of my UI elements that are to be used throughout my application in many different places. For example if I have a core set of UIImages, UILabels, and UIViews that are used throughout all of my UIViewControllers, then in my UIViewController I add the views defined in my UIModel to the local stack. Now I know what you must be thinking at this point, what in the world am I not using Storyboards or nibs to perform this work instead of creating a set of model object, right? Well, to answer any concerns to this questions, I am using this design pattern in places where the layout was too complex to create reusable nib or Storyboard files. In some cases there are many many different states to the same ViewController and that is why I am doing this. And this design pattern works really nice if you are just navigating forward through the stack, but if you start navigating going back and forth between view controllers I have noticed that you start seeing some inconsistencies in the way things are displayed in the ViewController. Possible memory bug, not sure? As an example, a logo will be displayed on the ViewController when you move forward through the stack, but then when I move back into that view controller again, the UIImageView for that logo will persist but the UIImage assigned to the that UIImageView does not display. Weird?
Has anyone ever experienced anything like this? Has anyone ever tried something like this and it sounds like I am just possibly doing this wrong? I would like to hear anyone's opinion. The code is as you would expect, I have a model that is used throughout all of my ViewControllers and then my UIModel inherits from my model so I can reference my UIModel to add views to the local view controller stacks. Let me know if anyone is interested and I can post some snippets. Thanks!
Comments
OBJECTIVE-C, CREATE A UI MODEL FOR REPETITIVE LAYOUT PATTERNS |
Very nice article. I certainly love this site. Stick with it!