Question: I created some buttons in my code. I want to set it disable but I'm not sure how. here's my code.

```
UIButton *btn_levels = [UIButton    buttonWithType:UIButtonTypeRoundedRect];
btn_levels.frame=CGRectMake(x-10, y, 40, 40);
[btn_levels setTitle:[beginer_lvl objectAtIndex:i] forState:UIControlStateNormal];
[btn_levels addTarget:self action:@selector(btn_Method) forControlEvents:UIControlEventTouchUpInside];
btn_levels.tag =i;

btn_levels.backgroundColor=[UIColor blackColor];
btn_levels.tintColor=[UIColor cyanColor];

NSLog(@"btn nm=%@",[beginer_lvl objectAtIndex:i]);

[self.scroll addSubview:btn_levels];

```

and that is the button method but I don't know what to do...

```
-(void)btn_Method
{
    //to make button disable
}

```

Answer: 
Modify this line

```
[btn_levels addTarget:self action:@selector(btn_Method:) forControlEvents:UIControlEventTouchUpInside];

```

and this method

```
-(void)btn_Method:(UIButton*)sender
{
  sender.enabled = NO;
}

```
disabled but visible 

```
btn_levels.enabled = NO;

```

also invisible

```
btn_levels.hidden = YES;

```