UIAlertView is not displayed. What am I doing wrong?

Here is the code:

-(IBAction)signUpBtnPressed:(id)sender
{

 UIAlertView *alert = [
        [UIAlertView alloc]
        initWithTitle:@"k"
        message:@"Thanks for Signing up!"
        delegate:nil
        cancelButtonTitle:@"Continue..."
        otherButtonTitles:nil
        ];
 [alert show];
 [alert release];
}

      

I also have a Register button attached to this activity in my view.

+2


a source to share


7 replies


I would check that all connections are made in IB if you are using IB to create the UI. Specifically, check to see if UIButton

your interface has the XIB that should call the signUpBtnPressed:(id)sender

associated Touch Up Inside method and that the "file owner" of the XIB is set as the view controller that this method is in.



+1


a source


You cannot free an object before displaying it !!!



Save it as an instance variable and release it later.

+1


a source


Set the delegate to zero.

0


a source


Set a breakpoint where you call [warning] to make sure your code gets called

I am assuming this method is not called at all. You probably missed the connection in the interface builder

0


a source


You can print something or try to set breakpoints. If it doesn't print anything or stops at a breakpoint. I firmly believe this method is never called

0


a source


Call it after 0.1 s delay [self performSelector: @selector (signUpBtnPressed :) withObject: nil afterDelay: 0.10];

Hope this solves your problem.

0


a source


install the delegate yourself. Hope this solves your problem.

0


a source







All Articles