How to Redraw View after UIActionSheet

Discussion in 'iPhone/iPad Programming' started by belsokar, Aug 4, 2008.

  1. macrumors member

    Joined:
    Jul 21, 2005
    #1
    So I currently am using a UIViewController to manage a view.

    On that view, I have a button that opens up a UIActionSheet.

    After setting that Action sheet, I have some code in my ViewWillAppear method that doesn't get called on a UIActionSheet close.

    I have figured out how to reload a tableview, but for some reason, there doesn't seem to be something similar for a standard view. I basically want to refresh the view so it calls out the ViewWillAppear code segment on my page.

    thanks!
     
  2. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #2
    Use the UIActionSheet delegate methods to determine when the alert has dismissed, and then you can update a view via the setNeedsDisplay method (or just call viewWillAppear manually).
     
  3. thread starter macrumors member

    Joined:
    Jul 21, 2005
    #3
    Thanks, I didn't catch those actionSheet delegates the first time.

    So I setup the following action sheet delegate:

    didDismissWithButtonIndex:

    and that delegate is successfully called, and I tried the following:

    [self.view setNeedsDisplay];

    However, that doesn't seem to force a re-display, as I would expect my viewWillAppear to be called, and it isn't.

    Any ideas? I haven't tried calling viewWillAppear manually, but I will try that as well I suppose.
     
  4. Moderator emeritus

    kainjow

    Joined:
    Jun 15, 2000
    #4
    Well, what's actually changing that needs redisplaying? What are you expecting it to do?
     
  5. thread starter macrumors member

    Joined:
    Jul 21, 2005
    #5
    I have a dual mode button. In state 1, the name of the button is "Button 1" for example. When I press the button the first time, it displays the UIActionSheet. Depending on the selection within the ActionSheet, I then change the state of the button to to state 2, with new text "Button 2".

    If I navigate away from the view and back, it is fine because I declare the title text for the button in the ViewWillAppear method. Upon exiting the action sheet however, I am just trying to force the view to redraw/reload so that the new button state is reflected.

    thanks!
     
  6. macrumors newbie

    Joined:
    Oct 8, 2008
    #6
    How to Redraw View after UIActionSheet

    I'm looking to do the same thing, I've got a view that I want a user to click to reveal something underneath it. After about 2 seconds I want it to switch back to what it was, but I don't want to stop the users from doing other things in the mean time. And I want them to see an animation when they click it, and when it shifts back.

    I've got the NSTimer set up to handle the switch back, and the method is firing correctly after 2 seconds. But the UI doesn't update. I need some way of forcing the UI to redraw itself, or forcing it to update when the 2 seconds are done.

    Help?
     

Share This Page