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
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:nil]; | |
} | |
- (void)orientationChanged:(NSNotification *)notification | |
{ | |
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationPortrait animated: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
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
if ([tableView respondsToSelector:@selector(setSeparatorInset:)]) | |
{ | |
[tableView setSeparatorInset:UIEdgeInsetsZero]; | |
} | |
if ([tableView respondsToSelector:@selector(setLayoutMargins:)]) | |
{ | |
[tableView setLayoutMargins:UIEdgeInsetsZero]; |
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
@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(); |
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
- (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 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 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]; |