Browsing Category

iPhone

Apple, iPad, iPhone, iPod, Programming

Upgrading a Target from iPhone to iPad

14 abril 2010 • By

If you have an existing iPhone application that you want to upgrade to run on iPad devices you need to upgrade the target that builds your iPhone application into a target that can build both an iPhone and an iPad application, or add a target to your project for building the iPad application.

To upgrade an iPhone target for iPad development, select the target in the Groups & Files list and choose Project > Upgrade Current Target for iPad.

For details about iPad-application development, see iPad Programming Guide.

ref: http://developer.apple.com/iphone/library/documentation/Xcode/Conceptual/iphone_development/115-Configuring_Applications/configuring_applications.html

Graphics, iPad, iPhone, iPod, Programming

Obj-C FPS counter and dt time for iPhone

8 abril 2010 • By
	// 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   = 0;
	}
	else
	{
		FPS += 1;
	}
	
	accum   += dt;
	lastTime = beginTime;
iPad, iPhone, iPod, Programming

Language (locale and country) in iPhone SDK

5 abril 2010 • By

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 ([countryCode isEqualToString:@"GB"] || [countryCode isEqualToString:@"US"] || [countryCode isEqualToString:@"CA"])
{
	result = YES;
}
else
{
	result = NO;
}