This file contains 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
typedef NS_ENUM(NSUInteger, SectionHeaderType) { | |
SectionHeaderTypeHeader, | |
SectionHeaderTypeFooter | |
}; | |
/** | |
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { | |
SectionHeader *header = [tableView dequeueReusableHeaderFooterViewWithIdentifier:REUSED_HEADER_ID]; |
This file contains 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
protocol Identifiable { | |
associatedtype Identifier: Equatable | |
var id: Identifier { get } | |
} | |
extension CollectionType where Generator.Element: Identifiable { | |
func indexOf(element: Self.Generator.Element) -> Self.Index? { | |
return self.indexOf { $0.id == element.id } | |
} |
This file contains 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)animateFromPoint:(CGPoint)startPoint toPoint:(CGPoint)endPoint duration:(CGFloat)duration { | |
NSLog(@"------%s-------",__func__); | |
CGFloat r = sqrtf(powf(startPoint.x - endPoint.x, 2) + powf(startPoint.y - endPoint.y, 2)); | |
NSLog(@"r = %f",r); | |
CGFloat SIN = (startPoint.y - endPoint.y) / r; | |
CGFloat COS = (startPoint.x - endPoint.x) / r; | |
NSLog(@"-----------------"); |
This file contains 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)shakenAView:(UIView *)view { | |
CGPoint leftPoint = CGPointMake(view.center.x - 3, view.center.y); | |
CGPoint rightPoint = CGPointMake(view.center.x + 3, view.center.y); | |
CGMutablePathRef path = CGPathCreateMutable(); | |
CGPathMoveToPoint(path, NULL, view.center.x, view.center.y); | |
CGPathAddLineToPoint(path, NULL, leftPoint.x, leftPoint.y); | |
CGPathAddLineToPoint(path, NULL, rightPoint.x, rightPoint.y); | |
CGPathAddLineToPoint(path, NULL, leftPoint.x, rightPoint.y); |