Reputation: 1
I am new to iphone.I created a UIButton programmatically,which is used to exit from subView to PreviousView. For this, I written code as follows:
-(IBAction)button99:(id)sender
{
[myview1 removeFromSuperview];
}
But the above event is not fired.What can i do for this? Can any one suggest me proper code.
Thanks in Advance.
Upvotes: 0
Views: 2630
Reputation: 2742
To use the button with (IBAction)
you should use Interface Builder to link that method to the actual button. If you link that to the button the method will be fired.
Be sure to declare the IBAction in the .h file also..
And indeed Simon is correct when you wish to do it programmatically..!
Upvotes: 0
Reputation: 51374
Add this to your code,
[yourButton addTarget:self action:@selector(button99:) forControlEvents:UIControlEventTouchUpInside];
Upvotes: 3