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
UIBarButtonItem *backButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil]; | |
[self.navigationItem setBackBarButtonItem:backButtonItem]; |
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
#import "UIView+UIViewCategory.h" | |
@implementation UIView (UIViewCategory) | |
- (UIView *)findSuperViewWithClass:(Class)superViewClass { | |
UIView *superView = self.superview; | |
UIView *foundSuperView = nil; | |
while (nil != superView && nil == foundSuperView) { |
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
self.uiTableView.tableFooterView = [[UIView alloc] init]; |
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
security find-identity -v -p codesigning | |
codesign -vv -d Example.app |
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
NSURLSession *session = [NSURLSession sharedSession]; | |
NSURLSessionDataTask *dataTask = [session dataTaskWithURL:[NSURL URLWithString:@"https://itunes.apple.com/search?term=apple&media=software"] completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { | |
NSDictionary *json = [NSJSONSerialization JSONObjectWithData:data options:0 error:nil]; | |
NSLog(@"%@", json); | |
}]; | |
[dataTask resume]; |
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)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
UINib *nib = [UINib nibWithNibName:@"ItemCell" bundle:nil]; | |
[[self tableView] registerNib:nib forCellReuseIdentifier:@"ItemCell"]; | |
} | |
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
// Create an instance of ItemCell |
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
#ifdef DEBUG | |
# define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); | |
#else | |
# define DLog(...) | |
#endif | |
#define ALog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); | |
#ifdef DEBUG | |
# define ULog(fmt, ...) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"%s\n [Line %d] ", __PRETTY_FUNCTION__, __LINE__] message:[NSString stringWithFormat:fmt, ##__VA_ARGS__] delegate:nil cancelButtonTitle:@"Ok" otherButtonTitles:nil]; [alert show]; } | |
#else | |
# define ULog(...) |
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
UIMutableUserNotificationAction *notificationAction = [[UIMutableUserNotificationAction alloc] init]; | |
notificationAction.identifier = @"Mute"; | |
notificationAction.title = @"Mute"; | |
notificationAction.activationMode = UIUserNotificationActivationModeBackground; | |
notificationAction.destructive = NO; | |
notificationAction.authenticationRequired = NO; | |
UIMutableUserNotificationCategory *notificationCategory = [[UIMutableUserNotificationCategory alloc] init]; | |
notificationCategory.identifier = @"mute"; | |
[notificationCategory setActions:@[notificationAction] forContext:UIUserNotificationActionContextDefault]; |
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
NSDictionary *responseDictionary = [[NSDictionary alloc] init]; | |
responseDictionary = [NSJSONSerialization JSONObjectWithData:responseData | |
options:NSJSONReadingMutableContainers | |
error:nil]; |
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)isBSTBalanced:(Node *)root { | |
return ([self maxHeight:root] - [self minHeight:root] <= 1); | |
} | |
- (NSUInteger)maxHeight:(Node *)root { | |
if (root == null) { | |
return 0; | |
} | |
return MAX([self maxHeight:root.leftNode], [self maxHeight:root.rightNode]) + 1; |