Force UIButton to redraw itself

Discussion in 'iOS Programming' started by almostPro, Jun 27, 2010.

  1. almostPro macrumors newbie

    Joined:
    Jun 27, 2010
    #1
    Hi, I have a little problem and I would be gratefull if someone could help me. I got 5 UIButtons placed next to each other and what I wanna do is set image on first button, redraw it so it, wait for 1 second, then set some other image on second button, redraw second button and so on.
    I tried to set image on button, then call function sleep(1) and so on but it just freezes application for 5 seconds and then redraws all 5 buttons at the same time.

    Thanks in advance for any suggestion.
     
  2. dejo Moderator

    dejo

    Staff Member

    Joined:
    Sep 2, 2004
    Location:
    The Centennial State
    #2
    Wirelessly posted (Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_0 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8A293 Safari/6531.22.7)

    I would probably look into using an NSTimer.
     
  3. robbieduncan Moderator emeritus

    robbieduncan

    Joined:
    Jul 24, 2002
    Location:
    London
  4. ritsard macrumors regular

    ritsard

    Joined:
    Jun 18, 2009
    Location:
    SF Bay Area, CA
    #4
    You can look into using this performSelector:withObject:afterDelay:
     
  5. almostPro thread starter macrumors newbie

    Joined:
    Jun 27, 2010
    #5
    Thanks all for replays, performSelector:withObject:afterDelay: works perfect...
     

Share This Page