Created
January 26, 2015 13:00
-
-
Save wethu/229d6317dd5b059800c2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| - (void)awakeFromNib { | |
| [super awakeFromNib]; | |
| // tap and call boxTapped | |
| UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(boxTapped:)]; | |
| tap.numberOfTapsRequired = 1; | |
| tap.cancelsTouchesInView = NO; | |
| // Some outlet views i wanna tap on | |
| NSArray *controls = @[self.brandNewBox, self.reprintBox, self.alterExistingBox, self.suppliedBox, self.alterSuppliedBox]; | |
| // Assign tap gesture to all those views | |
| for (UIView *controlView in controls) { | |
| [controlView addGestureRecognizer:tap]; | |
| } | |
| } | |
| - (void)boxTapped:(UITapGestureRecognizer *)sender { | |
| for (CPControlSwitch *aSwitch in sender.view.subviews) { | |
| if ([aSwitch isKindOfClass:[CPControlSwitch class]]) | |
| [aSwitch setOn:!aSwitch.on animated:YES]; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment