Search code examples
iosobjective-cuibuttonibaction

How to Disable IBAction Button, that is on subView


i have an IBAction button that is connected through connection inspector properly…

in '.h'

- (IBAction)Download;

also have a same name method in my '.m'

- (void) Download
{
// Code for data download   
}

when i pressed button its working perfectly fine for data download…

my problem is if user have limited support then they can't download the data… and obviously the the Download IBAction Button disabled… and yes this Button is on subView.

what should i do for this issue… ???


Solution

  • What i found useful is:

    make IBOutlet Connection in ViewController's interface for the required button in storyboard.

    IBOutlet UIButton *actionButton;
    

    Now if you want to disable it.

    actionButton.userInteractionEnabled = NO; 
    

    if you want to make it enable again

    actionButton.userInteractionEnabled = YES;