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
<key>NSAppTransportSecurity</key> | |
<dict> | |
<key>NSAllowsArbitraryLoads</key> | |
<true/> | |
</dict> |
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
- (NSDictionary *)dictionaryRepresentation { | |
unsigned int count = 0; | |
// Get a list of all properties in the class. | |
objc_property_t *properties = class_copyPropertyList([self class], &count); | |
NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] initWithCapacity:count]; | |
for (int i = 0; i < count; i++) { | |
NSString *key = [NSString stringWithUTF8String:property_getName(properties[i])]; | |
NSString *value = [self valueForKey:key]; |
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
#pragma mark UIGestureRecognizerDelegate methods | |
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch | |
{ | |
if ([touch.view isDescendantOfView:autocompleteTableView]) { | |
return NO; | |
} | |
return YES; | |
} |
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
class func requestPermission() { | |
let userNotificationTypes = UIUserNotificationType.Badge | UIUserNotificationType.Alert, | |
userNotificationSettings = UIUserNotificationSettings(forTypes: userNotificationTypes, categories: nil) | |
UIApplication.sharedApplication().registerUserNotificationSettings(userNotificationSettings) | |
} |
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
SCalendar *calendar = [[NSLocale currentLocale] objectForKey:NSLocaleCalendar]; | |
NSUInteger firstDay = [calendar firstWeekday]; |
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
- (UIImage *)screenshot | |
{ | |
CGSize imageSize = CGSizeZero; | |
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation; | |
if (UIInterfaceOrientationIsPortrait(orientation)) { | |
imageSize = [UIScreen mainScreen].bounds.size; | |
} else { | |
imageSize = CGSizeMake([UIScreen mainScreen].bounds.size.height, [UIScreen mainScreen].bounds.size.width); | |
} |
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
var backgroundUpdateTask: UIBackgroundTaskIdentifier = 0 | |
func applicationWillResignActive(application: UIApplication) { | |
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. | |
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. | |
self.backgroundUpdateTask = UIApplication.sharedApplication().beginBackgroundTaskWithExpirationHandler({ | |
self.endBackgroundUpdateTask() | |
}) | |
} | |
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.rootView = [self.window.subviews objectAtIndex:0]; | |
if (!self.rootView) { | |
self.rootView = self; | |
while (self.rootView.superview != nil) { | |
self.rootView = self.rootView.superview; | |
} | |
} | |
- (void)willMoveToWindow:(UIWindow *)newWindow { | |
if(newWindow == nil){ |
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
- (UITabBarController *)mainViewController { | |
return [TyphoonDefinition withClass:UITabBarController.class configuration:^(TyphoonDefinition * definition) { | |
[definition injectMethod:@selector(setViewControllers:animated:) parameters:^(TyphoonMethod * method) { | |
[method injectParameterWith:[self mainViewControllers]]; | |
[method injectParameterWith:@NO]; | |
}]; | |
}]; | |
} |
OlderNewer