Last active
June 9, 2016 09:59
-
-
Save zh-se/344722ecc19e3e2b6d44 to your computer and use it in GitHub Desktop.
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
diafter - dispatch after | |
@weakify(self); | |
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, $DELAY$ * NSEC_PER_SEC), dispatch_get_main_queue(), ^{ | |
@strongify(self); | |
NSLog(@"dispatch after"); | |
$END$ | |
}); | |
dthread - dispatch in a new thread | |
@weakify(self); | |
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ | |
@strongify(self); | |
$END$ | |
}); | |
dtmain | |
@weakify(self); | |
dispatch_async(dispatch_get_main_queue(), ^{ | |
@strongify(self); | |
$END$ | |
}); | |
donce - dispatch once | |
static dispatch_once_t onceToken; | |
@weakify(self); | |
dispatch_once(&onceToken, ^{ | |
@strongify(self); | |
$END$ | |
}); | |
table_view_delegate - implement table view delegate and data source | |
#pragma mark UITableView delegate and source | |
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { | |
return $ROW_HEIGHT$; | |
} | |
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section { | |
return $FOOTER_HEIGHT$; | |
} | |
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { | |
return $HEADER_HEIGHT$; | |
} | |
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { | |
return $NUMBER_OF_SECTIONS$; | |
} | |
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { | |
return $NUMBER_OF_CELLS$; | |
} | |
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { | |
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"$CELL_REUSE_ID$"]; | |
return cell; | |
} | |
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { | |
[self configureCell:cell atIndexPath:indexPath]; | |
} | |
- (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)path { | |
//TODO implement cell configuration | |
} | |
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section { | |
//TODO return footer view if need | |
return nil; | |
} | |
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { | |
//TODO return header view if need | |
return nil; | |
} | |
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { | |
//TODO implement selectection action | |
} | |
#pragma mark ---------------------------------------------------------------------------------------------------------- | |
block_local_var | |
returnType (^blockName)(parameterTypes) = ^returnType(parameters) {...}; | |
block_prop | |
@property (nonatomic, copy, nullability) returnType (^blockName)(parameterTypes); | |
block_meth_param | |
block:(returnType (^nullability)(parameterTypes))blockName | |
block_typedef | |
typedef returnType (^TypeName)(parameterTypes); | |
TypeName blockName = ^returnType(parameters) {...}; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment