Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

belsokar

macrumors member
Original poster
Jul 21, 2005
80
43
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!
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
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).
 

belsokar

macrumors member
Original poster
Jul 21, 2005
80
43
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.
 

kainjow

Moderator emeritus
Jun 15, 2000
7,958
7
Well, what's actually changing that needs redisplaying? What are you expecting it to do?
 

belsokar

macrumors member
Original poster
Jul 21, 2005
80
43
Well, what's actually changing that needs redisplaying? What are you expecting it to do?

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!
 

dekelver

macrumors newbie
Oct 8, 2008
3
0
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?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.