iphone Programming Glossary: cfstringref
didFinishPickingMediaWithInfo return nil photo http://stackoverflow.com/questions/3088874/didfinishpickingmediawithinfo-return-nil-photo the edited image first. If it doesn't exist then you get the original image. if CFStringCompare CFStringRef mediaType kUTTypeImage 0 kCFCompareEqualTo UIImage picture info objectForKey UIImagePickerControllerEditedImage..
Bold & Non-Bold Text In A Single UILabel? http://stackoverflow.com/questions/3586871/bold-non-bold-text-in-a-single-uilabel 13 UIFont boldFont UIFont boldSystemFontOfSize fontSize CTFontRef ctBoldFont CTFontCreateWithName CFStringRef boldFont.fontName boldFont.pointSize NULL UIFont font UIFont systemFontOfSize 13 CTFontRef ctFont CTFontCreateWithName.. NULL UIFont font UIFont systemFontOfSize 13 CTFontRef ctFont CTFontCreateWithName CFStringRef font.fontName font.pointSize NULL CGColorRef cgColor UIColor whiteColor .CGColor NSDictionary attributes..
How to create a GUID/UUID using the iPhone SDK http://stackoverflow.com/questions/427180/how-to-create-a-guid-uuid-using-the-iphone-sdk several UUID just use this method with ARC NSString GetUUID CFUUIDRef theUUID CFUUIDCreate NULL CFStringRef string CFUUIDCreateString NULL theUUID CFRelease theUUID return __bridge NSString string share improve..
iOS SDK - Programmatically generate a PDF file http://stackoverflow.com/questions/4362734/ios-sdk-programmatically-generate-a-pdf-file This code block sets up our PDF Context so that we can draw to it CGContextRef pdfContext CFStringRef path CFURLRef url CFMutableDictionaryRef myDictionary NULL Create a CFString from the filename we provide.. we then draw to the page const char picture Picture CGImageRef image CGDataProviderRef provider CFStringRef picturePath CFURLRef pictureURL picturePath CFStringCreateWithCString NULL picture kCFStringEncodingUTF8..
Problem setting exif data for an image http://stackoverflow.com/questions/5125323/problem-setting-exif-data-for-an-image metadataAsMutable setObject GPSDictionary forKey NSString kCGImagePropertyGPSDictionary CFStringRef UTI CGImageSourceGetType source this is the type of image e.g. public.jpeg this will be the data CGImageDestinationRef..
iPhone get SSID without private library http://stackoverflow.com/questions/5198716/iphone-get-ssid-without-private-library interfaces @ __func__ ifs id info nil for NSString ifnam in ifs info id CNCopyCurrentNetworkInfo CFStringRef ifnam NSLog @ s @ @ __func__ ifnam info if info info count break info release ifs release return info..
Detecting the iPhone's Ring / Silent / Mute switch using AVAudioPlayer not working? http://stackoverflow.com/questions/6901363/detecting-the-iphones-ring-silent-mute-switch-using-avaudioplayer-not-worki If so on what kind of device and SDK version I'm calling it like so BOOL deviceIsSilenced CFStringRef state UInt32 propertySize sizeof CFStringRef OSStatus audioStatus AudioSessionGetProperty kAudioSessionProperty_AudioRoute.. version I'm calling it like so BOOL deviceIsSilenced CFStringRef state UInt32 propertySize sizeof CFStringRef OSStatus audioStatus AudioSessionGetProperty kAudioSessionProperty_AudioRoute &propertySize &state if..
Objective-C url encoding http://stackoverflow.com/questions/8086584/objective-c-url-encoding unescaped @ http www NSString escapedString NSString CFURLCreateStringByAddingPercentEscapes NULL CFStringRef unescaped NULL CFSTR ' @ # kCFStringEncodingUTF8 NSLog @ escapedString @ escapedString NSLog output.. escapedString NSString CFBridgingRelease CFURLCreateStringByAddingPercentEscapes NULL __bridge CFStringRef unescaped NULL CFSTR ' @ # kCFStringEncodingUTF8 Note stringByAddingPercentEscapesUsingEncoding will..
URL encode an NSString http://stackoverflow.com/questions/8088473/url-encode-an-nsstring This also works NSString encodedString NSString CFURLCreateStringByAddingPercentEscapes NULL CFStringRef unencodedString NULL CFStringRef @ ' @ # kCFStringEncodingUTF8 Some good reading about the subject.. NSString CFURLCreateStringByAddingPercentEscapes NULL CFStringRef unencodedString NULL CFStringRef @ ' @ # kCFStringEncodingUTF8 Some good reading about the subject Objective c iPhone percent encode..
How to detect iphone is on silent mode http://stackoverflow.com/questions/833304/how-to-detect-iphone-is-on-silent-mode does not support the test and the code does not check for errors. Corrected code would look like CFStringRef state nil UInt32 propertySize sizeof CFStringRef AudioSessionInitialize NULL NULL NULL NULL OSStatus.. check for errors. Corrected code would look like CFStringRef state nil UInt32 propertySize sizeof CFStringRef AudioSessionInitialize NULL NULL NULL NULL OSStatus status AudioSessionGetProperty kAudioSessionProperty_AudioRoute..
Get Exif data from UIImage - UIImagePickerController http://stackoverflow.com/questions/9766394/get-exif-data-from-uiimage-uiimagepickercontroller CGImageDestinationRef dr CGImageDestinationCreateWithURL __bridge CFURLRef fileURL __bridge CFStringRef sourceOptionsDict objectForKey @ kCGImageSourceTypeIdentifierHint 1 NULL CGImageDestinationAddImage..
didFinishPickingMediaWithInfo return nil photo http://stackoverflow.com/questions/3088874/didfinishpickingmediawithinfo-return-nil-photo info objectForKey UIImagePickerControllerMediaURL Try getting the edited image first. If it doesn't exist then you get the original image. if CFStringCompare CFStringRef mediaType kUTTypeImage 0 kCFCompareEqualTo UIImage picture info objectForKey UIImagePickerControllerEditedImage if picture picture info objectForKey UIImagePickerControllerOriginalImage..
Bold & Non-Bold Text In A Single UILabel? http://stackoverflow.com/questions/3586871/bold-non-bold-text-in-a-single-uilabel the attributes for the attributed string CGFloat fontSize 13 UIFont boldFont UIFont boldSystemFontOfSize fontSize CTFontRef ctBoldFont CTFontCreateWithName CFStringRef boldFont.fontName boldFont.pointSize NULL UIFont font UIFont systemFontOfSize 13 CTFontRef ctFont CTFontCreateWithName CFStringRef font.fontName font.pointSize.. CTFontCreateWithName CFStringRef boldFont.fontName boldFont.pointSize NULL UIFont font UIFont systemFontOfSize 13 CTFontRef ctFont CTFontCreateWithName CFStringRef font.fontName font.pointSize NULL CGColorRef cgColor UIColor whiteColor .CGColor NSDictionary attributes NSDictionary dictionaryWithObjectsAndKeys id ctBoldFont..
How to create a GUID/UUID using the iPhone SDK http://stackoverflow.com/questions/427180/how-to-create-a-guid-uuid-using-the-iphone-sdk
iOS SDK - Programmatically generate a PDF file http://stackoverflow.com/questions/4362734/ios-sdk-programmatically-generate-a-pdf-file be placed. void CreatePDFFile CGRect pageRect const char filename This code block sets up our PDF Context so that we can draw to it CGContextRef pdfContext CFStringRef path CFURLRef url CFMutableDictionaryRef myDictionary NULL Create a CFString from the filename we provide to this method when we call it path CFStringCreateWithCString.. 100 This code block will create an image that we then draw to the page const char picture Picture CGImageRef image CGDataProviderRef provider CFStringRef picturePath CFURLRef pictureURL picturePath CFStringCreateWithCString NULL picture kCFStringEncodingUTF8 pictureURL CFBundleCopyResourceURL CFBundleGetMainBundle..
Problem setting exif data for an image http://stackoverflow.com/questions/5125323/problem-setting-exif-data-for-an-image EXIFDictionary forKey NSString kCGImagePropertyExifDictionary metadataAsMutable setObject GPSDictionary forKey NSString kCGImagePropertyGPSDictionary CFStringRef UTI CGImageSourceGetType source this is the type of image e.g. public.jpeg this will be the data CGImageDestinationRef will write into NSMutableData dest_data NSMutableData..
iPhone get SSID without private library http://stackoverflow.com/questions/5198716/iphone-get-ssid-without-private-library NSArray ifs id CNCopySupportedInterfaces NSLog @ s Supported interfaces @ __func__ ifs id info nil for NSString ifnam in ifs info id CNCopyCurrentNetworkInfo CFStringRef ifnam NSLog @ s @ @ __func__ ifnam info if info info count break info release ifs release return info autorelease Example output 2011 03 04 15 32 00.669 ShowSSID..
Detecting the iPhone's Ring / Silent / Mute switch using AVAudioPlayer not working? http://stackoverflow.com/questions/6901363/detecting-the-iphones-ring-silent-mute-switch-using-avaudioplayer-not-worki state is always 7 . Has anyone used this method successfully If so on what kind of device and SDK version I'm calling it like so BOOL deviceIsSilenced CFStringRef state UInt32 propertySize sizeof CFStringRef OSStatus audioStatus AudioSessionGetProperty kAudioSessionProperty_AudioRoute &propertySize &state if audioStatus kAudioSessionNoError.. method successfully If so on what kind of device and SDK version I'm calling it like so BOOL deviceIsSilenced CFStringRef state UInt32 propertySize sizeof CFStringRef OSStatus audioStatus AudioSessionGetProperty kAudioSessionProperty_AudioRoute &propertySize &state if audioStatus kAudioSessionNoError NSLog @ audio route @ state..
Objective-C url encoding http://stackoverflow.com/questions/8086584/objective-c-url-encoding you want is a little more work. Example code NSString unescaped @ http www NSString escapedString NSString CFURLCreateStringByAddingPercentEscapes NULL CFStringRef unescaped NULL CFSTR ' @ # kCFStringEncodingUTF8 NSLog @ escapedString @ escapedString NSLog output escapedString http 3A 2F 2Fwww Under ARC one alternative is.. http 3A 2F 2Fwww Under ARC one alternative is NSString escapedString NSString CFBridgingRelease CFURLCreateStringByAddingPercentEscapes NULL __bridge CFStringRef unescaped NULL CFSTR ' @ # kCFStringEncodingUTF8 Note stringByAddingPercentEscapesUsingEncoding will not produce the correct encoding in this case it will not encode..
URL encode an NSString http://stackoverflow.com/questions/8088473/url-encode-an-nsstring @ someURL NSString encodedUrlStr someUrlString urlencode This also works NSString encodedString NSString CFURLCreateStringByAddingPercentEscapes NULL CFStringRef unencodedString NULL CFStringRef @ ' @ # kCFStringEncodingUTF8 Some good reading about the subject Objective c iPhone percent encode a string Objective C url.. someUrlString urlencode This also works NSString encodedString NSString CFURLCreateStringByAddingPercentEscapes NULL CFStringRef unencodedString NULL CFStringRef @ ' @ # kCFStringEncodingUTF8 Some good reading about the subject Objective c iPhone percent encode a string Objective C url encoding http cybersam.com programming..
How to detect iphone is on silent mode http://stackoverflow.com/questions/833304/how-to-detect-iphone-is-on-silent-mode reason Pirripli's code does not work is that the simulator does not support the test and the code does not check for errors. Corrected code would look like CFStringRef state nil UInt32 propertySize sizeof CFStringRef AudioSessionInitialize NULL NULL NULL NULL OSStatus status AudioSessionGetProperty kAudioSessionProperty_AudioRoute.. simulator does not support the test and the code does not check for errors. Corrected code would look like CFStringRef state nil UInt32 propertySize sizeof CFStringRef AudioSessionInitialize NULL NULL NULL NULL OSStatus status AudioSessionGetProperty kAudioSessionProperty_AudioRoute propertySize state if status kAudioSessionNoError..
Get Exif data from UIImage - UIImagePickerController http://stackoverflow.com/questions/9766394/get-exif-data-from-uiimage-uiimagepickercontroller componentsSeparatedByString @ . objectAtIndex 1 CGImageDestinationRef dr CGImageDestinationCreateWithURL __bridge CFURLRef fileURL __bridge CFStringRef sourceOptionsDict objectForKey @ kCGImageSourceTypeIdentifierHint 1 NULL CGImageDestinationAddImage dr imageRef imagePropertiesDictionary CGImageDestinationFinalize..
Reading PDF files as string through iPhone application http://stackoverflow.com/questions/2362393/reading-pdf-files-as-string-through-iphone-application a variable to store total pages a method to get the pdf ref CGPDFDocumentRef MyGetPDFDocumentRef const char filename CFStringRef path CFURLRef url CGPDFDocumentRef document path CFStringCreateWithCString NULL filename kCFStringEncodingUTF8 url CFURLCreateWithFileSystemPath.. str represents a sequence of bytes d CGPDFPageGetDictionary page if CGPDFDictionaryGetString d Thumb str CFStringRef s s CGPDFStringCopyTextString str if s NULL need something in here in case it cant find anything NSLog @ @ testing it s..
didFinishPickingMediaWithInfo return nil photo http://stackoverflow.com/questions/3088874/didfinishpickingmediawithinfo-return-nil-photo Try getting the edited image first. If it doesn't exist then you get the original image. if CFStringCompare CFStringRef mediaType kUTTypeImage 0 kCFCompareEqualTo UIImage picture info objectForKey UIImagePickerControllerEditedImage if picture..
Bold & Non-Bold Text In A Single UILabel? http://stackoverflow.com/questions/3586871/bold-non-bold-text-in-a-single-uilabel CGFloat fontSize 13 UIFont boldFont UIFont boldSystemFontOfSize fontSize CTFontRef ctBoldFont CTFontCreateWithName CFStringRef boldFont.fontName boldFont.pointSize NULL UIFont font UIFont systemFontOfSize 13 CTFontRef ctFont CTFontCreateWithName CFStringRef.. boldFont.fontName boldFont.pointSize NULL UIFont font UIFont systemFontOfSize 13 CTFontRef ctFont CTFontCreateWithName CFStringRef font.fontName font.pointSize NULL CGColorRef cgColor UIColor whiteColor .CGColor NSDictionary attributes NSDictionary dictionaryWithObjectsAndKeys..
How to create a GUID/UUID using the iPhone SDK http://stackoverflow.com/questions/427180/how-to-create-a-guid-uuid-using-the-iphone-sdk
iOS SDK - Programmatically generate a PDF file http://stackoverflow.com/questions/4362734/ios-sdk-programmatically-generate-a-pdf-file const char filename This code block sets up our PDF Context so that we can draw to it CGContextRef pdfContext CFStringRef path CFURLRef url CFMutableDictionaryRef myDictionary NULL Create a CFString from the filename we provide to this method.. create an image that we then draw to the page const char picture Picture CGImageRef image CGDataProviderRef provider CFStringRef picturePath CFURLRef pictureURL picturePath CFStringCreateWithCString NULL picture kCFStringEncodingUTF8 pictureURL CFBundleCopyResourceURL..
Problem setting exif data for an image http://stackoverflow.com/questions/5125323/problem-setting-exif-data-for-an-image kCGImagePropertyExifDictionary metadataAsMutable setObject GPSDictionary forKey NSString kCGImagePropertyGPSDictionary CFStringRef UTI CGImageSourceGetType source this is the type of image e.g. public.jpeg this will be the data CGImageDestinationRef will..
iPhone get SSID without private library http://stackoverflow.com/questions/5198716/iphone-get-ssid-without-private-library NSLog @ s Supported interfaces @ __func__ ifs id info nil for NSString ifnam in ifs info id CNCopyCurrentNetworkInfo CFStringRef ifnam NSLog @ s @ @ __func__ ifnam info if info info count break info release ifs release return info autorelease Example..
Detecting the iPhone's Ring / Silent / Mute switch using AVAudioPlayer not working? http://stackoverflow.com/questions/6901363/detecting-the-iphones-ring-silent-mute-switch-using-avaudioplayer-not-worki this method successfully If so on what kind of device and SDK version I'm calling it like so BOOL deviceIsSilenced CFStringRef state UInt32 propertySize sizeof CFStringRef OSStatus audioStatus AudioSessionGetProperty kAudioSessionProperty_AudioRoute.. of device and SDK version I'm calling it like so BOOL deviceIsSilenced CFStringRef state UInt32 propertySize sizeof CFStringRef OSStatus audioStatus AudioSessionGetProperty kAudioSessionProperty_AudioRoute &propertySize &state if audioStatus kAudioSessionNoError..
Iphone SDk : Issue with ampersand in the URL string http://stackoverflow.com/questions/705448/iphone-sdk-issue-with-ampersand-in-the-url-string
Objective-C url encoding http://stackoverflow.com/questions/8086584/objective-c-url-encoding code NSString unescaped @ http www NSString escapedString NSString CFURLCreateStringByAddingPercentEscapes NULL CFStringRef unescaped NULL CFSTR ' @ # kCFStringEncodingUTF8 NSLog @ escapedString @ escapedString NSLog output escapedString http 3A.. alternative is NSString escapedString NSString CFBridgingRelease CFURLCreateStringByAddingPercentEscapes NULL __bridge CFStringRef unescaped NULL CFSTR ' @ # kCFStringEncodingUTF8 Note stringByAddingPercentEscapesUsingEncoding will not produce the correct..
URL encode an NSString http://stackoverflow.com/questions/8088473/url-encode-an-nsstring someUrlString urlencode This also works NSString encodedString NSString CFURLCreateStringByAddingPercentEscapes NULL CFStringRef unencodedString NULL CFStringRef @ ' @ # kCFStringEncodingUTF8 Some good reading about the subject Objective c iPhone.. NSString encodedString NSString CFURLCreateStringByAddingPercentEscapes NULL CFStringRef unencodedString NULL CFStringRef @ ' @ # kCFStringEncodingUTF8 Some good reading about the subject Objective c iPhone percent encode a string Objective..
How to detect iphone is on silent mode http://stackoverflow.com/questions/833304/how-to-detect-iphone-is-on-silent-mode is that the simulator does not support the test and the code does not check for errors. Corrected code would look like CFStringRef state nil UInt32 propertySize sizeof CFStringRef AudioSessionInitialize NULL NULL NULL NULL OSStatus status AudioSessionGetProperty.. the code does not check for errors. Corrected code would look like CFStringRef state nil UInt32 propertySize sizeof CFStringRef AudioSessionInitialize NULL NULL NULL NULL OSStatus status AudioSessionGetProperty kAudioSessionProperty_AudioRoute propertySize..
Get Exif data from UIImage - UIImagePickerController http://stackoverflow.com/questions/9766394/get-exif-data-from-uiimage-uiimagepickercontroller objectAtIndex 1 CGImageDestinationRef dr CGImageDestinationCreateWithURL __bridge CFURLRef fileURL __bridge CFStringRef sourceOptionsDict objectForKey @ kCGImageSourceTypeIdentifierHint 1 NULL CGImageDestinationAddImage dr imageRef..
|