Archive

Archive for the ‘XCode / C’ Category

iPhone disabling background mode for OS4

March 31st, 2011 No comments

Add to your info.plist

UIApplicationExitsOnSuspend = true

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
Categories: XCode / C Tags:

Changing the iPhone status bar color

March 31st, 2011 No comments

Either in the info.plist

UIStatusBarStyle = UIStatusBarStyleBlackOpaque

or

[application setStatusBarStyle:UIStatusBarStyleBlackOpaque];

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
Categories: XCode / C Tags:

String non alpha-numeric characters from a NSString

October 1st, 2010 No comments

NSCharacterSet *nonalphanumericSet = [[ NSCharacterSet alphanumericCharacterSet ] invertedSet ];
NSString * endingString = [[@"sdfsd*&*(*(SD&((SD" componentsSeparatedByCharactersInSet:nonalphanumericSet] componentsJoinedByString:@""];

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
Categories: XCode / C Tags:

Make phone call with Iphone API

November 30th, 2009 No comments

NSURL *phoneNumberURL = [NSURL URLWithString:@"tel:8005551234"];
[[UIApplication sharedApplication] openURL:phoneNumberURL];

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
Categories: XCode / C Tags:

Convert Java Float into C/C++ Float

February 12th, 2009 No comments

If you have a float stored using writeFloat use the following to read it back into C

float aFloat;
unsigned char *pBytes;
pBytes = (unsigned char * )&aFloat;
pBytes[3] = _buffer[_offset++];
pBytes[2] = _buffer[_offset++];
pBytes[1] = _buffer[_offset++];
pBytes[0] = _buffer[_offset++];
return aFloat;

Assume that _buffer is your byte array or pointer to an unsigned char *, and that _offset is the offset in your data.

To read an integer value:

int i = ((_buffer[_offset]<<24)|(_buffer[_offset+1]<<16)|(_buffer[_offset+2]<<8)|(_buffer[_offset+3]));
_offset+=4;
return i;

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
Categories: Uncategorized, XCode / C Tags: