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
/* | |
This method will be called when user performs the swipe action | |
Just Place this in your CustomCell | |
*/ | |
- (void)willTransitionToState:(UITableViewCellStateMask)state |
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
/* | |
UIKeyboardWillShowNotification | |
UIKeyboardDidShowNotification | |
UIKeyboardWillHideNotification | |
UIKeyboardDidHideNotification | |
*/ | |
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 "UIImageView+Download.h" | |
@implementation UIImageView (Download) | |
-(void)downloadFromURL:(NSString *)url withPlaceholder:(UIImage *)placehold | |
{ | |
if (placehold) { | |
[self setImage:placehold]; | |
} | |
if (url) { |
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
typedef enum { | |
NotiContact=0, | |
NotiChatNoti, | |
NotiMyNoti | |
} NotiSelect; | |
//Colors | |
#define COLOR(r,g,b) [UIColor colorWithRed:r/255.0 green:g/255.0 blue:b/255.0 alpha:1] | |
#define COLOR_BACKGROUND [UIColor colorWithRed:(230.0/255) green:(224.0/255) blue:(202.0/255) alpha:1.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
-(NSString *)StringFromDate:(NSDate *)DateLocal{ | |
NSDateFormatter *prefixDateFormatter = [[[NSDateFormatter alloc] init] autorelease]; | |
[prefixDateFormatter setFormatterBehavior:NSDateFormatterBehavior10_4]; | |
[prefixDateFormatter setDateFormat:@"MMMM d., yyyy"];//June 13th, 2013 | |
NSString * prefixDateString = [prefixDateFormatter stringFromDate:DateLocal]; | |
NSDateFormatter *monthDayFormatter = [[[NSDateFormatter alloc] init] autorelease]; | |
[monthDayFormatter setFormatterBehavior:NSDateFormatterBehavior10_4]; | |
[monthDayFormatter setDateFormat:@"d"]; | |
int date_day = [[monthDayFormatter stringFromDate:DateLocal] intValue]; |
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
-(MKCoordinateRegion) regionForAnnotations:(NSMutableArray *)annotations | |
{ | |
double minLat=90.0f, maxLat=-90.0f; | |
double minLon=180.0f, maxLon=-180.0f; | |
for (id<MKAnnotation> mka in annotations) { | |
if ( mka.coordinate.latitude < minLat ) minLat = mka.coordinate.latitude; | |
if ( mka.coordinate.latitude > maxLat ) maxLat = mka.coordinate.latitude; | |
if ( mka.coordinate.longitude < minLon ) minLon = mka.coordinate.longitude; | |
if ( mka.coordinate.longitude > maxLon ) maxLon = mka.coordinate.longitude; |
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
#pragma mark - | |
#pragma mark - Creating Object | |
-(id)createObjectForEntity:(NSString *)entityName | |
{ | |
if (entityName!=nil || [entityName isEqualToString:@""]) | |
{ | |
return [NSEntityDescription | |
insertNewObjectForEntityForName:entityName | |
inManagedObjectContext:appDelegate.managedObjectContext]; |
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
# pragma mark - | |
# pragma mark - Scale and Rotate according to Orientation | |
- (UIImage *)scaleAndRotateImage:(UIImage *)image | |
{ | |
int kMaxResolution = 450; // Or whatever | |
CGImageRef imgRef = image.CGImage; | |
CGFloat width = CGImageGetWidth(imgRef); |