-(void)buPressed{
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:@"Game Over"
message:@"YOU LOST! ALL YOUR BASE ARE BELONG TO US!"
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"Publish", nil];
[alertView show];
[alertView release];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if(buttonIndex==0){
NSLog(@"%d",buttonIndex);
}
else{
[self bPressed];
}
}
-(void)bPressed{
ModalViewConroller *yeniSayfa=[[ModalViewConroller alloc] init];
yeniSayfa.modalTransitionStyle=UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:yeniSayfa animated:YES];
[yeniSayfa release];
//Restore to Defaults
[button_1 setSelected:NO];
[button_2 setSelected:NO];
[button_3 setSelected:NO];
[button_4 setSelected:NO];
[button_5 setSelected:NO];
[button_6 setSelected:NO];
slider.value=50.00;
UIImage *image = [UIImage imageNamed:@"Smiley_00025.png"];
imageView = [[UIImageView alloc] initWithImage:image];
imageView.frame = CGRectMake(81, 43, image.size.width, image.size.height);
[self.view addSubview:imageView];
}
这是我的代码我想让发布按钮调用bPressed函数但它发出警告并且当我触摸发布按钮时程序崩溃我想打开模态视图当我按下发布按钮时任何人都可以帮助我?
答案 0 :(得分:1)
您需要在头文件中声明该函数,以便其他对象(在本例中为UIAlertView的实例,因为其委托设置为您的类)知道此方法存在。
因此,在您的whatever_class.h文件中,在@interface{ }
下方添加以下行:
-(void)bPressed;