Refer
http://stackoverflow.com/questions/11737658/how-to-chain-different-caanimation-in-an-ios-application
gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:
, or perhaps without delegation by making the pan recognizer depend on the swipe recognizer withrequireGestureRecognizerToFail:
.- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer { return YES; } |
requireGestureRecognizerToFail is a method we can use of to negate one gesture
@interface NSString (Capitals)
-(NSString *)alternateCaps:(NSString *)aString;
@end
@implementation NSString (Capitals)
-(NSString *)alternateCaps:(NSString *)aString
{
// Implementation
}
// someClass.m
@interface someClass (extension)
-(void)extend;
@end
@implementation someClass
// all the methods declared in the .h file and any superclass
// overrides in this block
@end
@implementation someClass (extension)
-(void)extend {
// implement private method here;
}
// someClass.m
@interface someClass ()
-(void)extend;
@end
@implementation someClass
// all the methods declared in the .h file and any superclass
// overrides in this block
// Implement private methods in this block as well.
-(void)extend {
// implement private method here;
}
@end
Refer
http://stackoverflow.com/questions/360968/category-usage-in-objective-c?rq=1
You can't add instance variables in categories.
However, you can add storage for your attribute to an object using associative references. Note that if you need to add more than one attribute, rather than adding an associative reference for each, you're probably better off adding a single reference to (say) an NSMutableDictionary, CFMutableDictionaryRef, or NSMapTable and using that for all of your attributes.
Here some Code:
Filename: NSObject+dictionary.h
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
@interface NSObject (dictionary)
- (NSMutableDictionary*) getDictionary;
@end
Filename: NSObject+dictionary.h
#import "NSObject+dictionary.h"
@implementation NSObject (dictionary)
- (NSMutableDictionary*) getDictionary
{
if (objc_getAssociatedObject(self, @"dictionary")==nil)
{
objc_setAssociatedObject(self,@"dictionary",[[NSMutableDictionary alloc] init],OBJC_ASSOCIATION_RETAIN);
}
return (NSMutableDictionary *)objc_getAssociatedObject(self, @"dictionary");
}
Now every instance (of every class) has a dictionary, where you can store your custom attributes. WithKey-Value Coding you can set a value like this:
[myObject setValue:attributeValue forKeyPath:@"dictionary.attributeName"]
And you can get the value like this:
[myObject valueForKeyPath:@"dictionary.attributeName"]
That even works great with the Interface Builder and User Defined Runtime Attributes.
Key Path Type Value
dictionary.attributeName String(or other Type) attributeValue
Key |
Description
|
---|---|
Include this key if your app requires (or specifically prohibits) the presence of the Phone app. You might require this feature if your app opens URLs with the
tel scheme. | |
Include this key if your app requires (or specifically prohibits) access to the networking features of the device.
| |
Include this key if your app requires (or specifically prohibits) the presence of the Messages app. You might require this feature if your app opens URLs with the
sms scheme. | |
Include this key if your app requires (or specifically prohibits) the presence of a camera on the device. Apps use the
UIImagePickerController interface to capture images from the device’s still camera. | |
Include this key if your app requires (or specifically prohibits) auto-focus capabilities in the device’s still camera. Although most developers should not need to include this key, you might include it if your app supports macro photography or requires sharper images in order to do some sort of image processing.
| |
Include this key if your app requires (or specifically prohibits) the presence of a forward-facing camera. Apps use the
UIImagePickerController interface to capture video from the device’s camera. | |
Include this key if your app requires (or specifically prohibits) the presence of a camera flash for taking pictures or shooting video. Apps use the
UIImagePickerController interface to control the enabling of this feature. | |
Include this key if your app requires (or specifically prohibits) the presence of a camera with video capabilities on the device. Apps use the
UIImagePickerController interface to capture video from the device’s camera. | |
Include this key if your app requires (or specifically prohibits) the presence of accelerometers on the device. Apps use the classes of the Core Motion framework to receive accelerometer events. You do not need to include this key if your app detects only device orientation changes.
| |
Include this key if your app requires (or specifically prohibits) the presence of a gyroscope on the device. Apps use the Core Motion framework to retrieve information from gyroscope hardware.
| |
Include this key if your app requires (or specifically prohibits) the ability to retrieve the device’s current location using the Core Location framework. (This key refers to the general location services feature. If you specifically need GPS-level accuracy, you should also include the
gps key.) | |
Include this key if your app requires (or specifically prohibits) the presence of GPS (or AGPS) hardware for greater accuracy when tracking locations. If you include this key, you should also include the
location-services key. You should require GPS only if your app needs more accurate location data than the cell or Wi-fi radios might otherwise allow. | |
Include this key if your app requires (or specifically prohibits) the presence of magnetometer hardware. Apps use this hardware to receive heading-related events through the Core Location framework.
| |
Include this key if your app requires (or specifically prohibits) Game Center (iOS 4.1 and later.)
| |
Include this key if your app uses the built-in microphone or supports accessories that provide a microphone.
| |
Include this key if your app requires (or specifically prohibits) the presence of the OpenGL ES 1.1 interfaces.
| |
Include this key if your app requires (or specifically prohibits) the presence of the OpenGL ES 2.0 interfaces.
| |
Include this key if your app is compiled only for the armv6 instruction set. (iOS v3.1 and later.)
| |
Include this key if your app is compiled only for the armv7 instruction set. (iOS v3.1 and later.)
| |
Include this key if your app requires (or specifically prohibits) peer-to-peer connectivity over Bluetooth. (iOS v3.1 and later.)
| |
Include this key if your app requires (or specifically prohibits) the presence of Bluetooth low-energy hardware on the device. (iOS 5 and later.)
|