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
| UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 50, 50, 50)]; | |
| [view setBackgroundColor:[UIColor blackColor]]; | |
| [self.view addSubview:view]; | |
| CABasicAnimation *animation = [CABasicAnimation animation]; | |
| animation.keyPath = @"position.x"; | |
| animation.fromValue = @0; | |
| animation.toValue = @(self.view.frame.size.width); | |
| animation.duration = 1; | |
| animation.fillMode = kCAFillModeForwards; |
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 DEBUG | |
| println("debug") | |
| #else | |
| println("Not debug") | |
| #endif |
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
| // ViewController.h | |
| #import <UIKit/UIKit.h> | |
| @interface ViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> | |
| @property (weak, nonatomic) IBOutlet UITableView *tableView; | |
| @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
| // ViewController.h | |
| #import <UIKit/UIKit.h> | |
| @interface ViewController : UIViewController <UICollectionViewDelegate, UICollectionViewDataSource> | |
| @property (weak, nonatomic) IBOutlet UICollectionView *collectionView; | |
| @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
| - (id)initWithFrame:(CGRect)frame | |
| { | |
| self = [super initWithFrame:frame]; | |
| if (self) | |
| { | |
| self.view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)]; | |
| self.view.translatesAutoresizingMaskIntoConstraints = NO; | |
| [self addSubview:self.tableView]; |
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
| @protocol ExampleViewDelegate <NSObject> | |
| - (void)doAction; | |
| @end | |
| @interface ExampleView : UIView | |
| @property (assign) id<ExampleViewDelegate> delegate; |
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)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator | |
| { | |
| [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator]; | |
| [coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) { | |
| } completion:^(id<UIViewControllerTransitionCoordinatorContext> _Nonnull context) { | |
| }]; | |
| } |
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
| @implementation UIImage (ImageFromColorCategory) | |
| + (UIImage *)imageFromColor:(UIColor *)color withSize:(CGSize)size | |
| { | |
| CGRect rect = CGRectMake(0, 0, size.width, size.height); | |
| UIGraphicsBeginImageContext(rect.size); | |
| CGContextRef context = UIGraphicsGetCurrentContext(); | |
| CGContextSetFillColorWithColor(context, [color CGColor]); | |
| CGContextFillRect(context, rect); | |
| UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); |