user1162034
user1162034

Reputation: 71

How to set button Action Nil

I am new in objective-c , i am working on ipad application in which i want to nil a button action. i want action to be performed only one time and after performing action button's action should be nil. I am writing code on button Action:

#pragma mark AddCollectors Button Action here

-(void)addCollectors:(id)sender {
    [addCollectors actionsForTarget:nil forControlEvent:UIControlStateNormal];
    myTableView.hidden = YES;
    myTableViewForAddCollectors.hidden = NO;
    [self addTableViewForAddCollectors];
    addCollectors = nil;
}

means after adding the tableview button action should be nil.

Upvotes: 2

Views: 261

Answers (1)

Jorge Cohen
Jorge Cohen

Reputation: 1522

use this method

- (void)removeTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents

from the documentation:

Removes a target and action for a particular event (or events) from an internal dispatch table.

Upvotes: 7

Related Questions