我是新的目标c我有一张图片,当我点击它时我想显示一些警报消息添加了这样的图片-
AHolder = [[UIImageView alloc] initWithFrame:CGRectMake(5, 80, 40, 40)];
UIImage *imageA = [UIImage imageNamed:@"A.png"];
AHolder.image = imageA;
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(aPressed:) name:@"aPressed" object:nil];
[view addSubview:AHolder]
它的事件是这样的——
-(IBAction)aPressed:(id)sender
{
UIAlertView *alert=[[UIAlertView alloc]initWithTitle:@"hello" message:@"a pressed" delegate:self cancelButtonTitle:@"cancle" otherButtonTitles:@"ok",nil];
[alert show];
[alert release];
}
它没有给我任何错误,但是当我单击图像时也没有任何反应。请建议我任何解决方案。