Two sets of controls on same UIView

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

  1. macrumors regular

    Joined:
    Aug 28, 2008
    #1
    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??
     
  2. macrumors 68000

    Joined:
    Nov 3, 2007
    #2
    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;
     
  3. thread starter macrumors regular

    Joined:
    Aug 28, 2008
    #3
    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. macrumors 6502

    mccannmarc

    Joined:
    Aug 15, 2008
    Location:
    Manchester, UK
    #4
    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