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
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<meta name="description" content=""> | |
<meta name="author" content=""> | |
<title>Bootstrap 101 Template</title> |
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
NSString *path = [[NSBundle mainBundle] pathForResource:@"yourImage.png" ofType:nil]; | |
CGImageRef img = [UIImage imageWithContentsOfFile:path].CGImage; | |
CALayer *layer = [CALayer layer]; | |
layer.contents = (id)img; | |
layer.bounds = CGRectMake( 0, 0, CGImageGetWidth(img), CGImageGetHeight(img) ); | |
// with sprites atlasses | |
CALayer *layer = [CALayer layer]; |
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
CGRect screenSizeRect = [[UIScreen mainScreen] bounds]; | |
CGRect screenSizeRect = [[UIScreen mainScreen] applicationFrame]; | |
CGFloat screenWidth = screenSizeRect.size.width; | |
CGFloat screenHeight = screenSizeRect.size.height; |
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
//First Create a Image & FrameRECT | |
UIImage *someImage = [UIImage imageNamed:@"a.png"]; | |
someRECT = CGRectMake(0, 0, weight, height); | |
//Method A | |
UIImageView *imageView = [[UIImageView alloc] initWithFrame:someRECT; | |
[self.view addSubview:imageView]; | |
//Method B | |
UIImageView *imageView = [[UIImageView alloc] initWithImage:someImage]; |
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
<style type="text/css"> | |
.zoom { | |
width: 200px; padding: 5px; border: 1px solid black; | |
-webkit-transition: all .3s ease-out; | |
-moz-transition: all .3s ease-out; | |
-o-transition: all .3s ease-out; | |
transition: all .3s ease-out; | |
} | |
.zoom:hover { | |
-moz-transform: scale(2); |
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)setRoundedView:(UIImageView *)roundedView toDiameter:(float)newSize; | |
{ | |
CGPoint saveCenter = roundedView.center; | |
CGRect newFrame = CGRectMake(roundedView.frame.origin.x, roundedView.frame.origin.y, newSize, newSize); | |
roundedView.frame = newFrame; | |
roundedView.layer.cornerRadius = newSize / 2.0; | |
roundedView.center = saveCenter; | |
} |
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
SingletonClass.h: | |
@interface SingletonClass : NSObject | |
@property (nonatomic, retain) NSString *myProperty; | |
+ (SingletonClass *)sharedInstance; | |
@end | |
SingletonClass.m: | |
@implentation | |
+ (SingletonClass *)sharedInstance |
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
DETAIL VIEW CONTROLLER - PRESENTED VC | |
#instead of defining the protocol with its required callback methods and delegate property | |
# DetailViewController.h | |
typedef void (^DetailViewControllerCompletionBlock)(BOOL success); | |
@property (nonatomic, copy) DetailViewControllerCompletionBlock completionBlock; | |
# Instead of falling delegate call cakes from IBActions asociares with UI buttons... Assign the BOOL variable of the block | |
# DetailViewController.m | |
- (IBAction)cancel:(id)sender { |
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
#ifdef DEBUG | |
#define DLog(...) NSLog(@"%s %@", __PRETTY_FUNCTION__, [NSString stringWithFormat:__VA_ARGS__]) | |
#define ALog(...) [[NSAssertionHandler currentHandler] handleFailureInFunction:[NSString stringWithCString:__PRETTY_FUNCTION__ encoding:NSUTF8StringEncoding] file:[NSString stringWithCString:__FILE__ encoding:NSUTF8StringEncoding] lineNumber:__LINE__ description:__VA_ARGS__] | |
#else | |
#define DLog(...) do { } while (0) | |
#define ALog(...) [TestFlight passCheckpoint:[NSString stringWithFormat:__VA_ARGS__]] | |
#ifndef NS_BLOCK_ASSERTIONS | |
#define NS_BLOCK_ASSERTIONS | |
#endif | |
#endif |
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
// http://cocoawithlove.com/2009/10/ugly-side-of-blocks-explicit.html has a nice breakdown of the syntax--it helps to think of the ^ as similar to a pointer dereference symbol * | |
// block typedef: | |
typedef void(^Block)(); | |
typedef void(^ConditionalBlock)(BOOL); | |
typedef NSString*(^BlockThatReturnsString)(); | |
typedef NSString*(^ConditionalBlockThatReturnsString)(BOOL); | |
// block property with typedef: |
OlderNewer