Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

arnieterm

macrumors regular
Original poster
Aug 28, 2008
201
0
Hi
I have a UIView and 3 sets of controls that are to be shown on the same view (UIView).
Initially when the view is made visible, the first set of controls appears on it. By clicking a button on this set, I have to clear the first set of controls and add 2nd set of controls. Similar steps are needed for the 3rd set.
How can I clear the first set of controls and show 2nd one?
Using the property clearsContextBeforeDrawing[Yes/No] is not working for the view. Since it is the strict requirement from the client so I was left with no option but to use a single view and show all sets of controls there on
Any idea??
 

Jeremy1026

macrumors 68020
Nov 3, 2007
2,215
1,029
Hi
I have a UIView and 3 sets of controls that are to be shown on the same view (UIView).
Initially when the view is made visible, the first set of controls appears on it. By clicking a button on this set, I have to clear the first set of controls and add 2nd set of controls. Similar steps are needed for the 3rd set.
How can I clear the first set of controls and show 2nd one?
Using the property clearsContextBeforeDrawing[Yes/No] is not working for the view. Since it is the strict requirement from the client so I was left with no option but to use a single view and show all sets of controls there on
Any idea??

What are the controls? You can try having stuff you're not using hidden, then hide the stuff you no longer need and unhide the stuff you do need in order to 'change' views.

Code:
newControl.hidden = NO;
oldControl.hidden = YES;
 

arnieterm

macrumors regular
Original poster
Aug 28, 2008
201
0
By control set I mean to say labels, textfields, buttons.
I also make use of clearsContextbeforeDrawing property of the UIView but it is not working
 

mccannmarc

macrumors 6502
Aug 15, 2008
270
0
Manchester, UK
To be honest your client sounds like an idiot, why would anyone limit the amount of views you can use and hence make your job ten times harder???

Anyway it might be a stupid solution i dont know, but why dont you use a state machine? have 3 states for your app and render the current view based on the state. If speed isn't critical you could have a timer that checks a global state variable say twice a second and if the state has changed it forces a redraw using the new state's drawing code.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.