Reputation: 4061
If the user gets impatient and touches this button before the next view can load, I get nested view issues, why isn't this working? I assumed that turning the button BOOL enabled to no would fix it, but it doesn't.
-(IBAction)start:(id)sender
{
startButton.enabled = NO;
[activity startAnimating];
[locationManager stopUpdatingLocation];
ViewController *view = [[ViewController alloc]init];
NSManagedObjectContext *context = [self managedObjectContext];
view.managedObjectContext = context;
[self.navigationController pushViewController:view animated:YES];
}
Upvotes: 3
Views: 134
Reputation: 112855
That OP code should work. Ensure startButton is the correct button and connected in IB.
If the action is caused by the button you want to disable then self.enabled = NO;
is more direct.
Upvotes: 1
Reputation: 3045
Have the entire thing inside an if statement.
-(IBAction)start:(id)sender
{
if(variable == TRUE){
[activity startAnimating];
[locationManager stopUpdatingLocation];
ViewController *view = [[ViewController alloc]init];
NSManagedObjectContext *context = [self managedObjectContext];
view.managedObjectContext = context;
[self.navigationController pushViewController:view animated:YES];
}
}
And set your variable = to TRUE or FALSE whenever you need to.
Upvotes: 0