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(@"### FB SDK VERSION : %@", [[FBRequestConnection class] performSelector:@selector(userAgent)]); |
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.gestureRecognizer = [[UITapGestureRecognizer alloc] | |
initWithTarget:self action:@selector(handleTap:)]; | |
self.gestureRecognizer.numberOfTapsRequired = 1; | |
[self.view addGestureRecognizer:self.gestureRecognizer]; | |
self.gestureRecognizer.cancelsTouchesInView = NO; | |
-(void)handleTap:(UITapGestureRecognizer *)recognizer | |
{ | |
CGPoint translatedPoint = [recognizer locationInView:self.view]; |
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)setEmailFieldBold:(BOOL)bold animated:(BOOL)animated | |
{ | |
CGFloat fontSize = self.emailTextField.font.pointSize; | |
void (^setBold)(void) = ^{ | |
self.emailTextField.font = (bold) ? [UIFont QRBoldFontWithSize:fontSize] | |
: [UIFont QRRegularFontWithSize:fontSize]; | |
}; | |
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)setEditing:(BOOL)editing animated:(BOOL)animated { | |
_editing = editing; | |
self.textField.enabled = !_editing; | |
void (^change)(void) = ^{ | |
_textField.alpha = _editing ? 0.0f : 1.0f; | |
_renameListButton.alpha = _editing ? 1.0f : 0.0f; | |
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { | |
if (self.frame.size.width < 500.0f) { | |
_archiveTasksButton.alpha = _renameListButton.alpha; |
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
NSString *htmlFile = [[NSBundle mainBundle] pathForResource:@"sample" ofType:@"html"]; | |
NSString* htmlString = [NSString stringWithContentsOfFile:htmlFile encoding:NSUTF8StringEncoding error:nil]; | |
[webView loadHTMLString:htmlString baseURL: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
- (void)loadView | |
{ | |
[super loadView]; | |
NSArray *nib =[[NSBundle mainBundle]loadNibNamed:@"test" owner:self options:nil]; | |
self.view = [nib objectAtIndex:0]; | |
} |
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
//int | |
int min = 0; | |
int max = 1; | |
int i = (arc4random()%(max-min+1))+min; | |
//BOOL | |
BOOL i = (arc4random()%(2)); |
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
//More Basic | |
CAGradientLayer *gradient = [CAGradientLayer layer]; | |
gradient.frame = self.view.bounds; | |
gradient.colors = @[(id)[[UIColor blackColor] CGColor], | |
(id)[[UIColor whiteColor] CGColor]]; | |
[self.view.layer insertSublayer:gradient atIndex:0]; | |
//More Advanced | |
+ (void)addLinearGradientToView:(UIView *)theView withColor:(UIColor *)theColor transparentToOpaque:(BOOL)transparentToOpaque |
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
//I created a typedef for a block: | |
typedef void (^animationCompletionBlock)(void); | |
// And a key that I use to add a block to an animation: | |
#define kAnimationCompletionBlock @"animationCompletionBlock" | |
// Then, if I want to run animation completion code after a CAAnimation finishes, I set myself as the delegate of the animation, and add a block of code to the animation using setValue:forKey: | |
animationCompletionBlock theBlock = ^void(void) | |
{ |