Can i pass the parameter to clickedButtonAtIndex that is iphone method?
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
....
}
I'm developing iphone app by Xcode.
When i click the button of UIAlertView, I have to modify some local vari开发者_运维知识库ables in that method.
I want to control some local variables in that method.
So is there the way to pass the variables as parameter ?
No you cannot pass anything else to that method, but if you are going to modify local variables then what is the point?, if you want to use some information on that method you will have to set that information in an instance variable.
So for example before showing your AlertView something like this:
self.myInstanceVariable = valueIWillNeedWhenClicked;
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Title" message:@"Message" delegate:self cancelButtonTitle:@"NO" otherButtonTitles:@"YES", nil];
alertView.delegate = self;
[alertView show];
[alertView release];
Then on method:
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSString *valueINeed = self.myInstanceVariable
}
精彩评论