Monthly Archives: abril 2010

Obj-C FPS counter and dt time for iPhone

// FPS static CFTimeInterval lastTime = CFAbsoluteTimeGetCurrent(); CFTimeInterval beginTime = CFAbsoluteTimeGetCurrent(); CFTimeInterval dt = beginTime – lastTime; static uint FPS = 0; static CFTimeInterval accum = 0; if ( accum >= 1.0 ) { NSLog(@”%d”, FPS); accum = 0.0; FPS … Continue reading

Posted in Graphics, iPad, iPhone, iPod, Programming | Leave a comment

Language (locale and country) in iPhone SDK

Little and fast-to-understand test for to know the language of iPhone device: NSString* language = [[NSLocale preferredLanguages] objectAtIndex:0]; // en NSString* countryCode = [[NSLocale currentLocale] objectForKey: NSLocaleCountryCode]; // US // Console Log, only for debug… NSLog(language); NSLog(countryCode); BOOL result; if … Continue reading

Posted in iPad, iPhone, iPod, Programming | Leave a comment