Question

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… ???

Was it helpful?

Solution 4

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; 

OTHER TIPS

Use

yourbtn.enabled = NO;

to disable your button and when you want to enable use

yourbtn.enabled = YES;

create IBoutlet of the button through interface builder and set button's userinteractionenabled to NO.

In your download button action, do this

if(condition)
{
  //code to download
}
else
{
  [self.downloadButton setuserinteractionenabled : NO];
}

try this, if you don't need to re-activate the button. If you need to re-activate you'll need to have an IBOutlet.

in your .h

- (IBAction)Download:(UIButton *)sender;

in your .m

   - (IBAction) Download:(UIButton *)sender {
      if (test not ok) {    
        sender.enabled = NO;
      } else {
        perform download....
      }
    }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top