Trouble bringing subview to front

Discussion in 'iOS Programming' started by EducationApp, Sep 9, 2011.

  1. EducationApp, Sep 9, 2011
    Last edited by a moderator: Sep 11, 2011

    EducationApp macrumors newbie

    Joined:
    Aug 17, 2011
    #1
    I am making a drawing app with about 10 UIButtons that must be on top of the drawing.

    Would it go something like:
    Code:
    [(redbutton) bringSubviewToFront:redbutton];
    or just try to send the background back with something like this?
    Code:
    [(self.view) sendSubviewToBack:self.view];
    But neither of them work.
    I'm having trouble with this and it is the last step in my app.
     
  2. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #2
    You tell the superview to bring the subview to the front.

    If the code is going in your view controller, then it should look like:
    Code:
    [self.view bringSubviewToFront:redButton];
     
  3. EducationApp thread starter macrumors newbie

    Joined:
    Aug 17, 2011
    #3
    My code is not in my view controller, could this be the problem. It is under Image.h
     
  4. ArtOfWarfare macrumors 604

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #4
    Then put it in your view controller.
     
  5. jnoxx macrumors 65816

    jnoxx

    Joined:
    Dec 29, 2010
    Location:
    Aartselaar // Antwerp // Belgium
    #5
    Or send your parent controller, which you are sending the call with to your image.h as a parameter.
    and then add it to that view, not sure if that would work out. but you can try :)
     

Share This Page