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
NSLog(@"Frame: %@", NSStringFromCGRect(customView.frame)); |
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
// Builder.h | |
#import <Foundation/Foundation.h> | |
@interface ObjectBuilder : NSObject | |
@property (nonatomic, copy) NSString *name; | |
@property (nonatomic, copy) NSNumber *age; | |
@end |
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
// Singleton.h | |
#import <Foundation/Foundation.h> | |
@interface Singleton : NSObject | |
+ (Singleton *)sharedInstance; | |
@end |
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
NSInteger randomNumber = arc4random() % 3; | |
switch (randomNumber) | |
{ | |
case 0: | |
break; | |
case 1: | |
break; | |
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]; | |
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)]; | |
view.backgroundColor = [UIColor redColor]; | |
[self.view addSubview:view]; | |
UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handler:)]; | |
[tapGestureRecognizer setNumberOfTapsRequired:1]; |
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
[UIView animateWithDuration:1.0f animations:^{ | |
}]; | |
[UIView animateWithDuration:1.0f animations:^{ | |
} completion:^(BOOL finished) { | |
}]; | |
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
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 50, 50)]; | |
imageView.image = [UIImage imageNamed:@"custom_image"]; | |
imageView.contentMode = UIViewContentModeScaleAspectFit; | |
imageView.bounds = CGRectInset(imageView.frame, 20.0f, 20.0f); | |
[self.navigationController.navigationBar addSubview:imageView]; |
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
// For UIViewController inside UINavigationController | |
- (void)viewWillLayoutSubviews | |
{ | |
[super viewWillLayoutSubviews]; | |
self.navigationController.view.superview.bounds = CGRectMake(0, 0, 300, 300); | |
self.navigationController.view.superview.layer.cornerRadius = 2.0f; | |
} | |
// Usual presentation |
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
CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; | |
rotationAnimation.duration = 2.0f; | |
rotationAnimation.removedOnCompletion = NO; | |
rotationAnimation.additive = YES; | |
rotationAnimation.fromValue = [NSNumber numberWithFloat:0]; | |
rotationAnimation.toValue = [NSNumber numberWithFloat:M_PI]; | |
rotationAnimation.fillMode = kCAFillModeForwards; | |
[self.customView.layer addAnimation:rotationAnimation forKey:@"rotationAnimation"]; |
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
UIViewController *viewController = [[UIViewController alloc] init]; | |
UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:viewController]; | |
navigationController.modalPresentationStyle = UIModalPresentationFormSheet; | |
[self presentViewController:navigationController animated:YES completion:nil]; |