Archive
Changing the iPhone status bar color
Either in the info.plist
UIStatusBarStyle = UIStatusBarStyleBlackOpaque
or
[application setStatusBarStyle:UIStatusBarStyleBlackOpaque];
String non alpha-numeric characters from a NSString
NSCharacterSet *nonalphanumericSet = [[ NSCharacterSet alphanumericCharacterSet ] invertedSet ];
NSString * endingString = [[@"sdfsd*&*(*(SD&((SD" componentsSeparatedByCharactersInSet:nonalphanumericSet] componentsJoinedByString:@""];
Make phone call with Iphone API
NSURL *phoneNumberURL = [NSURL URLWithString:@"tel:8005551234"];
[[UIApplication sharedApplication] openURL:phoneNumberURL];
Convert Java Float into C/C++ Float
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;