I have created a unbutton programatically and made an action
{
UIButton *myButton1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
myButton1.frame = CGRectMake(20, 20, 80, 44);
[myButton1 setTitle:@"Click Me!" forState:UIControlStateNormal];
[myButton1 addTarget:self action:@selector(buttonClicked:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:myButton1];
}
和在《国际反种族歧视公约》中,我有《国际反种族歧视公约》的一般性意见。
- (IBAction)buttonClicked:(id)sender
{
CGRect myFrame = CGRectMake(0, 300, 100, 50);
UIView *myView = [[UIView alloc] initWithFrame:myFrame];
myView.backgroundColor = [UIColor lightGrayColor];
[self.view addSubview:myView];
[myView release];
}
现在想要的是,当用户第二次报道我的Button1时,必须消失。 如何做到这一点?