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
//http://ronnqvi.st/array-intersections-and-differences | |
NSPredicate *intersectPredicate = | |
[NSPredicate predicateWithFormat:@"SELF IN %@", otherArray]; | |
NSArray *intersect = | |
[firstArray filteredArrayUsingPredicate:intersectPredicate]; | |
NSPredicate *relativeComplementPredicate = // a minus b | |
[NSPredicate predicateWithFormat:@"NOT SELF IN %@", otherArray]; | |
NSArray *relativeComplement = |
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
self.tableView.estimatedRowHeight = 44.0; | |
self.tableView.rowHeight = UITableViewAutomaticDimension; | |
// | |
cell.textLabel.numberOfLines = 0; |
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
for(NSString *fontfamilyname in [UIFont familyNames]) | |
{ | |
if (![fontfamilyname containsString:@"elvetica"]) { | |
continue; | |
} | |
NSLog(@"family:'%@'",fontfamilyname); | |
for(NSString *fontName in [UIFont fontNamesForFamilyName:fontfamilyname]) | |
{ | |
NSLog(@"\tfont:'%@'",fontName); | |
} |
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
no separators for empty cells | |
tableView.tableFooterView = UIView(frame: CGRectZero) | |
//http://stackoverflow.com/questions/25770119/ios-8-uitableview-separator-inset-0-not-working | |
// From End To end | |
cell.separatorInset = UIEdgeInsetsZero; | |
cell.layoutMargins = UIEdgeInsetsZero; | |
cell.preservesSuperviewLayoutMargins = NO; | |
// invisible |
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
[self addChildViewController:vc]; | |
// [vc willMoveToParentViewController:self] called automatically | |
[self.view addSubview:vc.view]; // or something like this. | |
[vc didMoveToParentViewController:self]; | |
// For removing view controllers: | |
[vc willMoveToParentViewController:nil]; | |
[vc.view removeFromSuperview]; // or something like this | |
[vc removeFromParentViewController]; |
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
NSLocale *locale = [NSLocale currentLocale]; | |
// [locale localeIdentifier] fr_FR (i'm in france) | |
NSLog(@"current locale: %@", locale.localeIdentifier); | |
NSArray* preferredLanguages = [NSLocale preferredLanguages]; | |
NSLog(@"preferredLanguages: %@", preferredLanguages); | |
// en,fr ( the interface is in english ) | |
NSString* code = [locale objectForKey:NSLocaleCurrencyCode]; |
NewerOlder