i think flag is a BOOL variable so in viewDidLoad
set flag=NO
; and define ImageView Variable UIImageView *shadowView;
in to .h file property and synthesize in .m class then in to your IBAction Method set like:-
- (IBAction)alerthelp:(id)sender {
if (!flag)
{
shadowView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 440)];
shadowView.image = [UIImage imageNamed:@"helphome.png"];
shadowView.opaque = YES;
shadowView.alpha = 0.8;
shadowView.backgroundColor = [UIColor lightGrayColor];
[self.view addSubview:shadowView];
flag=YES;
}
else
{
shadowView.hidden=YES;
flag=NO;
}
}