Skip to main content

Posts

Showing posts from January, 2015

Google Search API

Place Search API : Authentication :   https://developers.google.com/places/documentation/ Below detail coming from above link Need to first register for the API key then you are able to use below link services: The Google Places API uses an API key to identify your application. API keys are managed through the  Google APIs Console . You'll need your own server API key  before you can begin using the API. To activate the Places API and create your key: Visit the  Google APIs Console  and log in with your Google account. A default project called  API Project  is created for you when you first log in to the APIs Console. You can use the project, or create a new one by clicking the  API Project  button at the top of the window and selecting  Create .  Google Maps API for Work  customers must use the API project created for them as part of their  Google Places API for Work  purchase. Click the  Services  link in the left-hand navigation panel. Click the status switch

sizeWithFont method is deprecated. Replace with sizeWithAttributes.

Create category that works for both iOS7 and iOS8 or only use sizeWithAttributes. #import "NSString+StringSizeWithFont.h" @implementation NSString (StringSizeWithFont) - ( CGSize ) sizeWithMyFont:( UIFont *)fontToUse {     if ([ self respondsToSelector : @selector (sizeWithAttributes:)])     {         NSDictionary * attribs = @{ NSFontAttributeName :fontToUse } ;         return ([ self sizeWithAttributes :attribs]);     }     return ([ self sizeWithFont :fontToUse]); } @end Category call :      NSString *text= @"Do any additional setup after loading the view, typically from a nib." ;     CGSize fontSize = [text sizeWithMyFont :[ UIFont fontWithName : @"Helvetica"                                                          size : 12 ]];          NSLog ( @"Calculate Size with sizeWithAttributes : %f %f" , fontSize. height , fontSize. width );          CGSize fontSize1 = [text sizeWit

Convert Date into ISO formate

Call below function like : [self toStringFromDateTime:[NSDate date]]; - (NSString*)toStringFromDateTime:(NSDate*)datetime {     // Purpose: Return a string of the specified date-time in UTC (Zulu) time zone in ISO 8601 format.     // Example: 2013-10-25T06:59:43.431Z     NSDateFormatter* dateFormatter = [[NSDateFormatter alloc] init];     //ISO DateFormatter     [dateFormatter setTimeZone:[NSTimeZone timeZoneWithAbbreviation:@" UTC "]];     [dateFormatter setDateFormat:@" yyyy-MM-dd'T'HH:mm:SS.SSS'Z' "];     NSString* dateTimeInIsoFormatForZuluTimeZone = [dateFormatter stringFromDate:datetime];     return dateTimeInIsoFormatForZuluTimeZone; }