¡@

Home 

2014/10/15 ¤U¤È 10:08:04

iphone Programming Glossary: else

How to check for an active Internet Connection on iPhone SDK?

http://stackoverflow.com/questions/1083701/how-to-check-for-an-active-internet-connection-on-iphone-sdk

How to make a UITextField move up when keyboard is present

http://stackoverflow.com/questions/1126726/how-to-make-a-uitextfield-move-up-when-keyboard-is-present

Animate the current view out of the way if self.view.frame.origin.y 0 self setViewMovedUp YES else if self.view.frame.origin.y 0 self setViewMovedUp NO void keyboardWillHide if self.view.frame.origin.y.. setViewMovedUp NO void keyboardWillHide if self.view.frame.origin.y 0 self setViewMovedUp YES else if self.view.frame.origin.y 0 self setViewMovedUp NO void textFieldDidBeginEditing UITextField sender.. keyboard is covered up. rect.origin.y kOFFSET_FOR_KEYBOARD rect.size.height kOFFSET_FOR_KEYBOARD else revert back to the normal state. rect.origin.y kOFFSET_FOR_KEYBOARD rect.size.height kOFFSET_FOR_KEYBOARD..

How to develop or migrate apps for iPhone 5 screen resolution?

http://stackoverflow.com/questions/12395200/how-to-develop-or-migrate-apps-for-iphone-5-screen-resolution

you will get 960 px with black margins on top and bottom . Test your app and hopefully do nothing else since everything should work magically if you had set auto resizing masks properly. If you didn't adjust.. screenBounds UIScreen mainScreen bounds if screenBounds.size.height 568 code for 4 inch screen else code for 3.5 inch screen Also note The auto rotation API has changed completely take a look at that..

How to detect iPhone 5 (widescreen devices)?

http://stackoverflow.com/questions/12446990/how-to-detect-iphone-5-widescreen-devices

floating points as pointed in the comments by H2CO3. So from now on you can use it in standard if else statements if IS_IPHONE_5 else Edit Better detection As stated by some people this does only detect.. the comments by H2CO3. So from now on you can use it in standard if else statements if IS_IPHONE_5 else Edit Better detection As stated by some people this does only detect a widescreen not an actual iPhone..

How to Rotate a UIImage 90 degrees?

http://stackoverflow.com/questions/1315251/how-to-rotate-a-uiimage-90-degrees

CGImageGetBitsPerComponent imageRef CGImageGetBytesPerRow imageRef colorSpaceInfo bitmapInfo else bitmap CGBitmapContextCreate NULL targetWidth targetHeight CGImageGetBitsPerComponent imageRef CGImageGetBytesPerRow.. CGContextRotateCTM bitmap radians 90 CGContextTranslateCTM bitmap 0 targetHeight else if sourceImage.imageOrientation UIImageOrientationLeft CGContextRotateCTM bitmap radians 90 CGContextTranslateCTM.. CGContextRotateCTM bitmap radians 90 CGContextTranslateCTM bitmap targetWidth 0 else if sourceImage.imageOrientation UIImageOrientationDown NOTHING else if sourceImage.imageOrientation..

Send and receive messages through NSNotificationCenter in Objective-C? [closed]

http://stackoverflow.com/questions/2191594/send-and-receive-messages-through-nsnotificationcenter-in-objective-c

@ TestNotification NSLog @ Successfully received the test notification @end ... somewhere else in another class ... void someMethod All instances of TestClass will be notified NSNotificationCenter..

How to take a screenshot programmatically

http://stackoverflow.com/questions/2200736/how-to-take-a-screenshot-programmatically

How do I associate file types with an iPhone application?

http://stackoverflow.com/questions/2774343/how-do-i-associate-file-types-with-an-iphone-application

How can I send mail from an iPhone application

http://stackoverflow.com/questions/310946/how-can-i-send-mail-from-an-iphone-application

EXC_BAD_ACCESS signal received

http://stackoverflow.com/questions/327082/exc-bad-access-signal-received

too and must release it when you are done. But if you get something back from just about anything else including factory methods e.g. NSString stringWithFormat then you'll have an autorelease reference which..

Build fat static library (device + simulator) using Xcode and SDK 4+

http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4

in SIM or DEVICE if PLATFORM_NAME iphonesimulator then OTHER_SDK_TO_BUILD iphoneos SDK_VERSION else OTHER_SDK_TO_BUILD iphonesimulator SDK_VERSION fi echo XCode has selected SDK PLATFORM_NAME with version.. ALREADYINVOKED false then echo RECURSION I am NOT the root invocation so I'm NOT going to recurse else # CRITICAL # Prevent infinite recursion Xcode sucks export ALREADYINVOKED true echo RECURSION I am the..

Fast and Lean PDF Viewer for iPhone / iPad / iOs - tips and hints?

http://stackoverflow.com/questions/3889634/fast-and-lean-pdf-viewer-for-iphone-ipad-ios-tips-and-hints

2 imageSize.width imageSize.height CGContextDrawImage context imageRect baseImage CGImage else @synchronized issue CGPDFPageRef pdfPage CGPDFDocumentGetPage issue.pdfDoc pageIndex 1 pdfToPageTransform..

iPhone Data Usage Tracking/Monitoring

http://stackoverflow.com/questions/7946699/iphone-data-usage-tracking-monitoring

if type WiFi dataSent networkStatisc ifi_opackets dataReceived networkStatisc ifi_ipackets else if type WWAN dataSent networkStatisc ifi_obytes dataReceived networkStatisc ifi_ibytes cursor cursor..

How to check for an active Internet Connection on iPhone SDK?

http://stackoverflow.com/questions/1083701/how-to-check-for-an-active-internet-connection-on-iphone-sdk

How to make a UITextField move up when keyboard is present

http://stackoverflow.com/questions/1126726/how-to-make-a-uitextfield-move-up-when-keyboard-is-present

code #define kOFFSET_FOR_KEYBOARD 80.0 void keyboardWillShow Animate the current view out of the way if self.view.frame.origin.y 0 self setViewMovedUp YES else if self.view.frame.origin.y 0 self setViewMovedUp NO void keyboardWillHide if self.view.frame.origin.y 0 self setViewMovedUp YES else if self.view.frame.origin.y.. setViewMovedUp YES else if self.view.frame.origin.y 0 self setViewMovedUp NO void keyboardWillHide if self.view.frame.origin.y 0 self setViewMovedUp YES else if self.view.frame.origin.y 0 self setViewMovedUp NO void textFieldDidBeginEditing UITextField sender if sender isEqual mailTf move the main view so that the.. 2. increase the size of the view so that the area behind the keyboard is covered up. rect.origin.y kOFFSET_FOR_KEYBOARD rect.size.height kOFFSET_FOR_KEYBOARD else revert back to the normal state. rect.origin.y kOFFSET_FOR_KEYBOARD rect.size.height kOFFSET_FOR_KEYBOARD self.view.frame rect UIView commitAnimations void viewWillAppear..

How to develop or migrate apps for iPhone 5 screen resolution?

http://stackoverflow.com/questions/12395200/how-to-develop-or-migrate-apps-for-iphone-5-screen-resolution

app. This is how you get 1136 px screen height without it you will get 960 px with black margins on top and bottom . Test your app and hopefully do nothing else since everything should work magically if you had set auto resizing masks properly. If you didn't adjust your view layouts with proper auto resizing masks or look.. as there seems to be no specific API for that. Example CGRect screenBounds UIScreen mainScreen bounds if screenBounds.size.height 568 code for 4 inch screen else code for 3.5 inch screen Also note The auto rotation API has changed completely take a look at that as well if your application supports any rotation other than..

How to detect iPhone 5 (widescreen devices)?

http://stackoverflow.com/questions/12446990/how-to-detect-iphone-5-widescreen-devices

epsilon is here to prevent precision errors when comparing floating points as pointed in the comments by H2CO3. So from now on you can use it in standard if else statements if IS_IPHONE_5 else Edit Better detection As stated by some people this does only detect a widescreen not an actual iPhone 5. Next versions of the iPod.. errors when comparing floating points as pointed in the comments by H2CO3. So from now on you can use it in standard if else statements if IS_IPHONE_5 else Edit Better detection As stated by some people this does only detect a widescreen not an actual iPhone 5. Next versions of the iPod touch will maybe also have such..

How to Rotate a UIImage 90 degrees?

http://stackoverflow.com/questions/1315251/how-to-rotate-a-uiimage-90-degrees

bitmap CGBitmapContextCreate NULL targetHeight targetWidth CGImageGetBitsPerComponent imageRef CGImageGetBytesPerRow imageRef colorSpaceInfo bitmapInfo else bitmap CGBitmapContextCreate NULL targetWidth targetHeight CGImageGetBitsPerComponent imageRef CGImageGetBytesPerRow imageRef colorSpaceInfo bitmapInfo if sourceImage.imageOrientation.. bitmapInfo if sourceImage.imageOrientation UIImageOrientationRight CGContextRotateCTM bitmap radians 90 CGContextTranslateCTM bitmap 0 targetHeight else if sourceImage.imageOrientation UIImageOrientationLeft CGContextRotateCTM bitmap radians 90 CGContextTranslateCTM bitmap targetWidth 0 else if sourceImage.imageOrientation.. 0 targetHeight else if sourceImage.imageOrientation UIImageOrientationLeft CGContextRotateCTM bitmap radians 90 CGContextTranslateCTM bitmap targetWidth 0 else if sourceImage.imageOrientation UIImageOrientationDown NOTHING else if sourceImage.imageOrientation UIImageOrientationUp CGContextRotateCTM bitmap radians 90 CGContextTranslateCTM..

Send and receive messages through NSNotificationCenter in Objective-C? [closed]

http://stackoverflow.com/questions/2191594/send-and-receive-messages-through-nsnotificationcenter-in-objective-c

of other notifications as well. if notification name isEqualToString @ TestNotification NSLog @ Successfully received the test notification @end ... somewhere else in another class ... void someMethod All instances of TestClass will be notified NSNotificationCenter defaultCenter postNotificationName @ TestNotification object..

How to take a screenshot programmatically

http://stackoverflow.com/questions/2200736/how-to-take-a-screenshot-programmatically

How do I associate file types with an iPhone application?

http://stackoverflow.com/questions/2774343/how-do-i-associate-file-types-with-an-iphone-application

How can I send mail from an iPhone application

http://stackoverflow.com/questions/310946/how-can-i-send-mail-from-an-iphone-application

EXC_BAD_ACCESS signal received

http://stackoverflow.com/questions/327082/exc-bad-access-signal-received

there are a few others or a copy method you own the memory too and must release it when you are done. But if you get something back from just about anything else including factory methods e.g. NSString stringWithFormat then you'll have an autorelease reference which means it could be released at some time in the future by..

Build fat static library (device + simulator) using Xcode and SDK 4+

http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4

echo SDK_NAME grep o '. 3 ' # Next work out if we're in SIM or DEVICE if PLATFORM_NAME iphonesimulator then OTHER_SDK_TO_BUILD iphoneos SDK_VERSION else OTHER_SDK_TO_BUILD iphonesimulator SDK_VERSION fi echo XCode has selected SDK PLATFORM_NAME with version SDK_VERSION although back targetting IPHONEOS_DEPLOYMENT_TARGET.. So build ONLY the missing platforms configurations. if true ALREADYINVOKED false then echo RECURSION I am NOT the root invocation so I'm NOT going to recurse else # CRITICAL # Prevent infinite recursion Xcode sucks export ALREADYINVOKED true echo RECURSION I am the root ... recursing all missing build targets NOW... echo..

Fast and Lean PDF Viewer for iPhone / iPad / iOs - tips and hints?

http://stackoverflow.com/questions/3889634/fast-and-lean-pdf-viewer-for-iphone-ipad-ios-tips-and-hints

imageSize.width 2 self.bounds.size.height imageSize.height 2 imageSize.width imageSize.height CGContextDrawImage context imageRect baseImage CGImage else @synchronized issue CGPDFPageRef pdfPage CGPDFDocumentGetPage issue.pdfDoc pageIndex 1 pdfToPageTransform CGPDFPageGetDrawingTransform pdfPage kCGPDFMediaBox layer.bounds..

iPhone Data Usage Tracking/Monitoring

http://stackoverflow.com/questions/7946699/iphone-data-usage-tracking-monitoring

ifa_addr networkStatisc const struct if_data cursor ifa_data if type WiFi dataSent networkStatisc ifi_opackets dataReceived networkStatisc ifi_ipackets else if type WWAN dataSent networkStatisc ifi_obytes dataReceived networkStatisc ifi_ibytes cursor cursor ifa_next freeifaddrs addrs return NSArray arrayWithObjects..

How to check for an active Internet Connection on iPhone SDK?

http://stackoverflow.com/questions/1083701/how-to-check-for-an-active-internet-connection-on-iphone-sdk

How to make a UITextField move up when keyboard is present

http://stackoverflow.com/questions/1126726/how-to-make-a-uitextfield-move-up-when-keyboard-is-present

void keyboardWillShow Animate the current view out of the way if self.view.frame.origin.y 0 self setViewMovedUp YES else if self.view.frame.origin.y 0 self setViewMovedUp NO void keyboardWillHide if self.view.frame.origin.y 0 self setViewMovedUp.. 0 self setViewMovedUp NO void keyboardWillHide if self.view.frame.origin.y 0 self setViewMovedUp YES else if self.view.frame.origin.y 0 self setViewMovedUp NO void textFieldDidBeginEditing UITextField sender if sender isEqual.. the area behind the keyboard is covered up. rect.origin.y kOFFSET_FOR_KEYBOARD rect.size.height kOFFSET_FOR_KEYBOARD else revert back to the normal state. rect.origin.y kOFFSET_FOR_KEYBOARD rect.size.height kOFFSET_FOR_KEYBOARD self.view.frame..

How to develop or migrate apps for iPhone 5 screen resolution?

http://stackoverflow.com/questions/12395200/how-to-develop-or-migrate-apps-for-iphone-5-screen-resolution

height without it you will get 960 px with black margins on top and bottom . Test your app and hopefully do nothing else since everything should work magically if you had set auto resizing masks properly. If you didn't adjust your view layouts.. that. Example CGRect screenBounds UIScreen mainScreen bounds if screenBounds.size.height 568 code for 4 inch screen else code for 3.5 inch screen Also note The auto rotation API has changed completely take a look at that as well if your application..

How to detect iPhone 5 (widescreen devices)?

http://stackoverflow.com/questions/12446990/how-to-detect-iphone-5-widescreen-devices

when comparing floating points as pointed in the comments by H2CO3. So from now on you can use it in standard if else statements if IS_IPHONE_5 else Edit Better detection As stated by some people this does only detect a widescreen not an.. as pointed in the comments by H2CO3. So from now on you can use it in standard if else statements if IS_IPHONE_5 else Edit Better detection As stated by some people this does only detect a widescreen not an actual iPhone 5. Next versions..

How to Rotate a UIImage 90 degrees?

http://stackoverflow.com/questions/1315251/how-to-rotate-a-uiimage-90-degrees

targetHeight targetWidth CGImageGetBitsPerComponent imageRef CGImageGetBytesPerRow imageRef colorSpaceInfo bitmapInfo else bitmap CGBitmapContextCreate NULL targetWidth targetHeight CGImageGetBitsPerComponent imageRef CGImageGetBytesPerRow imageRef.. UIImageOrientationRight CGContextRotateCTM bitmap radians 90 CGContextTranslateCTM bitmap 0 targetHeight else if sourceImage.imageOrientation UIImageOrientationLeft CGContextRotateCTM bitmap radians 90 CGContextTranslateCTM bitmap.. UIImageOrientationLeft CGContextRotateCTM bitmap radians 90 CGContextTranslateCTM bitmap targetWidth 0 else if sourceImage.imageOrientation UIImageOrientationDown NOTHING else if sourceImage.imageOrientation UIImageOrientationUp..

Send and receive messages through NSNotificationCenter in Objective-C? [closed]

http://stackoverflow.com/questions/2191594/send-and-receive-messages-through-nsnotificationcenter-in-objective-c

name isEqualToString @ TestNotification NSLog @ Successfully received the test notification @end ... somewhere else in another class ... void someMethod All instances of TestClass will be notified NSNotificationCenter defaultCenter postNotificationName..

How to take a screenshot programmatically

http://stackoverflow.com/questions/2200736/how-to-take-a-screenshot-programmatically

How do I associate file types with an iPhone application?

http://stackoverflow.com/questions/2774343/how-do-i-associate-file-types-with-an-iphone-application

How can I send mail from an iPhone application

http://stackoverflow.com/questions/310946/how-can-i-send-mail-from-an-iphone-application

EXC_BAD_ACCESS signal received

http://stackoverflow.com/questions/327082/exc-bad-access-signal-received

you own the memory too and must release it when you are done. But if you get something back from just about anything else including factory methods e.g. NSString stringWithFormat then you'll have an autorelease reference which means it could..

Build fat static library (device + simulator) using Xcode and SDK 4+

http://stackoverflow.com/questions/3520977/build-fat-static-library-device-simulator-using-xcode-and-sdk-4

Next work out if we're in SIM or DEVICE if PLATFORM_NAME iphonesimulator then OTHER_SDK_TO_BUILD iphoneos SDK_VERSION else OTHER_SDK_TO_BUILD iphonesimulator SDK_VERSION fi echo XCode has selected SDK PLATFORM_NAME with version SDK_VERSION although.. if true ALREADYINVOKED false then echo RECURSION I am NOT the root invocation so I'm NOT going to recurse else # CRITICAL # Prevent infinite recursion Xcode sucks export ALREADYINVOKED true echo RECURSION I am the root ... recursing..

Fast and Lean PDF Viewer for iPhone / iPad / iOs - tips and hints?

http://stackoverflow.com/questions/3889634/fast-and-lean-pdf-viewer-for-iphone-ipad-ios-tips-and-hints

imageSize.height 2 imageSize.width imageSize.height CGContextDrawImage context imageRect baseImage CGImage else @synchronized issue CGPDFPageRef pdfPage CGPDFDocumentGetPage issue.pdfDoc pageIndex 1 pdfToPageTransform CGPDFPageGetDrawingTransform..

iPhone Data Usage Tracking/Monitoring

http://stackoverflow.com/questions/7946699/iphone-data-usage-tracking-monitoring

cursor ifa_data if type WiFi dataSent networkStatisc ifi_opackets dataReceived networkStatisc ifi_ipackets else if type WWAN dataSent networkStatisc ifi_obytes dataReceived networkStatisc ifi_ibytes cursor cursor ifa_next freeifaddrs..

How to convert image path to uiimage using ALAssetsLibrary

http://stackoverflow.com/questions/11721762/how-to-convert-image-path-to-uiimage-using-alassetslibrary

resultBlock resultblock failureBlock failureblock Note Make sure your filePath objectAtIndex 0 will be a NSUrl object. Else convert it to NSUrl Example ALAssetsLibrary assetslibrary ALAssetsLibrary alloc init autorelease NSURL myAssetUrl NSURL..

how to get hour and minute from NSDate

http://stackoverflow.com/questions/2927028/how-to-get-hour-and-minute-from-nsdate

11 59 13 AM which is coming from datepicker. Here if I use above code it's okay to get hour if it's greater than 9. Else I need to change NSMakeRange 0 1 to get hour between 1 to 9. Is there any methods to get the hour minutes etc Thanks in..

iPhone - Backgrounding to poll for events

http://stackoverflow.com/questions/4656214/iphone-backgrounding-to-poll-for-events

NSLog @ ### VOIP backgrounding callback try to do sth. According to Apple we have ONLY 30 seconds to perform this Task Else the Application will be terminated UIApplication app UIApplication sharedApplication NSArray oldNotifications app scheduledLocalNotifications..

How would you keep secret data secret in an iPhone application?

http://stackoverflow.com/questions/544463/how-would-you-keep-secret-data-secret-in-an-iphone-application

best place to store the key.... If so how do I ship with the key pre entered into the app's keychain Is that possible Else how could you add the key on first launch without the key being in the source code Hmm.. EDIT Filed bug report # 6584858..

What does the “?” mean in the following statement

http://stackoverflow.com/questions/5832134/what-does-the-mean-in-the-following-statement

NSLocalizedString @ Edit @ Edit You could think of it like If previous statement is true do code immediately after. Else Otherwise run the code immediately after this. You can read more here http en.wikipedia.org wiki Ternary_operation . You..

iPhone - knowing if a UIScrollView reached the top or bottom

http://stackoverflow.com/questions/7706152/iphone-knowing-if-a-uiscrollview-reached-the-top-or-bottom

else if scrollOffset scrollViewHeight scrollContentSizeHeight then we are at the end Hope this is what you are after Else have a tinker by adding more conditions to the above code and NSLog the value of scrollOffset. share improve this answer..

How to keep data associated with MKAnnotation from being lost after a callout pops up and user taps disclosure button?

http://stackoverflow.com/questions/9797047/how-to-keep-data-associated-with-mkannotation-from-being-lost-after-a-callout-po

annotation reuseIdentifier nil PM this pin will have a callout i.e. dont' forget to override title function Else exception thrown singleAnnotationView.canShowCallout YES PM add disclosure button UIButton rightButton UIButton buttonWithType..