How can I show a UIAlert straight after cell selection & end it after the new UIView is shown?

The way I personally would go about this would be to first assign an alert in the header file.

The way I personally would go about this would be to first assign an alert in the header file: UIAlertView *alert; then create and present the alert in the tableView:didSelectRowAtIndexPath: method. Alert = UIAlertView alloc init....; alert show; // start the loading process for your data to push to the next view Then to dismiss the view, simply do so in your viewWillDisappear:animated: method with a call like the following: alert dismissWithClickedButtonIndex:0 animated:YES; This should ensure that the alert is dismissed before the next view is presented. I hope this helps.

If you have any questions, I'd be happy to describe in more detail EDIT: in order to dismiss the alert from a different view, you will have to create a method where you create the alert to dismiss it, import the header into the view which it is pushing to, find the parent view from the child, then dismiss when you want. I will explain in detail below. So first, create a method to dismiss the view from the parent, which I will just refer to as Parent - (void)dismissAlert { alert dismissAlertWithClickedButtonIndex:0 animated:YES; } In the view which you push to, be sure to put #import "Parent.

H" at the top of the implementation file. Now it's just a matter of finding the view and calling the method. You can change where this is called, but for example purposes, I'm just going to start a timer in the viewDidAppear: method in the Child file and go from there.

- (void)viewDidAppear:(BOOL)animated { NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(dismiss) userInfo:nil repeats:NO; } Then create the dismiss method - (void)dismiss { // find the Parent view, which is most likely the top view in the navigation stack // self. ParentViewController will be the navigationController // calling childViewControllers gets the navigation stack, so we get the view from there (Parent *)self. ParentViewController childViewControllers objectAtIndex:0 dismissAlert; } I have tested this and it does work, so hopefully it does the trick for you.

You can change the time interval to your pleasing. Considering I don't know the heirarchy of your app, it's hard to say where the Parent view is located with respect to the Child, but you can play around to find it if the above isn't it.

Ie to maximize the coverage of the message. Or it this not possible? – Greg Oct 25 at 21:50 Sorry, I misunderstood.

But yes, that's still possible. Presenting an alert will continue to stay after passing views.As for dismissing it, it gets a bit tricky. I will modify the original answer – slev Oct 25 at 22:31.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions