Searching for the Right Pattern (iPhone/Objective C) -
Edit: I was suggested that I apply strategy pattern (), which I think I do this so that many Objects implementing a representative protocol in Objective-C, it fulfills the encapsulation required by me, while still allowing me to have a Generic View Controller in memory.
I have a section called Expansion Discreet Controller that displays information about different types of data - waypoint, trails, maps, photos.
Right now, this class is 1400 lines long and there are some dirty switch statements in it: For example:
- (zero) ChangesTimeview {ID Sender {if (self. Track) {[Self-transformed Trinimaview: [Sender selected Segment index]]; } And if (self. Waypoint) {[Self-changePininiView: [Sender selected partition]] ;; } Else if (self.photo) {[Self Change PhotoMiniView: [Sender Selected SegeIndex]]; } And if (selfmap) {[Self changemaymewviewview: [sender selected Segment indies]]; }}
If I create the sub-sections of the DetailViewController, but my puzzle is to keep the ViewController in memory and just change some elements, so I can be crisp Changes, especially on 3G phones.
I think if I want to clean my code, then I have to hit a display.
Look at the current view in a field in your object (instead of a field for each type of mini-device ), And implement the changemineview for each of them.
Then your method will look like this:
- (zero) change menu: (ID) Sender {[self.currentMiniViewChurningviewview: [sender selected SEEgeIndex]]; }
Comments
Post a Comment