Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: f811900c67
Fetching contributors…

Cannot retrieve contributors at this time

32 lines (26 sloc) 0.941 kb
//
// UIControl+SSToolkitAdditions.m
// SSToolkit
//
// Created by Sam Soffes on 4/19/10.
// Copyright 2010-2011 Sam Soffes. All rights reserved.
//
#import "UIControl+SSToolkitAdditions.h"
@implementation UIControl (SSToolkitAdditions)
- (void)removeAllTargets {
[[self allTargets] enumerateObjectsUsingBlock:^(id object, BOOL *stop) {
[self removeTarget:object action:NULL forControlEvents:UIControlEventAllEvents];
}];
}
- (void)setTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents
{
NSSet *targets = [self allTargets];
for (id currentTarget in targets) {
NSArray *actions = [self actionsForTarget:currentTarget forControlEvent:controlEvents];
for (NSString *currentAction in actions) {
[self removeTarget:currentTarget action:NSSelectorFromString(currentAction) forControlEvents:controlEvents];
}
}
[self addTarget:target action:action forControlEvents:controlEvents];
}
@end
Jump to Line
Something went wrong with that request. Please try again.