Например,
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];
[button addTarget:self
action:@selector(closeAd:)
forControlEvents:UIControlEventTouchUpInside];
[button setTitle:@"Close" forState:UIControlStateNormal];
button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0);
[view addSubview:button];
Затем поместите любой код в метод
-(void)closeAd:(id)sender;