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
/usr/libexec/PlistBuddy -c "Set CFBundleVersion `git rev-parse --short HEAD`" "$BUILT_PRODUCTS_DIR/$INFOPLIST_PATH" |
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
//Create a CABasicAnimation object. Must be added to the element after it is displayed | |
CATransition *animation = [CATransition animation]; | |
animation.duration = 1.0; | |
animation.type = kCATransitionFade; | |
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; | |
[myLabel.layer addAnimation:animation forKey:@"changeTextTransition"]; | |
// Change the text and the animation will ocur | |
myLabel.text = @"Changed text"; |
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
//Create a CABasicAnimation object | |
CABasicAnimation *move = [CABasicAnimation animationWithKeyPath:@"transform.translation.y" ]; | |
[move setFromValue:[NSNumber numberWithFloat:0.0f]]; | |
[move setToValue:[NSNumber numberWithFloat:100.0f]]; | |
[move setDuration:0.3f]; | |
//Add animation to a specific element's layer. Must be called after the element is displayed. | |
[[element layer] addAnimation:move forKey:@"transform.translation.y"]; |
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
UISlider *slider = [[UISlider alloc] init]; | |
UIImage *sliderLeftTrackImage = [[UIImage imageNamed: @"slider_body_min.png"] stretchableImageWithLeftCapWidth: 9 topCapHeight: 0]; | |
UIImage *sliderRightTrackImage = [[UIImage imageNamed: @"slider_body_max.png"] stretchableImageWithLeftCapWidth: 9 topCapHeight: 0]; | |
UIImage *sliderThumb = [[UIImage imageNamed: @"slider_thumb.png"] stretchableImageWithLeftCapWidth: 9 topCapHeight: 0]; | |
[slider setMinimumTrackImage: sliderLeftTrackImage forState: UIControlStateNormal]; | |
[slider setMaximumTrackImage: sliderRightTrackImage forState: UIControlStateNormal]; | |
[slider setThumbImage:sliderThumb forState:UIControlStateNormal]; | |
// Now place you slider in a view and do anything else you want |
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
@interface UINavigationBar (MyCustomNavBar) | |
@end | |
@implementation UINavigationBar (MyCustomNavBar) | |
- (void) drawRect:(CGRect)rect { | |
//matching the button color with the bar color | |
[self setTintColor:[UIColor colorWithRed:0.85f green: 0 blue:0 alpha:1]]; | |
UIImage *barImage = [UIImage imageNamed:@"image.png"]; | |
[barImage drawInRect:rect]; | |
} | |
@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
// Create the toobar | |
UIToolbar* toolbar = [[UIToolbar alloc] | |
initWithFrame:CGRectMake(0, 0, 100, 45)]; | |
[toolbar setBarStyle: UIBarStyleDefault]; | |
// Create and array for the buttons | |
NSMutableArray* buttons = [[NSMutableArray alloc] initWithCapacity:3]; | |
// Create a "+" button | |
UIBarButtonItem *addButton = [[UIBarButtonItem alloc] |
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
#import "UITabBarController+CCAdditions.h" | |
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions | |
{ | |
[tabBarController setBackgroundImage:[UIImage imageNamed:@"CustomTabBarBackground.png"]]; | |
[tabBarController.view setNeedsDisplay]; | |
return 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
- (BOOL) isGyroscopeAvailable | |
{ | |
#ifdef __IPHONE_4_0 | |
CMMotionManager *motionManager = [[CMMotionManager alloc] init]; | |
BOOL gyroAvailable = motionManager.gyroAvailable; | |
[motionManager release]; | |
return gyroAvailable; | |
#else | |
return NO; | |
#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
+ (BOOL) isRetinaDisplay | |
{ | |
int scale = 1.0; | |
UIScreen *screen = [UIScreen mainScreen]; | |
if([screen respondsToSelector:@selector(scale)]) | |
scale = screen.scale; | |
if(scale == 2.0f) return YES; | |
else return NO; | |
} |
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
// Method returns no, when the user doesn't have any photos | |
[UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary]; | |
// Check for camera | |
- (BOOL) isVideoCameraAvailable | |
{ | |
UIImagePickerController *picker = [[UIImagePickerController alloc] init]; | |
NSArray *sourceTypes = [UIImagePickerController availableMediaTypesForSourceType:picker.sourceType]; | |
[picker release]; | |