当用户点击"是"我想称之为IBAction在UIAlertView
,我有:
- (void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if (alertView.tag == 12) {
if (buttonIndex == 1) {
// How can I post IBAction here ???
[self performSegueWithIdentifier:@"segue_to_call" sender:self];
}
}
}
有什么想法吗?
答案 0 :(得分:1)
假设您的IBAction
方法是:
-(IBAction) sliderValue:(id)sender
{
// SOME CODE
}
你可以这样调用这个方法
-(void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if(alertView.tag == 200){
if (buttonIndex==1) {
[self sliderValue:nil]; //Here is your IBAction Method
[self performSegueWithIdentifier:@"segue_to_call" sender:self];
}
}
}
答案 1 :(得分:0)
使用此
-(void) alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if (alertView.tag == 12) {
if (buttonIndex == 1) {
[self methodName:nil];
}
}
}
-IBAction) methodName {
NSLog(@"Method run in this");
}