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
| - (IBAction)buttonPressed:(id)sender { | |
| if (timer == nil) { | |
| seconds = 30; | |
| timer = [[NSTimer scheduledTimerWithTimeInterval:1.0 | |
| target:self | |
| selector:@selector(updateCounter:) | |
| userInfo:nil | |
| repeats:YES] retain]; | |
| } | |
| } |
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
| // Version 1 | |
| [[self.scrollView subviews] enumerateObjectsUsingBlock:^(UIView *obj, NSUInteger idx, BOOL *stop) { | |
| [UIView animateWithDuration:0.25 animations:^{ | |
| obj.alpha = 0.0; | |
| } completion:^(BOOL finished) { | |
| [obj removeFromSuperview]; | |
| }]; | |
| }]; | |
| // Version 2 |
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
| [[self.scrollView subviews] enumerateObjectsUsingBlock:^(UIView *obj, NSUInteger idx, BOOL *stop) { | |
| [UIView animateWithDuration:0.25 animations:^{ | |
| obj.alpha = 0.0; | |
| } completion:^(BOOL finished) { | |
| [obj removeFromSuperview]; | |
| }]; | |
| }]; |
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
| // Use debugLog() or debugLogPretty() to log messages to the console when the "Debug" configuration | |
| // is used to build the project - these logging messages won't appear in a Release build. | |
| // | |
| // Use assertLog() for more serious conditions. On Debug builds, assertLog() will throw an assertion | |
| // and on Release builds it will turn into a standard NSLog (in case it comes to digging through a user's | |
| // device logs to fix something) | |
| #ifdef DEBUG | |
| #define _D(...) __VA_ARGS__ | |
| #define debugLog(fmt, ...) NSLog(fmt, ##__VA_ARGS__) | |
| #define debugLogPretty(fmt, ...) NSLog(@"%s (%@:%d)\n%@", \ |
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
| CATransition *transition = [CATransition animation]; | |
| transition.duration = 0.25f; | |
| transition.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; | |
| transition.type = kCATransitionFade; | |
| [button.layer addAnimation:transition forKey:nil]; |
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)initialize { | |
| if (self == [AppDataBase class]) { | |
| void (^dateAccessorFactory)(NSString*,NSString*) = ^(NSString *key, NSString *strKey) { | |
| void(^setterBlock)(id,NSDate*) = [^void(id self, NSDate *val) { | |
| [self willChangeValueForKey:key]; | |
| [self setPrimitiveValue:val forKey:key]; | |
| [self setPrimitiveValue:nil forKey:strKey]; | |
| [self didChangeValueForKey:key]; | |
| } copy]; | |
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
| // Works | |
| if (self.currentScope == 1) { | |
| cell.contentViewInsets = UIEdgeInsetsMake(0, 0, 0, 2); | |
| } else { | |
| cell.contentViewInsets = UIEdgeInsetsZero; | |
| } | |
| // Works | |
| UIEdgeInsets inset = (self.currentScope == 1) ? UIEdgeInsetsMake(0, 0, 0, 2) : UIEdgeInsetsZero; | |
| cell.contentViewInsets = inset; |
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
| - (UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath { | |
| UITableViewCell *cell = nil; | |
| if ([indexPath isEqual:[tableView indexPathForSelectedRow]]) { | |
| cell = [tableView dequeueReusableCellWithIdentifier:@"SelectedCell"]; | |
| if (!cell) { | |
| cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"SelectedCell"] autorelease]; | |
| // Do any one-time setup for the cell here, like creating subviews you want to add to the cell | |
| UIView *specialSelectedView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 20, 20)]; | |
| specialSelectedView.backgroundColor = [UIColor redColor]; |
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
| - (UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath { | |
| UITableViewCell *cell = nil; | |
| if ([indexPath isEqual:[tableView indexPathForSelectedRow]]) { | |
| cell = [tableView dequeueReusableCellWithIdentifier:@"SelectedCell"]; | |
| if (!cell) { | |
| cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"SelectedCell"] autorelease]; | |
| // Do any one-time setup for the cell here, like creating subviews you want to add to the cell | |
| UIView *specialSelectedView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 20, 20)]; | |
| specialSelectedView.backgroundColor = [UIColor redColor]; |
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
| indent_align_string=false | |
| indent_braces=false | |
| indent_braces_no_func=false | |
| indent_brace_parent=false | |
| indent_namespace=false | |
| indent_extern=false | |
| indent_class=false | |
| indent_class_colon=false | |
| indent_else_if=false | |
| indent_func_call_param=false |