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
NSLayoutConstraint *constraint = [NSLayoutConstraint constraintWithItem:self.view1 | |
attribute:NSLayoutAttributeRight | |
relatedBy:NSLayoutRelationEqual | |
toItem:self.view2 | |
attribute:NSLayoutAttributeLeft | |
multiplier:1 | |
constant:0]; |
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
- (NSURL *)hitListURLWithTaskTitle:(NSString *)title { | |
// Basic URL as a starting point | |
NSURLComponents *components = [NSURLComponents componentsWithString:@"thehitlist:///inbox/tasks"]; | |
components.queryItems = @[ | |
[NSURLQueryItem queryItemWithName:@"method" value:@"POST"], | |
[NSURLQueryItem queryItemWithName:@"title" value:title] | |
]; | |
// NSURLQueryItem has encoded any spaces as %20 which is fine |
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
NSURLComponents *components = [NSURLComponents componentsWithString:input]; | |
// Re-encode + symbols so NSURLQueryItem recognises them as spaces | |
components.percentEncodedQuery = [components.percentEncodedQuery | |
stringByReplacingOccurrencesOfString:@"+" | |
withString:@"%20"]; | |
NSArray *items = components.queryItems; | |
// Enumerate and handle the items |
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
NSDataDetector *detector = [NSDataDetector | |
dataDetectorWithTypes:NSTextCheckingTypeDate | |
error:NULL]; | |
NSTextCheckingResult *result = [detector | |
firstMatchInString:string | |
options:0 | |
range:NSMakeRange(0, string.length)]; | |
return result.date; |
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)encodeRestorableStateWithCoder:(NSCoder *)coder { | |
[super encodeRestorableStateWithCoder:coder]; | |
[coder encodeObject:self.firstViewController forKey:@"viewController1"]; | |
[coder encodeObject:self.secondViewController forKey:@"viewController2"]; | |
} | |
- (void)decodeRestorableStateWithCoder:(NSCoder *)coder { | |
[super decodeRestorableStateWithCoder:coder]; | |
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)encodeRestorableStateWithCoder:(NSCoder *)coder { | |
[super encodeRestorableStateWithCoder:coder]; | |
[coder encodeInteger:self.mode forKey:@"mode"]; | |
} | |
- (void)decodeRestorableStateWithCoder:(NSCoder *)coder { | |
[super decodeRestorableStateWithCoder:coder]; | |
self.mode = [coder decodeIntegerForKey:@"mode"]; | |
} |
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)encodeRestorableStateWithCoder:(NSCoder *)coder { | |
[super encodeRestorableStateWithCoder:coder]; | |
[coder encodeObject:self.contentViewController | |
forKey:@"contentViewController"]; | |
} |
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)viewWillAppear:(BOOL)animated | |
{ | |
[super viewWillAppear:animated]; | |
NSIndexPath *selectedRowIndexPath = [self.tableView indexPathForSelectedRow]; | |
if (selectedRowIndexPath) { | |
[self.transitionCoordination animateAlongsideTransitionInView:self.tableView animation:^(id<UIViewControllerTransitionCoordinatorContext> context) { | |
[self.tableView deselectRowAtIndexPath:selectedRowIndexPath animated:YES]; | |
} completion:^(id<UIViewControllerTransitionCoordinatorContext> context) { |
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
@interface MyTableViewCell | |
@property(nonatomic, copy) void (^checkboxHandler)(void); | |
@end |
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
@implementation MyTableViewCell | |
- (IBAction)checkboxPressed:(UIButton *)checkbox { | |
// Send onwards up the responder chain | |
id target = [self targetForAction:@selector(cellCheckboxPressed:) | |
withSender:self]; | |
[target performSelector:@selector(cellCheckboxPressed:) | |
withObject:self]; | |
} |