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
UILongPressGestureRecognizer *recognizer; | |
recognizer = [[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(handleLongPress:)] autorelease]; | |
[self.view addGestureRecognizer: recognizer]; | |
- (void)handleLongPress:(UILongPressGestureRecognizer *)recognizer | |
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)isRunningOniPad | |
{ | |
static BOOL hasCheckediPadStatus = NO; | |
static BOOL isRunningOniPad = NO; | |
if (!hasCheckediPadStatus) | |
{ | |
if ([[UIDevice currentDevice] respondsToSelector:@selector(userInterfaceIdiom)]) | |
{ | |
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) |
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:HIDE_CONTROLS_ANIMATION | |
animations:^{ | |
// and other controls | |
self.navigationController.navigationBar.hidden = ControlsHidden; | |
self.tabbar.hidden = ControlsHidden; | |
} | |
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
// | |
// EditableViewCell.h | |
// Editable UITableViewCell with a UITextField as an edit tool | |
// Created by Eugene Yagrushkin on 11-05-04. | |
// Copyright 2011 Eugene Yagrushkin All rights reserved. | |
// | |
#import <UIKit/UIKit.h> | |
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 UIImage (TPAdditions) | |
- (UIImage*)imageScaledToSize:(CGSize)size; | |
@end | |
@implementation UIImage (TPAdditions) | |
- (UIImage*)imageScaledToSize:(CGSize)size { | |
UIGraphicsBeginImageContext(size); | |
[self drawInRect:CGRectMake(0, 0, size.width, size.height)]; | |
UIImage *image = UIGraphicsGetImageFromCurrentImageContext(); | |
UIGraphicsEndImageContext(); |
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
@protocol SomeClassDelegate <NSObject> | |
- (void) SomeClassSelector:(ParamType*)param; | |
@end | |
@interface SomeClass : UIViewController { | |
id <SomeClassDelegate> delegate; | |
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
NSArray *names = [UIFont familyNames]; | |
for (NSString *fontName in names) { | |
NSLog(@"%@:", fontName); | |
NSArray *fontnames = [UIFont fontNamesForFamilyName:fontName]; | |
for (NSString *fontNameinFamily in fontnames) { | |
NSLog(@"-->%@", fontNameinFamily); | |
} | |
} | |
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
[self setWantsFullScreenLayout:YES]; | |
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleBlackTranslucent animated:YES]; | |
self.navigationController.navigationBar.translucent = YES; | |
self.navigationController.navigationBar.backgroundColor = [UIColor clearColor]; | |
self.navigationController.navigationBar.barStyle = UIBarStyleBlackTranslucent; | |
[[UIApplication sharedApplication] setStatusBarHidden:ControlsHidden]; |
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)drawRect:(CGRect)rect | |
{ | |
CGContextRef context = UIGraphicsGetCurrentContext(); // get current context | |
// CGFloat object_size = sizeStatus/2; | |
// CGFloat sx, sy, fsize = object_size; | |
// sx = rect.size.width - fsize; | |
// sy = fsize; | |
// CGContextMoveToPoint(context, sx, sy); |
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
AudioToolbox.framework | |
#import <AudioToolbox/AudioServices.h> | |
Now use this line of code everytime you want to make the phone vibrate: | |
AudioServicesPlaySystemSound(kSystemSoundID_Vibrate); |
OlderNewer