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
| NSInteger randomNumber = arc4random() % 3; | |
| switch (randomNumber) | |
| { | |
| case 0: | |
| break; | |
| case 1: | |
| break; | |
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
| // Singleton.h | |
| #import <Foundation/Foundation.h> | |
| @interface Singleton : NSObject | |
| + (Singleton *)sharedInstance; | |
| @end |
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
| // Builder.h | |
| #import <Foundation/Foundation.h> | |
| @interface ObjectBuilder : NSObject | |
| @property (nonatomic, copy) NSString *name; | |
| @property (nonatomic, copy) NSNumber *age; | |
| @end |
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
| NSLog(@"Frame: %@", NSStringFromCGRect(customView.frame)); |
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
| if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { | |
| } else if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { | |
| } |
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
| CustomViewController *customViewController = [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"CustomViewController"]; | |
| [self.navigationController showViewController:customViewController sender: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
| [self.tableView moveRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:1] toIndexPath:[NSIndexPath indexPathForRow:1 inSection:1]]; |
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
| UIActivityIndicatorView *activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; | |
| activityIndicatorView.frame = CGRectMake(0.0f, 0.0f, 40.0f, 40.0f); | |
| activityIndicatorView.center = self.view.center; | |
| [self.view addSubview:activityIndicatorView]; | |
| [activityIndicatorView bringSubviewToFront:self.view]; | |
| [activityIndicatorView startAnimating]; | |
| [UIApplication sharedApplication].networkActivityIndicatorVisible = TRUE; |
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
| + (UIImage *)imageWithImage:(UIImage *)image scaledToSize:(CGSize)size | |
| { | |
| UIGraphicsBeginImageContextWithOptions(size, NO, 0.0); | |
| [image drawInRect:CGRectMake(0, 0, size.width, size.height)]; | |
| UIImage *newImage = UIGraphicsGetImageFromCurrentImageContext(); | |
| UIGraphicsEndImageContext(); | |
| return newImage; | |
| } |