iphone Programming Glossary: foundation.h
How to intercept touches events on a MKMapView or UIWebView objects? http://stackoverflow.com/questions/1049889/how-to-intercept-touches-events-on-a-mkmapview-or-uiwebview-objects WildcardGestureRecognizer.h Copyright 2010 Floatopian LLC. All rights reserved. #import Foundation Foundation.h typedef void ^TouchesEventBlock NSSet touches UIEvent event @interface WildcardGestureRecognizer UIGestureRecognizer..
Declaration/definition of variables locations in ObjectiveC? http://stackoverflow.com/questions/12632285/declaration-definition-of-variables-locations-in-objectivec and perhaps correct my present understanding Here's a sample class .h and .m #import Foundation Foundation.h 1 What do I declare here @interface SampleClass NSObject 2 ivar declarations Pretty much never used..
Best way to serialize a NSData into an hexadeximal string http://stackoverflow.com/questions/1305225/best-way-to-serialize-a-nsdata-into-an-hexadeximal-string be any length. Returns an empty string if NSData is empty. NSData Conversion.h #import Foundation Foundation.h @interface NSData NSData_Conversion #pragma mark String Conversion NSString hexadecimalString @end NSData..
Placeholder in UITextView http://stackoverflow.com/questions/1328638/placeholder-in-uitextview color. Hopefully it will save others the trouble. UIPlaceHolderTextView.h #import Foundation Foundation.h @interface UIPlaceHolderTextView UITextView @property nonatomic retain NSString placeholder @property..
How to use NSXMLParser to parse parent-child elements that have the same name http://stackoverflow.com/questions/2005448/how-to-use-nsxmlparser-to-parse-parent-child-elements-that-have-the-same-name you want to manipulate. The following code shows a class that does this job #import Foundation Foundation.h @interface Test NSObject NSXMLParserDelegate @private NSXMLParser xmlParser NSInteger depth NSMutableString..
What's the easiest way to get the current location of an iPhone? http://stackoverflow.com/questions/459355/whats-the-easiest-way-to-get-the-current-location-of-an-iphone that it is a little rough around the edges #import CoreLocation CoreLocation.h #import Foundation Foundation.h @interface LocationController NSObject CLLocationManagerDelegate CLLocationManager locationManager CLLocation..
Return to app behavior after phone call different in native code than UIWebView http://stackoverflow.com/questions/5317783/return-to-app-behavior-after-phone-call-different-in-native-code-than-uiwebview an instance of UIWebView without adding it to your view hierarchy. For example #import Foundation Foundation.h #import UIKit UIKit.h @interface PhoneCaller NSObject @private UIWebView webview void callTelURL NSURL..
Subclass UIButton to add a property http://stackoverflow.com/questions/5500327/subclass-uibutton-to-add-a-property much cleaner and will work on all instances of UIButton . UIButton Property.h #import Foundation Foundation.h @interface UIButton Property @property nonatomic retain NSObject property @end UIButton Property.m #import..
Is there a way to pass touches through on the iPhone? http://stackoverflow.com/questions/631427/is-there-a-way-to-pass-touches-through-on-the-iphone disposing of the touch event it is passed on. Sub classed UIButton MyButton.h #import Foundation Foundation.h @interface MyButton UIButton void touchesBegan NSSet touches withEvent UIEvent event @end MyButton.m..
What is the best way to deal with the NSDateFormatter locale “feature”? http://stackoverflow.com/questions/6613110/what-is-the-best-way-to-deal-with-the-nsdateformatter-locale-feature Re OMZ's proposal here is what I'm finding Here is the category version h file #import Foundation Foundation.h @interface NSDateFormatter Locale id initWithSafeLocale @end Category m file #import NSDateFormatter..
iCloud basics and code sample [closed] http://stackoverflow.com/questions/7795629/icloud-basics-and-code-sample check settings return YES @end The UIDocument MyTextDocument.h iCloudText #import Foundation Foundation.h #import ViewController.h @interface MyTextDocument UIDocument NSString documentText id delegate @property..
How to intercept touches events on a MKMapView or UIWebView objects? http://stackoverflow.com/questions/1049889/how-to-intercept-touches-events-on-a-mkmapview-or-uiwebview-objects tapInterceptor WildcardGestureRecognizer.h WildcardGestureRecognizer.h Copyright 2010 Floatopian LLC. All rights reserved. #import Foundation Foundation.h typedef void ^TouchesEventBlock NSSet touches UIEvent event @interface WildcardGestureRecognizer UIGestureRecognizer TouchesEventBlock touchesBeganCallback @property..
Declaration/definition of variables locations in ObjectiveC? http://stackoverflow.com/questions/12632285/declaration-definition-of-variables-locations-in-objectivec where I'd want to use these locations for my variables and perhaps correct my present understanding Here's a sample class .h and .m #import Foundation Foundation.h 1 What do I declare here @interface SampleClass NSObject 2 ivar declarations Pretty much never used 3 class specific method property declarations @end and #import..
Best way to serialize a NSData into an hexadeximal string http://stackoverflow.com/questions/1305225/best-way-to-serialize-a-nsdata-into-an-hexadeximal-string NSString representing the NSData where the data can be any length. Returns an empty string if NSData is empty. NSData Conversion.h #import Foundation Foundation.h @interface NSData NSData_Conversion #pragma mark String Conversion NSString hexadecimalString @end NSData Conversion.m #import NSData Conversion.h @implementation..
Placeholder in UITextView http://stackoverflow.com/questions/1328638/placeholder-in-uitextview from a xib file text wrapping and to maintain background color. Hopefully it will save others the trouble. UIPlaceHolderTextView.h #import Foundation Foundation.h @interface UIPlaceHolderTextView UITextView @property nonatomic retain NSString placeholder @property nonatomic retain UIColor placeholderColor void textChanged..
How to use NSXMLParser to parse parent-child elements that have the same name http://stackoverflow.com/questions/2005448/how-to-use-nsxmlparser-to-parse-parent-child-elements-that-have-the-same-name in memory can be impossible depending on the size of the data you want to manipulate. The following code shows a class that does this job #import Foundation Foundation.h @interface Test NSObject NSXMLParserDelegate @private NSXMLParser xmlParser NSInteger depth NSMutableString currentName NSString currentElement void start @end..
What's the easiest way to get the current location of an iPhone? http://stackoverflow.com/questions/459355/whats-the-easiest-way-to-get-the-current-location-of-an-iphone location. This is the singleton class I wrote. Please note that it is a little rough around the edges #import CoreLocation CoreLocation.h #import Foundation Foundation.h @interface LocationController NSObject CLLocationManagerDelegate CLLocationManager locationManager CLLocation currentLocation LocationController sharedInstance..
Return to app behavior after phone call different in native code than UIWebView http://stackoverflow.com/questions/5317783/return-to-app-behavior-after-phone-call-different-in-native-code-than-uiwebview handling behavior. Instead just load a tel URL request in an instance of UIWebView without adding it to your view hierarchy. For example #import Foundation Foundation.h #import UIKit UIKit.h @interface PhoneCaller NSObject @private UIWebView webview void callTelURL NSURL url @end @implementation id init self super init if self..
Subclass UIButton to add a property http://stackoverflow.com/questions/5500327/subclass-uibutton-to-add-a-property using a category with Associative References instead. It is much cleaner and will work on all instances of UIButton . UIButton Property.h #import Foundation Foundation.h @interface UIButton Property @property nonatomic retain NSObject property @end UIButton Property.m #import UIButton Property.h #import objc runtime.h @implementation..
Is there a way to pass touches through on the iPhone? http://stackoverflow.com/questions/631427/is-there-a-way-to-pass-touches-through-on-the-iphone touchesBegan touches withEvent event Rather than disposing of the touch event it is passed on. Sub classed UIButton MyButton.h #import Foundation Foundation.h @interface MyButton UIButton void touchesBegan NSSet touches withEvent UIEvent event @end MyButton.m #import MyButton.h @implementation MyButton void touchesBegan..
What is the best way to deal with the NSDateFormatter locale “feature”? http://stackoverflow.com/questions/6613110/what-is-the-best-way-to-deal-with-the-nsdateformatter-locale-feature see by mid day Tuesday. See below deadline extended. Update Re OMZ's proposal here is what I'm finding Here is the category version h file #import Foundation Foundation.h @interface NSDateFormatter Locale id initWithSafeLocale @end Category m file #import NSDateFormatter Locale.h @implementation NSDateFormatter Locale id initWithSafeLocale..
iCloud basics and code sample [closed] http://stackoverflow.com/questions/7795629/icloud-basics-and-code-sample you are using simulator or if you are on your phone you should check settings return YES @end The UIDocument MyTextDocument.h iCloudText #import Foundation Foundation.h #import ViewController.h @interface MyTextDocument UIDocument NSString documentText id delegate @property nonatomic retain NSString documentText @property nonatomic..
How to intercept touches events on a MKMapView or UIWebView objects? http://stackoverflow.com/questions/1049889/how-to-intercept-touches-events-on-a-mkmapview-or-uiwebview-objects WildcardGestureRecognizer.h Copyright 2010 Floatopian LLC. All rights reserved. #import Foundation Foundation.h typedef void ^TouchesEventBlock NSSet touches UIEvent event @interface WildcardGestureRecognizer UIGestureRecognizer TouchesEventBlock..
How to post more parameters with image upload code in iOS? http://stackoverflow.com/questions/10618056/how-to-post-more-parameters-with-image-upload-code-in-ios FROM OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #import Foundation Foundation.h extern NSString const APIKey @interface NetworkClient NSObject void processURLRequestWithURL NSString url andParams NSDictionary..
Intercepting/Hijacking iPhone Touch Events for MKMapView http://stackoverflow.com/questions/1121889/intercepting-hijacking-iphone-touch-events-for-mkmapview WildcardGestureRecognizer.h Copyright 2010 Floatopian LLC. All rights reserved. #import Foundation Foundation.h typedef void ^TouchesEventBlock NSSet touches UIEvent event @interface WildcardGestureRecognizer UIGestureRecognizer TouchesEventBlock..
Declaration/definition of variables locations in ObjectiveC? http://stackoverflow.com/questions/12632285/declaration-definition-of-variables-locations-in-objectivec for my variables and perhaps correct my present understanding Here's a sample class .h and .m #import Foundation Foundation.h 1 What do I declare here @interface SampleClass NSObject 2 ivar declarations Pretty much never used 3 class specific method..
Best way to serialize a NSData into an hexadeximal string http://stackoverflow.com/questions/1305225/best-way-to-serialize-a-nsdata-into-an-hexadeximal-string where the data can be any length. Returns an empty string if NSData is empty. NSData Conversion.h #import Foundation Foundation.h @interface NSData NSData_Conversion #pragma mark String Conversion NSString hexadecimalString @end NSData Conversion.m #import..
Placeholder in UITextView http://stackoverflow.com/questions/1328638/placeholder-in-uitextview to maintain background color. Hopefully it will save others the trouble. UIPlaceHolderTextView.h #import Foundation Foundation.h @interface UIPlaceHolderTextView UITextView @property nonatomic retain NSString placeholder @property nonatomic retain UIColor..
How to use NSXMLParser to parse parent-child elements that have the same name http://stackoverflow.com/questions/2005448/how-to-use-nsxmlparser-to-parse-parent-child-elements-that-have-the-same-name on the size of the data you want to manipulate. The following code shows a class that does this job #import Foundation Foundation.h @interface Test NSObject NSXMLParserDelegate @private NSXMLParser xmlParser NSInteger depth NSMutableString currentName..
UISearchBar clear background color or set background image [iphone sdk] http://stackoverflow.com/questions/2139115/uisearchbar-clear-background-color-or-set-background-image-iphone-sdk contenxt CGRectMake 0 0 image.size.width image.size.height image.CGImage @end @ .h #import Foundation Foundation.h #import QuartzCore QuartzCore.h @interface UISearchBar CustomBackground @end Hope this helps share improve this answer..
Storing image in plist http://stackoverflow.com/questions/2486705/storing-image-in-plist that is necessary for storage in plists. But it is fairly easy to add like below. UIImage NSCoder.h #import Foundation Foundation.h @interface UIImage MyExtensions void encodeWithCoder NSCoder encoder id initWithCoder NSCoder decoder @end UIImage NSCoder.m..
How Do I write a Timer in Objective-C? http://stackoverflow.com/questions/3519562/how-do-i-write-a-timer-in-objective-c Edit Added methods for timeElapsedInMilliseconds and timeElapsedInMinutes Timer.h #import Foundation Foundation.h @interface Timer NSObject NSDate start NSDate end void startTimer void stopTimer double timeElapsedInSeconds double timeElapsedInMilliseconds..
CLLocation Category for Calculating Bearing w/ Haversine function http://stackoverflow.com/questions/3925942/cllocation-category-for-calculating-bearing-w-haversine-function question and I'm still just not getting something. Thanks Here's my category CLLocation Bearing.h #import Foundation Foundation.h #import CoreLocation CoreLocation.h @interface CLLocation Bearing double bearingToLocation CLLocation destinationLocation..
What's the easiest way to get the current location of an iPhone? http://stackoverflow.com/questions/459355/whats-the-easiest-way-to-get-the-current-location-of-an-iphone I wrote. Please note that it is a little rough around the edges #import CoreLocation CoreLocation.h #import Foundation Foundation.h @interface LocationController NSObject CLLocationManagerDelegate CLLocationManager locationManager CLLocation currentLocation..
NSURLConnection and grand central dispatch http://stackoverflow.com/questions/5037545/nsurlconnection-and-grand-central-dispatch Central Dispatch I wrote a wrapper class for asynchronous NSURLConnection. AsyncURLConnection.h #import Foundation Foundation.h typedef void ^completeBlock_t NSData data typedef void ^errorBlock_t NSError error @interface AsyncURLConnection NSObject..
create uibutton subclass http://stackoverflow.com/questions/5045672/create-uibutton-subclass UIControlStateNormal cell addSubview button button release my activityindicatorbutton class #import Foundation Foundation.h @interface ActivityIndicatorButton UIButton UIActivityIndicatorView _activityView void startAnimating void stopAnimating..
Return to app behavior after phone call different in native code than UIWebView http://stackoverflow.com/questions/5317783/return-to-app-behavior-after-phone-call-different-in-native-code-than-uiwebview a tel URL request in an instance of UIWebView without adding it to your view hierarchy. For example #import Foundation Foundation.h #import UIKit UIKit.h @interface PhoneCaller NSObject @private UIWebView webview void callTelURL NSURL url @end @implementation..
Subclass UIButton to add a property http://stackoverflow.com/questions/5500327/subclass-uibutton-to-add-a-property instead. It is much cleaner and will work on all instances of UIButton . UIButton Property.h #import Foundation Foundation.h @interface UIButton Property @property nonatomic retain NSObject property @end UIButton Property.m #import UIButton Property.h..
Is there a way to pass touches through on the iPhone? http://stackoverflow.com/questions/631427/is-there-a-way-to-pass-touches-through-on-the-iphone event Rather than disposing of the touch event it is passed on. Sub classed UIButton MyButton.h #import Foundation Foundation.h @interface MyButton UIButton void touchesBegan NSSet touches withEvent UIEvent event @end MyButton.m #import MyButton.h..
What is the best way to deal with the NSDateFormatter locale “feature”? http://stackoverflow.com/questions/6613110/what-is-the-best-way-to-deal-with-the-nsdateformatter-locale-feature extended. Update Re OMZ's proposal here is what I'm finding Here is the category version h file #import Foundation Foundation.h @interface NSDateFormatter Locale id initWithSafeLocale @end Category m file #import NSDateFormatter Locale.h @implementation..
iCloud basics and code sample [closed] http://stackoverflow.com/questions/7795629/icloud-basics-and-code-sample on your phone you should check settings return YES @end The UIDocument MyTextDocument.h iCloudText #import Foundation Foundation.h #import ViewController.h @interface MyTextDocument UIDocument NSString documentText id delegate @property nonatomic retain..
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 with the pin in the detail view controller. I have a simple MKAnnotation class that looks like #import Foundation Foundation.h #import MapKit MapKit.h @interface VoiceMemoryAnnotation NSObject MKAnnotation NSString blobkey @property nonatomic retain..
|