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) setFont:(NSString*)fontName andFactor:(CGFloat)factor toView:(UIView*)view { | |
NSArray *subviews = view.subviews; | |
for (NSObject *subview in subviews) { | |
if ([subview isKindOfClass:[UILabel class]]) { | |
UILabel *label = (UILabel*)subview; | |
[label setFont:[UIFont fontWithName:fontName size:label.font.pointSize*factor]]; | |
} | |
if ([subview isKindOfClass:[UIView class]]) { | |
[Util setFont:fontName andFactor:factor toView:(UIView*)subview]; | |
} |
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
data BinaryTree a = BinaryNode a (BinaryTree a) (BinaryTree a) | BinaryNullNode | |
instance Show a => Show (BinaryTree a) where | |
show BinaryNullNode = " null" | |
show (BinaryNode a l r) = " (" ++ show a ++ show l ++ show r ++ ")" | |
search BinaryNullNode _ = False | |
search (BinaryNode a l r) v | |
| v == a = True | |
| v < a = search l v |
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
#define ROUND_UP(N, S) ((((N) + (S) - 1) / (S)) * (S)) | |
#import <stdlib.h> | |
- (CGImageRef) createMaskWithImageAlpha: (CGContextRef) originalImageContext { | |
UInt8 *data = (UInt8 *)CGBitmapContextGetData(originalImageContext); | |
float width = CGBitmapContextGetBytesPerRow(originalImageContext) / 4; | |
float height = CGBitmapContextGetHeight(originalImageContext); | |
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*) getUniqueID { | |
CFUUIDRef newUniqueId = CFUUIDCreate(kCFAllocatorDefault); | |
CFStringRef newUniqueIdString = CFUUIDCreateString(kCFAllocatorDefault, newUniqueId); | |
NSString *uniqueId = [NSString stringWithFormat:@"%@",(NSString *)newUniqueIdString]; | |
CFRelease(newUniqueId); | |
CFRelease(newUniqueIdString); | |
return [[uniqueId retain] 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
- (void) enableSearchEmpty { | |
UITextField *searchBarTextField = nil; | |
for (UIView *subview in searchBar.subviews) | |
{ | |
if ([subview isKindOfClass:[UITextField class]]) | |
{ | |
searchBarTextField = (UITextField *)subview; | |
break; | |
} | |
} |
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
searchBar.barStyle = UIBarStyleBlackTranslucent; | |
searchBar.backgroundColor = [UIColor clearColor]; | |
[[searchBar.subviews objectAtIndex:0] removeFromSuperview]; |
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
CGFloat systemVersion = [[[ UIDevice currentDevice ] systemVersion ] floatValue ]; | |
if (systemVersion < 5.0) { | |
} else { | |
} |
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
+ (NSDate*) parseISO8601DateString:(NSString*)dateString { | |
ISO8601DateFormatter *formatter = [[ISO8601DateFormatter alloc] init]; | |
formatter.parsesStrictly = YES; | |
NSDate *date = [formatter dateFromString:dateString]; | |
[formatter release]; | |
return [[date retain] 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
progressImage.image = [[UIImage imageNamed:@"black_progress_bar"] resizableImageWithCapInsets:UIEdgeInsetsMake(0., leftCap, 0., leftCap)]; |
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) viewDidLoad { | |
//... | |
comments.text = @"Comments"; | |
comments.textColor = [UIColor lightGrayColor]; | |
isEmpty = YES; | |
//... | |
} | |
- (BOOL)textViewShouldBeginEditing:(UITextView*)textView { | |
if (isEmpty) { |