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
| // YourUIView.m (UIView) | |
| #import "UIImage+ImageEffects.h" | |
| -(UIImage *)blurredSnapshot | |
| { | |
| // Create the image context | |
| UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO, self.window.screen.scale); | |
| // There he is! The new API method | |
| [self drawViewHierarchyInRect:self.frame afterScreenUpdates:NO]; |
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
| // Create an Outlet for a UIlabel on storyboard and set its text property to it... | |
| - (void)startTimer | |
| { | |
| if (_timer == nil) { | |
| _timer = [NSTimer scheduledTimerWithTimeInterval:0.1 | |
| target:self | |
| selector:@selector(timerTick:) | |
| userInfo:nil | |
| repeats:YES]; |
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
| display the time using presentable typography, with proportionally-spaced figures and the correct hh:mm divider | |
| http://typographica.org/wp-content/uploads/2013/06/Customized-Font-Instance.png |
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
| // | |
| // DOBRPulseView.m | |
| // test2 | |
| // | |
| // Created by David Oliver Barreto Rodríguez on 27/12/13. | |
| // Copyright (c) 2013 David Oliver Barreto Rodríguez. All rights reserved. | |
| // | |
| // This is much simpler if you don't draw the circle in drawRect:. Instead, set up your view to use a CAShapeLayer, like this: | |
| #import "DOBRPulseView.h" |
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
| //Declare these 2 properties. The NSData will be a very small chunk of data that conforms to NSCoding protocol so it can be encoded with NSCoder | |
| @property (nonatomic, strong) UIImage *thumbnail; | |
| @property (nonatomic, strong) NSData *thumbnailData; | |
| - (void)setThumbnailDataFromImage:(UIImage *)image | |
| { | |
| CGSize origImageSize = [image size]; | |
| // The rectangle of the thumbnail |
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
| // Define somewhere in a header or macro file included on prefix.psc file or put it somewhere at the beginning of AppDelegate.m and use it to create any UIColor object with whatever RGB color you want. Below is an example: | |
| // Get colors at http://colorschemedesigner.com | |
| #define UIColorFromRGB(rgbValue) [UIColor colorWithRed:((float)((rgbValue & 0xFF0000) >> 16))/255.0 green:((float)((rgbValue & 0xFF00) >> 8))/255.0 blue:((float)(rgbValue & 0xFF))/255.0 alpha:1.0] | |
| // Usage !!! | |
| [[UINavigationBar appearance] setBarTintColor:UIColorFromRGB(0x067AB5)]; | |
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
| NSShadow *shadow = [[NSShadow alloc] init]; | |
| shadow.shadowColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.8]; | |
| shadow.shadowOffset = CGSizeMake(0, 1); | |
| [[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys: | |
| [UIColor colorWithRed:245.0/255.0 green:245.0/255.0 blue:245.0/255.0 alpha:1.0], NSForegroundColorAttributeName, | |
| shadow, NSShadowAttributeName, | |
| [UIFont fontWithName:@"HelveticaNeue-CondensedBlack" size:21.0], NSFontAttributeName, 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
| UIPageControl *pageControl = [UIPageControl appearanceWhenContainedIn:[MyViewController class], nil]; | |
| pageControl.pageIndicatorTintColor = [UIColor whiteColor]; | |
| pageControl.currentPageIndicatorTintColor = [UIColor redColor]; | |
| pageControl.backgroundColor = [UIColor blackColor]; |
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)setupPageControlAppearance | |
| { | |
| UIPageControl * pageControl = [[self.view.subviews filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"(class = %@)", [UIPageControl class]]] lastObject]; | |
| pageControl.pageIndicatorTintColor = [UIColor grayColor]; | |
| pageControl.currentPageIndicatorTintColor = [UIColor blackColor]; | |
| } |