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
NSMutableOrderedSet *set = [NSMutableOrderedSet orderedSetWithArray:array1]; | |
[set addObjectsFromArray:array2]; | |
array3 = [set sortedArrayUsingComparator:^(NSString *obj1, NSString *obj2) { | |
return [obj1 compare:obj2]; | |
}]; |
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
UITextPosition *newPos = [textField positionFromPosition:textField.beginningOfDocument offset:0]; | |
textField.selectedTextRange = [textField textRangeFromPosition:newPos toPosition:newPos]; | |
[textField setNeedsLayout]; |
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
- (BOOL)isModal | |
{ | |
return (self == [self.navigationController.viewControllers objectAtIndex: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
- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset | |
{ | |
UITableView *tableView = (UITableView *)scrollView; | |
int n = tableView.frame.size.height / _cellHeight; | |
if ((int)tableView.frame.size.height % (int)_cellHeight) n++; | |
for (int i = 0; i <= n; i++) { | |
NSIndexPath *indexPath = [tableView indexPathForRowAtPoint:CGPointMake(0, targetContentOffset->y + i * _cellHeight)]; |
NewerOlder