Two sets of controls on same UIView

Discussion in 'iOS Programming' started by arnieterm, Sep 1, 2008.

  1. arnieterm macrumors regular

    Aug 28, 2008
    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??
  2. Jeremy1026 macrumors 68020


    Nov 3, 2007
    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.

    newControl.hidden = NO;
    oldControl.hidden = YES;
  3. arnieterm thread starter macrumors regular

    Aug 28, 2008
    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
  4. mccannmarc macrumors 6502


    Aug 15, 2008
    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.

Share This Page