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 *) uniqueId | |
{ | |
CFUUIDRef uuid = CFUUIDCreate(NULL); | |
NSString *identifier =(NSString *)CFUUIDCreateString(NULL, uuid); | |
CFRelease(uuid); | |
return [identifier autorelease]; | |
} |
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
CMItemCount numSamplesInBuffer = CMSampleBufferGetNumSamples(buffer); | |
AudioBufferList audioBufferList; | |
CMSampleBufferGetAudioBufferListWithRetainedBlockBuffer( | |
buffer, | |
NULL, | |
&audioBufferList, | |
sizeof(audioBufferList), | |
NULL, |
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
// Check if Retina Display is available or not | |
if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] == YES && [[UIScreen mainScreen] scale] == 2.00){ | |
hasRetina = 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
NSString *contents = [webView stringByEvaluatingJavaScriptFromString: @"document.body.innerText"]; |
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
[NSAutoreleasePool showPools] | |
/* Definition */ | |
extern void _objc_autoreleasePoolPrint(); | |
_objc_autoreleasePoolPrint(); |
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 *) findFirstResonder:(UIView*)root | |
{ | |
if ([root isFirstResponder]) { | |
return root; | |
} | |
for (UIView *subView in root.subviews) { | |
UIView *firstResponder = [self findFirstResonder:subView]; | |
if (firstResponder != nil) { | |
return firstResponder; |
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) presentModalViewControllerInSizeYouWant | |
{ | |
float width = <width you wnat>; | |
float height = <height you wnat>; | |
UIViewController *viewCtl = [[UIViewController alloc] initWithNibName: @"UIViewController" bundle: nil]; | |
viewCtl.modalPresentationStyle = UIModalPresentationFormSheet; // set presentation style | |
[self presentModalViewController:viewCtl animated: YES]; // show! | |
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 <QuartzCore/QuartzCore.h> | |
view.layer.masksToBounds = YES; | |
view.layer.cornerRadius = 3.0; |
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://stackoverflow.com/questions/8400340/determining-3g-vs-edge | |
- (NSNumber *) dataNetworkTypeFromStatusBar { | |
UIApplication *app = [UIApplication sharedApplication]; | |
NSArray *subviews = [[[app valueForKey:@"statusBar"] valueForKey:@"foregroundView"] subviews]; | |
NSNumber *dataNetworkItemView = nil; | |
for (id subview in subviews) { | |
if([subview isKindOfClass:[NSClassFromString(@"UIStatusBarDataNetworkItemView") class]]) { |
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 <QuartzCore/QuartzCore.h> | |
@implementation UIView (UIView_RoundCorner) | |
- (void) setCornersRoundedWithRadius: (float) cornerRadius | |
{ | |
UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect: self.bounds | |
byRoundingCorners: UIRectCornerAllCorners | |
cornerRadii: CGSizeMake(cornerRadius, cornerRadius)]; |
OlderNewer