/* Foundation.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #include #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #endif #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || TARGET_OS_WIN32 #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #endif #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #endif /* FoundationErrors.h Copyright (c) 2004-2012, Apple Inc. All rights reserved. */ #import /* NSError codes in NSCocoaErrorDomain. Note that other frameworks (such as AppKit and CoreData) also provide additional NSCocoaErrorDomain error codes. */ enum { // File system and file I/O related errors, with NSFilePathErrorKey or NSURLErrorKey containing path or URL NSFileNoSuchFileError = 4, // Attempt to do a file system operation on a non-existent file NSFileLockingError = 255, // Couldn't get a lock on file NSFileReadUnknownError = 256, // Read error (reason unknown) NSFileReadNoPermissionError = 257, // Read error (permission problem) NSFileReadInvalidFileNameError = 258, // Read error (invalid file name) NSFileReadCorruptFileError = 259, // Read error (file corrupt, bad format, etc) NSFileReadNoSuchFileError = 260, // Read error (no such file) NSFileReadInapplicableStringEncodingError = 261, // Read error (string encoding not applicable) also NSStringEncodingErrorKey NSFileReadUnsupportedSchemeError = 262, // Read error (unsupported URL scheme) NSFileReadTooLargeError NS_ENUM_AVAILABLE(10_5, 2_0) = 263, // Read error (file too large) NSFileReadUnknownStringEncodingError NS_ENUM_AVAILABLE(10_5, 2_0) = 264, // Read error (string encoding of file contents could not be determined) NSFileWriteUnknownError = 512, // Write error (reason unknown) NSFileWriteNoPermissionError = 513, // Write error (permission problem) NSFileWriteInvalidFileNameError = 514, // Write error (invalid file name) NSFileWriteFileExistsError NS_ENUM_AVAILABLE(10_7, 5_0) = 516, // Write error (file exists) NSFileWriteInapplicableStringEncodingError = 517, // Write error (string encoding not applicable) also NSStringEncodingErrorKey NSFileWriteUnsupportedSchemeError = 518, // Write error (unsupported URL scheme) NSFileWriteOutOfSpaceError = 640, // Write error (out of disk space) NSFileWriteVolumeReadOnlyError NS_ENUM_AVAILABLE(10_6, 4_0) = 642, // Write error (readonly volume) // Other errors NSKeyValueValidationError = 1024, // KVC validation error NSFormattingError = 2048, // Formatting error NSUserCancelledError = 3072, // User cancelled operation (this one often doesn't deserve a panel and might be a good one to special case) NSFeatureUnsupportedError NS_ENUM_AVAILABLE(10_8, 6_0) = 3328, // Feature unsupported error // Executable loading errors NSExecutableNotLoadableError NS_ENUM_AVAILABLE(10_5, 2_0) = 3584, // Executable is of a type that is not loadable in the current process NSExecutableArchitectureMismatchError NS_ENUM_AVAILABLE(10_5, 2_0) = 3585, // Executable does not provide an architecture compatible with the current process NSExecutableRuntimeMismatchError NS_ENUM_AVAILABLE(10_5, 2_0) = 3586, // Executable has Objective C runtime information incompatible with the current process NSExecutableLoadError NS_ENUM_AVAILABLE(10_5, 2_0) = 3587, // Executable cannot be loaded for some other reason, such as a problem with a library it depends on NSExecutableLinkError NS_ENUM_AVAILABLE(10_5, 2_0) = 3588, // Executable fails due to linking issues // Inclusive error range definitions, for checking future error codes NSFileErrorMinimum = 0, NSFileErrorMaximum = 1023, NSValidationErrorMinimum = 1024, NSValidationErrorMaximum = 2047, NSExecutableErrorMinimum NS_ENUM_AVAILABLE(10_5, 2_0) = 3584, NSExecutableErrorMaximum NS_ENUM_AVAILABLE(10_5, 2_0) = 3839, NSFormattingErrorMinimum = 2048, NSFormattingErrorMaximum = 2559, NSPropertyListReadCorruptError NS_ENUM_AVAILABLE(10_6, 4_0) = 3840, // Error parsing a property list NSPropertyListReadUnknownVersionError NS_ENUM_AVAILABLE(10_6, 4_0) = 3841, // The version number in the property list is unknown NSPropertyListReadStreamError NS_ENUM_AVAILABLE(10_6, 4_0) = 3842, // Stream error reading a property list NSPropertyListWriteStreamError NS_ENUM_AVAILABLE(10_6, 4_0) = 3851, // Stream error writing a property list NSPropertyListErrorMinimum NS_ENUM_AVAILABLE(10_6, 4_0) = 3840, NSPropertyListErrorMaximum NS_ENUM_AVAILABLE(10_6, 4_0) = 4095, NSXPCConnectionInterrupted NS_ENUM_AVAILABLE(10_8, 6_0) = 4097, NSXPCConnectionInvalid NS_ENUM_AVAILABLE(10_8, 6_0) = 4099, NSXPCConnectionReplyInvalid NS_ENUM_AVAILABLE(10_8, 6_0) = 4101, NSXPCConnectionErrorMinimum NS_ENUM_AVAILABLE(10_8, 6_0) = 4096, NSXPCConnectionErrorMaximum NS_ENUM_AVAILABLE(10_8, 6_0) = 4224 }; /* NSArray.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import #import #import #import @class NSData, NSIndexSet, NSString, NSURL; /**************** Immutable Array ****************/ @interface NSArray : NSObject - (NSUInteger)count; - (id)objectAtIndex:(NSUInteger)index; @end @interface NSArray (NSExtendedArray) - (NSArray *)arrayByAddingObject:(id)anObject; - (NSArray *)arrayByAddingObjectsFromArray:(NSArray *)otherArray; - (NSString *)componentsJoinedByString:(NSString *)separator; - (BOOL)containsObject:(id)anObject; - (NSString *)description; - (NSString *)descriptionWithLocale:(id)locale; - (NSString *)descriptionWithLocale:(id)locale indent:(NSUInteger)level; - (id)firstObjectCommonWithArray:(NSArray *)otherArray; - (void)getObjects:(id __unsafe_unretained [])objects range:(NSRange)range; - (NSUInteger)indexOfObject:(id)anObject; - (NSUInteger)indexOfObject:(id)anObject inRange:(NSRange)range; - (NSUInteger)indexOfObjectIdenticalTo:(id)anObject; - (NSUInteger)indexOfObjectIdenticalTo:(id)anObject inRange:(NSRange)range; - (BOOL)isEqualToArray:(NSArray *)otherArray; - (id)lastObject; - (NSEnumerator *)objectEnumerator; - (NSEnumerator *)reverseObjectEnumerator; - (NSData *)sortedArrayHint; - (NSArray *)sortedArrayUsingFunction:(NSInteger (*)(id, id, void *))comparator context:(void *)context; - (NSArray *)sortedArrayUsingFunction:(NSInteger (*)(id, id, void *))comparator context:(void *)context hint:(NSData *)hint; - (NSArray *)sortedArrayUsingSelector:(SEL)comparator; - (NSArray *)subarrayWithRange:(NSRange)range; - (BOOL)writeToFile:(NSString *)path atomically:(BOOL)useAuxiliaryFile; - (BOOL)writeToURL:(NSURL *)url atomically:(BOOL)atomically; - (void)makeObjectsPerformSelector:(SEL)aSelector; - (void)makeObjectsPerformSelector:(SEL)aSelector withObject:(id)argument; - (NSArray *)objectsAtIndexes:(NSIndexSet *)indexes; - (id)objectAtIndexedSubscript:(NSUInteger)idx NS_AVAILABLE(10_8, 6_0); #if NS_BLOCKS_AVAILABLE - (void)enumerateObjectsUsingBlock:(void (^)(id obj, NSUInteger idx, BOOL *stop))block NS_AVAILABLE(10_6, 4_0); - (void)enumerateObjectsWithOptions:(NSEnumerationOptions)opts usingBlock:(void (^)(id obj, NSUInteger idx, BOOL *stop))block NS_AVAILABLE(10_6, 4_0); - (void)enumerateObjectsAtIndexes:(NSIndexSet *)s options:(NSEnumerationOptions)opts usingBlock:(void (^)(id obj, NSUInteger idx, BOOL *stop))block NS_AVAILABLE(10_6, 4_0); - (NSUInteger)indexOfObjectPassingTest:(BOOL (^)(id obj, NSUInteger idx, BOOL *stop))predicate NS_AVAILABLE(10_6, 4_0); - (NSUInteger)indexOfObjectWithOptions:(NSEnumerationOptions)opts passingTest:(BOOL (^)(id obj, NSUInteger idx, BOOL *stop))predicate NS_AVAILABLE(10_6, 4_0); - (NSUInteger)indexOfObjectAtIndexes:(NSIndexSet *)s options:(NSEnumerationOptions)opts passingTest:(BOOL (^)(id obj, NSUInteger idx, BOOL *stop))predicate NS_AVAILABLE(10_6, 4_0); - (NSIndexSet *)indexesOfObjectsPassingTest:(BOOL (^)(id obj, NSUInteger idx, BOOL *stop))predicate NS_AVAILABLE(10_6, 4_0); - (NSIndexSet *)indexesOfObjectsWithOptions:(NSEnumerationOptions)opts passingTest:(BOOL (^)(id obj, NSUInteger idx, BOOL *stop))predicate NS_AVAILABLE(10_6, 4_0); - (NSIndexSet *)indexesOfObjectsAtIndexes:(NSIndexSet *)s options:(NSEnumerationOptions)opts passingTest:(BOOL (^)(id obj, NSUInteger idx, BOOL *stop))predicate NS_AVAILABLE(10_6, 4_0); - (NSArray *)sortedArrayUsingComparator:(NSComparator)cmptr NS_AVAILABLE(10_6, 4_0); - (NSArray *)sortedArrayWithOptions:(NSSortOptions)opts usingComparator:(NSComparator)cmptr NS_AVAILABLE(10_6, 4_0); typedef NS_OPTIONS(NSUInteger, NSBinarySearchingOptions) { NSBinarySearchingFirstEqual = (1UL << 8), NSBinarySearchingLastEqual = (1UL << 9), NSBinarySearchingInsertionIndex = (1UL << 10), }; - (NSUInteger)indexOfObject:(id)obj inSortedRange:(NSRange)r options:(NSBinarySearchingOptions)opts usingComparator:(NSComparator)cmp NS_AVAILABLE(10_6, 4_0); // binary search #endif @end @interface NSArray (NSArrayCreation) + (id)array; + (id)arrayWithObject:(id)anObject; + (id)arrayWithObjects:(const id [])objects count:(NSUInteger)cnt; + (id)arrayWithObjects:(id)firstObj, ... NS_REQUIRES_NIL_TERMINATION; + (id)arrayWithArray:(NSArray *)array; - (id)initWithObjects:(const id [])objects count:(NSUInteger)cnt; - (id)initWithObjects:(id)firstObj, ... NS_REQUIRES_NIL_TERMINATION; - (id)initWithArray:(NSArray *)array; - (id)initWithArray:(NSArray *)array copyItems:(BOOL)flag; + (id)arrayWithContentsOfFile:(NSString *)path; + (id)arrayWithContentsOfURL:(NSURL *)url; - (id)initWithContentsOfFile:(NSString *)path; - (id)initWithContentsOfURL:(NSURL *)url; @end @interface NSArray (NSDeprecated) /* This method is unsafe because it could potentially cause buffer overruns. You should use -getObjects:range: instead. */ - (void)getObjects:(id __unsafe_unretained [])objects; @end /**************** Mutable Array ****************/ @interface NSMutableArray : NSArray - (void)addObject:(id)anObject; - (void)insertObject:(id)anObject atIndex:(NSUInteger)index; - (void)removeLastObject; - (void)removeObjectAtIndex:(NSUInteger)index; - (void)replaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject; @end @interface NSMutableArray (NSExtendedMutableArray) - (void)addObjectsFromArray:(NSArray *)otherArray; - (void)exchangeObjectAtIndex:(NSUInteger)idx1 withObjectAtIndex:(NSUInteger)idx2; - (void)removeAllObjects; - (void)removeObject:(id)anObject inRange:(NSRange)range; - (void)removeObject:(id)anObject; - (void)removeObjectIdenticalTo:(id)anObject inRange:(NSRange)range; - (void)removeObjectIdenticalTo:(id)anObject; - (void)removeObjectsFromIndices:(NSUInteger *)indices numIndices:(NSUInteger)cnt NS_DEPRECATED(10_0, 10_6, 2_0, 4_0); - (void)removeObjectsInArray:(NSArray *)otherArray; - (void)removeObjectsInRange:(NSRange)range; - (void)replaceObjectsInRange:(NSRange)range withObjectsFromArray:(NSArray *)otherArray range:(NSRange)otherRange; - (void)replaceObjectsInRange:(NSRange)range withObjectsFromArray:(NSArray *)otherArray; - (void)setArray:(NSArray *)otherArray; - (void)sortUsingFunction:(NSInteger (*)(id, id, void *))compare context:(void *)context; - (void)sortUsingSelector:(SEL)comparator; - (void)insertObjects:(NSArray *)objects atIndexes:(NSIndexSet *)indexes; - (void)removeObjectsAtIndexes:(NSIndexSet *)indexes; - (void)replaceObjectsAtIndexes:(NSIndexSet *)indexes withObjects:(NSArray *)objects; - (void)setObject:(id)obj atIndexedSubscript:(NSUInteger)idx NS_AVAILABLE(10_8, 6_0); #if NS_BLOCKS_AVAILABLE - (void)sortUsingComparator:(NSComparator)cmptr NS_AVAILABLE(10_6, 4_0); - (void)sortWithOptions:(NSSortOptions)opts usingComparator:(NSComparator)cmptr NS_AVAILABLE(10_6, 4_0); #endif @end @interface NSMutableArray (NSMutableArrayCreation) + (id)arrayWithCapacity:(NSUInteger)numItems; - (id)initWithCapacity:(NSUInteger)numItems; @end /* NSAttributedString.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import #import NS_CLASS_AVAILABLE(10_0, 3_2) @interface NSAttributedString : NSObject - (NSString *)string; - (NSDictionary *)attributesAtIndex:(NSUInteger)location effectiveRange:(NSRangePointer)range; @end @interface NSAttributedString (NSExtendedAttributedString) - (NSUInteger)length; - (id)attribute:(NSString *)attrName atIndex:(NSUInteger)location effectiveRange:(NSRangePointer)range; - (NSAttributedString *)attributedSubstringFromRange:(NSRange)range; - (NSDictionary *)attributesAtIndex:(NSUInteger)location longestEffectiveRange:(NSRangePointer)range inRange:(NSRange)rangeLimit; - (id)attribute:(NSString *)attrName atIndex:(NSUInteger)location longestEffectiveRange:(NSRangePointer)range inRange:(NSRange)rangeLimit; - (BOOL)isEqualToAttributedString:(NSAttributedString *)other; - (id)initWithString:(NSString *)str; - (id)initWithString:(NSString *)str attributes:(NSDictionary *)attrs; - (id)initWithAttributedString:(NSAttributedString *)attrStr; typedef NS_OPTIONS(NSUInteger, NSAttributedStringEnumerationOptions) { NSAttributedStringEnumerationReverse = (1UL << 1), NSAttributedStringEnumerationLongestEffectiveRangeNotRequired = (1UL << 20) }; #if NS_BLOCKS_AVAILABLE - (void)enumerateAttributesInRange:(NSRange)enumerationRange options:(NSAttributedStringEnumerationOptions)opts usingBlock:(void (^)(NSDictionary *attrs, NSRange range, BOOL *stop))block NS_AVAILABLE(10_6, 4_0); - (void)enumerateAttribute:(NSString *)attrName inRange:(NSRange)enumerationRange options:(NSAttributedStringEnumerationOptions)opts usingBlock:(void (^)(id value, NSRange range, BOOL *stop))block NS_AVAILABLE(10_6, 4_0); #endif @end NS_CLASS_AVAILABLE(10_0, 3_2) @interface NSMutableAttributedString : NSAttributedString - (void)replaceCharactersInRange:(NSRange)range withString:(NSString *)str; - (void)setAttributes:(NSDictionary *)attrs range:(NSRange)range; @end @interface NSMutableAttributedString (NSExtendedMutableAttributedString) - (NSMutableString *)mutableString; - (void)addAttribute:(NSString *)name value:(id)value range:(NSRange)range; - (void)addAttributes:(NSDictionary *)attrs range:(NSRange)range; - (void)removeAttribute:(NSString *)name range:(NSRange)range; - (void)replaceCharactersInRange:(NSRange)range withAttributedString:(NSAttributedString *)attrString; - (void)insertAttributedString:(NSAttributedString *)attrString atIndex:(NSUInteger)loc; - (void)appendAttributedString:(NSAttributedString *)attrString; - (void)deleteCharactersInRange:(NSRange)range; - (void)setAttributedString:(NSAttributedString *)attrString; - (void)beginEditing; - (void)endEditing; @end /* NSAutoreleasePool.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import NS_AUTOMATED_REFCOUNT_UNAVAILABLE @interface NSAutoreleasePool : NSObject { @private void *_token; void *_reserved3; void *_reserved2; void *_reserved; } + (void)addObject:(id)anObject; - (void)addObject:(id)anObject; - (void)drain; @end /* NSBundle.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import @class NSArray, NSDictionary, NSString, NSURL, NSError; /* Because NSBundle caches allocated instances, subclasses should be prepared to receive an already initialized object back from [super initWithPath:] */ @interface NSBundle : NSObject { @private NSUInteger _flags; id _cfBundle; NSUInteger _reserved2; Class _principalClass; id _tmp1; id _tmp2; void *_reserved1; void *_reserved0; } /* Methods for creating or retrieving bundle instances. */ + (NSBundle *)mainBundle; + (NSBundle *)bundleWithPath:(NSString *)path; - (id)initWithPath:(NSString *)path; + (NSBundle *)bundleWithURL:(NSURL *)url NS_AVAILABLE(10_6, 4_0); - (id)initWithURL:(NSURL *)url NS_AVAILABLE(10_6, 4_0); + (NSBundle *)bundleForClass:(Class)aClass; + (NSBundle *)bundleWithIdentifier:(NSString *)identifier; + (NSArray *)allBundles; + (NSArray *)allFrameworks; /* Methods for loading and unloading bundles. */ - (BOOL)load; - (BOOL)isLoaded; - (BOOL)unload; - (BOOL)preflightAndReturnError:(NSError **)error NS_AVAILABLE(10_5, 2_0); - (BOOL)loadAndReturnError:(NSError **)error NS_AVAILABLE(10_5, 2_0); /* Methods for locating various components of a bundle. */ - (NSURL *)bundleURL NS_AVAILABLE(10_6, 4_0); - (NSURL *)resourceURL NS_AVAILABLE(10_6, 4_0); - (NSURL *)executableURL NS_AVAILABLE(10_6, 4_0); - (NSURL *)URLForAuxiliaryExecutable:(NSString *)executableName NS_AVAILABLE(10_6, 4_0); - (NSURL *)privateFrameworksURL NS_AVAILABLE(10_6, 4_0); - (NSURL *)sharedFrameworksURL NS_AVAILABLE(10_6, 4_0); - (NSURL *)sharedSupportURL NS_AVAILABLE(10_6, 4_0); - (NSURL *)builtInPlugInsURL NS_AVAILABLE(10_6, 4_0); - (NSURL *)appStoreReceiptURL NS_AVAILABLE_MAC(10_7); - (NSString *)bundlePath; - (NSString *)resourcePath; - (NSString *)executablePath; - (NSString *)pathForAuxiliaryExecutable:(NSString *)executableName; - (NSString *)privateFrameworksPath; - (NSString *)sharedFrameworksPath; - (NSString *)sharedSupportPath; - (NSString *)builtInPlugInsPath; /* Methods for locating bundle resources. Instance methods locate resources in the bundle indicated by the receiver; class methods take an argument pointing to a bundle on disk. In the class methods, bundleURL is a URL pointing to the location of a bundle on disk, and may not be nil; bundlePath is the path equivalent of bundleURL, an absolute path pointing to the location of a bundle on disk. By contrast, subpath is a relative path to a subdirectory inside the relevant global or localized resource directory, and should be nil if the resource file in question is not in a subdirectory. Where appropriate, localizationName is the name of a .lproj directory in the bundle, minus the .lproj extension; passing nil for localizationName retrieves only global resources, whereas using a method without this argument retrieves both global and localized resources (using the standard localization search algorithm). */ + (NSURL *)URLForResource:(NSString *)name withExtension:(NSString *)ext subdirectory:(NSString *)subpath inBundleWithURL:(NSURL *)bundleURL NS_AVAILABLE(10_6, 4_0); + (NSArray *)URLsForResourcesWithExtension:(NSString *)ext subdirectory:(NSString *)subpath inBundleWithURL:(NSURL *)bundleURL NS_AVAILABLE(10_6, 4_0); - (NSURL *)URLForResource:(NSString *)name withExtension:(NSString *)ext NS_AVAILABLE(10_6, 4_0); - (NSURL *)URLForResource:(NSString *)name withExtension:(NSString *)ext subdirectory:(NSString *)subpath NS_AVAILABLE(10_6, 4_0); - (NSURL *)URLForResource:(NSString *)name withExtension:(NSString *)ext subdirectory:(NSString *)subpath localization:(NSString *)localizationName NS_AVAILABLE(10_6, 4_0); - (NSArray *)URLsForResourcesWithExtension:(NSString *)ext subdirectory:(NSString *)subpath NS_AVAILABLE(10_6, 4_0); - (NSArray *)URLsForResourcesWithExtension:(NSString *)ext subdirectory:(NSString *)subpath localization:(NSString *)localizationName NS_AVAILABLE(10_6, 4_0); + (NSString *)pathForResource:(NSString *)name ofType:(NSString *)ext inDirectory:(NSString *)bundlePath; + (NSArray *)pathsForResourcesOfType:(NSString *)ext inDirectory:(NSString *)bundlePath; - (NSString *)pathForResource:(NSString *)name ofType:(NSString *)ext; - (NSString *)pathForResource:(NSString *)name ofType:(NSString *)ext inDirectory:(NSString *)subpath; - (NSString *)pathForResource:(NSString *)name ofType:(NSString *)ext inDirectory:(NSString *)subpath forLocalization:(NSString *)localizationName; - (NSArray *)pathsForResourcesOfType:(NSString *)ext inDirectory:(NSString *)subpath; - (NSArray *)pathsForResourcesOfType:(NSString *)ext inDirectory:(NSString *)subpath forLocalization:(NSString *)localizationName; /* Method for retrieving localized strings. */ - (NSString *)localizedStringForKey:(NSString *)key value:(NSString *)value table:(NSString *)tableName NS_FORMAT_ARGUMENT(1); /* Methods for obtaining various information about a bundle. */ - (NSString *)bundleIdentifier; - (NSDictionary *)infoDictionary; - (NSDictionary *)localizedInfoDictionary; - (id)objectForInfoDictionaryKey:(NSString *)key; - (Class)classNamed:(NSString *)className; - (Class)principalClass; /* Methods for dealing with localizations. */ - (NSArray *)localizations; - (NSArray *)preferredLocalizations; - (NSString *)developmentLocalization; + (NSArray *)preferredLocalizationsFromArray:(NSArray *)localizationsArray; + (NSArray *)preferredLocalizationsFromArray:(NSArray *)localizationsArray forPreferences:(NSArray *)preferencesArray; /* Method for determining executable architectures. */ enum { NSBundleExecutableArchitectureI386 = 0x00000007, NSBundleExecutableArchitecturePPC = 0x00000012, NSBundleExecutableArchitectureX86_64 = 0x01000007, NSBundleExecutableArchitecturePPC64 = 0x01000012 }; - (NSArray *)executableArchitectures NS_AVAILABLE(10_5, 2_0); @end #define NSLocalizedString(key, comment) \ [[NSBundle mainBundle] localizedStringForKey:(key) value:@"" table:nil] #define NSLocalizedStringFromTable(key, tbl, comment) \ [[NSBundle mainBundle] localizedStringForKey:(key) value:@"" table:(tbl)] #define NSLocalizedStringFromTableInBundle(key, tbl, bundle, comment) \ [bundle localizedStringForKey:(key) value:@"" table:(tbl)] #define NSLocalizedStringWithDefaultValue(key, tbl, bundle, val, comment) \ [bundle localizedStringForKey:(key) value:(val) table:(tbl)] FOUNDATION_EXPORT NSString * const NSBundleDidLoadNotification; FOUNDATION_EXPORT NSString * const NSLoadedClasses; // notification key /* NSByteCountFormatter.h Copyright (c) 2012, Apple Inc. All rights reserved. */ #import typedef NS_OPTIONS(NSUInteger, NSByteCountFormatterUnits) { // This causes default units appropriate for the platform to be used. Specifying any units explicitly causes just those units to be used in showing the number. NSByteCountFormatterUseDefault = 0, // Specifying any of the following causes the specified units to be used in showing the number. NSByteCountFormatterUseBytes = 1UL << 0, NSByteCountFormatterUseKB = 1UL << 1, NSByteCountFormatterUseMB = 1UL << 2, NSByteCountFormatterUseGB = 1UL << 3, NSByteCountFormatterUseTB = 1UL << 4, NSByteCountFormatterUsePB = 1UL << 5, NSByteCountFormatterUseEB = 1UL << 6, NSByteCountFormatterUseZB = 1UL << 7, NSByteCountFormatterUseYBOrHigher = 0x0FFUL << 8, // Can use any unit in showing the number. NSByteCountFormatterUseAll = 0x0FFFFUL }; typedef NS_ENUM(NSInteger, NSByteCountFormatterCountStyle) { // Specifies display of file or storage byte counts. The actual behavior for this is platform-specific; on OS X 10.8, this uses the decimal style, but that may change over time. NSByteCountFormatterCountStyleFile = 0, // Specifies display of memory byte counts. The actual behavior for this is platform-specific; on OS X 10.8, this uses the binary style, but that may change over time. NSByteCountFormatterCountStyleMemory = 1, // The following two allow specifying the number of bytes for KB explicitly. It's better to use one of the above values in most cases. NSByteCountFormatterCountStyleDecimal = 2, // 1000 bytes are shown as 1 KB NSByteCountFormatterCountStyleBinary = 3 // 1024 bytes are shown as 1 KB }; NS_CLASS_AVAILABLE(10_8, 6_0) @interface NSByteCountFormatter : NSFormatter { @private unsigned int _allowedUnits; char _countStyle; BOOL _allowsNonnumericFormatting, _includesUnit, _includesCount, _includesActualByteCount, _adaptive, _zeroPadsFractionDigits; int _reserved[6]; } /* Shortcut for converting a byte count into a string without creating an NSByteCountFormatter and an NSNumber. If you need to specify options other than countStyle, create an instance of NSByteCountFormatter first. */ + (NSString *)stringFromByteCount:(long long)byteCount countStyle:(NSByteCountFormatterCountStyle)countStyle; /* Convenience method on stringForObjectValue:. Convert a byte count into a string without creating an NSNumber. */ - (NSString *)stringFromByteCount:(long long)byteCount; /* Specify the units that can be used in the output. If NSByteCountFormatterUseDefault, uses platform-appropriate settings; otherwise will only use the specified units. This is the default value. Note that ZB and YB cannot be covered by the range of possible values, but you can still choose to use these units to get fractional display ("0.0035 ZB" for instance). */ @property NSByteCountFormatterUnits allowedUnits; /* Specify how the count is displayed by indicating the number of bytes to be used for kilobyte. The default setting is NSByteCountFormatterFileCount, which is the system specific value for file and storage sizes. */ @property NSByteCountFormatterCountStyle countStyle; /* Choose whether to allow more natural display of some values, such as zero, where it may be displayed as "Zero KB," ignoring all other flags or options (with the exception of NSByteCountFormatterUseBytes, which would generate "Zero bytes"). The result is appropriate for standalone output. Default value is YES. Special handling of certain values such as zero is especially important in some languages, so it's highly recommended that this property be left in its default state. */ @property BOOL allowsNonnumericFormatting; /* Choose whether to include the number or the units in the resulting formatted string. (For example, instead of 723 KB, returns "723" or "KB".) You can call the API twice to get both parts, separately. But note that putting them together yourself via string concatenation may be wrong for some locales; so use this functionality with care. Both of these values are YES by default. Setting both to NO will unsurprisingly result in an empty string. */ @property BOOL includesUnit; @property BOOL includesCount; /* Choose whether to parenthetically (localized as appropriate) display the actual number of bytes as well, for instance "723 KB (722,842 bytes)". This will happen only if needed, that is, the first part is already not showing the exact byte count. If includesUnit or includesCount are NO, then this setting has no effect. Default value is NO. */ @property BOOL includesActualByteCount; /* Choose the display style. The "adaptive" algorithm is platform specific and uses a different number of fraction digits based on the magnitude (in 10.8: 0 fraction digits for bytes and KB; 1 fraction digits for MB; 2 for GB and above). Otherwise the result always tries to show at least three significant digits, introducing fraction digits as necessary. Default is YES. */ @property (getter=isAdaptive) BOOL adaptive; /* Choose whether to zero pad fraction digits so a consistent number of fraction digits are displayed, causing updating displays to remain more stable. For instance, if the adaptive algorithm is used, this option formats 1.19 and 1.2 GB as "1.19 GB" and "1.20 GB" respectively, while without the option the latter would be displayed as "1.2 GB". Default value is NO. */ @property BOOL zeroPadsFractionDigits; @end /* NSByteOrder.h Copyright (c) 1995-2012, Apple Inc. All rights reserved. */ #import #import enum { NS_UnknownByteOrder = CFByteOrderUnknown, NS_LittleEndian = CFByteOrderLittleEndian, NS_BigEndian = CFByteOrderBigEndian }; NS_INLINE long NSHostByteOrder(void) { return CFByteOrderGetCurrent(); } NS_INLINE unsigned short NSSwapShort(unsigned short inv) { return CFSwapInt16(inv); } NS_INLINE unsigned int NSSwapInt(unsigned int inv) { return CFSwapInt32(inv); } NS_INLINE unsigned long NSSwapLong(unsigned long inv) { #if __LP64__ return CFSwapInt64(inv); #else return CFSwapInt32(inv); #endif } NS_INLINE unsigned long long NSSwapLongLong(unsigned long long inv) { return CFSwapInt64(inv); } NS_INLINE unsigned short NSSwapBigShortToHost(unsigned short x) { return CFSwapInt16BigToHost(x); } NS_INLINE unsigned int NSSwapBigIntToHost(unsigned int x) { return CFSwapInt32BigToHost(x); } NS_INLINE unsigned long NSSwapBigLongToHost(unsigned long x) { #if __LP64__ return CFSwapInt64BigToHost(x); #else return CFSwapInt32BigToHost(x); #endif } NS_INLINE unsigned long long NSSwapBigLongLongToHost(unsigned long long x) { return CFSwapInt64BigToHost(x); } NS_INLINE unsigned short NSSwapHostShortToBig(unsigned short x) { return CFSwapInt16HostToBig(x); } NS_INLINE unsigned int NSSwapHostIntToBig(unsigned int x) { return CFSwapInt32HostToBig(x); } NS_INLINE unsigned long NSSwapHostLongToBig(unsigned long x) { #if __LP64__ return CFSwapInt64HostToBig(x); #else return CFSwapInt32HostToBig(x); #endif } NS_INLINE unsigned long long NSSwapHostLongLongToBig(unsigned long long x) { return CFSwapInt64HostToBig(x); } NS_INLINE unsigned short NSSwapLittleShortToHost(unsigned short x) { return CFSwapInt16LittleToHost(x); } NS_INLINE unsigned int NSSwapLittleIntToHost(unsigned int x) { return CFSwapInt32LittleToHost(x); } NS_INLINE unsigned long NSSwapLittleLongToHost(unsigned long x) { #if __LP64__ return CFSwapInt64LittleToHost(x); #else return CFSwapInt32LittleToHost(x); #endif } NS_INLINE unsigned long long NSSwapLittleLongLongToHost(unsigned long long x) { return CFSwapInt64LittleToHost(x); } NS_INLINE unsigned short NSSwapHostShortToLittle(unsigned short x) { return CFSwapInt16HostToLittle(x); } NS_INLINE unsigned int NSSwapHostIntToLittle(unsigned int x) { return CFSwapInt32HostToLittle(x); } NS_INLINE unsigned long NSSwapHostLongToLittle(unsigned long x) { #if __LP64__ return CFSwapInt64HostToLittle(x); #else return CFSwapInt32HostToLittle(x); #endif } NS_INLINE unsigned long long NSSwapHostLongLongToLittle(unsigned long long x) { return CFSwapInt64HostToLittle(x); } typedef struct {unsigned int v;} NSSwappedFloat; typedef struct {unsigned long long v;} NSSwappedDouble; NS_INLINE NSSwappedFloat NSConvertHostFloatToSwapped(float x) { union fconv { float number; NSSwappedFloat sf; }; return ((union fconv *)&x)->sf; } NS_INLINE float NSConvertSwappedFloatToHost(NSSwappedFloat x) { union fconv { float number; NSSwappedFloat sf; }; return ((union fconv *)&x)->number; } NS_INLINE NSSwappedDouble NSConvertHostDoubleToSwapped(double x) { union dconv { double number; NSSwappedDouble sd; }; return ((union dconv *)&x)->sd; } NS_INLINE double NSConvertSwappedDoubleToHost(NSSwappedDouble x) { union dconv { double number; NSSwappedDouble sd; }; return ((union dconv *)&x)->number; } NS_INLINE NSSwappedFloat NSSwapFloat(NSSwappedFloat x) { x.v = NSSwapInt(x.v); return x; } NS_INLINE NSSwappedDouble NSSwapDouble(NSSwappedDouble x) { x.v = NSSwapLongLong(x.v); return x; } #if defined(__BIG_ENDIAN__) NS_INLINE double NSSwapBigDoubleToHost(NSSwappedDouble x) { return NSConvertSwappedDoubleToHost(x); } NS_INLINE float NSSwapBigFloatToHost(NSSwappedFloat x) { return NSConvertSwappedFloatToHost(x); } NS_INLINE NSSwappedDouble NSSwapHostDoubleToBig(double x) { return NSConvertHostDoubleToSwapped(x); } NS_INLINE NSSwappedFloat NSSwapHostFloatToBig(float x) { return NSConvertHostFloatToSwapped(x); } NS_INLINE double NSSwapLittleDoubleToHost(NSSwappedDouble x) { return NSConvertSwappedDoubleToHost(NSSwapDouble(x)); } NS_INLINE float NSSwapLittleFloatToHost(NSSwappedFloat x) { return NSConvertSwappedFloatToHost(NSSwapFloat(x)); } NS_INLINE NSSwappedDouble NSSwapHostDoubleToLittle(double x) { return NSSwapDouble(NSConvertHostDoubleToSwapped(x)); } NS_INLINE NSSwappedFloat NSSwapHostFloatToLittle(float x) { return NSSwapFloat(NSConvertHostFloatToSwapped(x)); } #elif defined(__LITTLE_ENDIAN__) NS_INLINE double NSSwapBigDoubleToHost(NSSwappedDouble x) { return NSConvertSwappedDoubleToHost(NSSwapDouble(x)); } NS_INLINE float NSSwapBigFloatToHost(NSSwappedFloat x) { return NSConvertSwappedFloatToHost(NSSwapFloat(x)); } NS_INLINE NSSwappedDouble NSSwapHostDoubleToBig(double x) { return NSSwapDouble(NSConvertHostDoubleToSwapped(x)); } NS_INLINE NSSwappedFloat NSSwapHostFloatToBig(float x) { return NSSwapFloat(NSConvertHostFloatToSwapped(x)); } NS_INLINE double NSSwapLittleDoubleToHost(NSSwappedDouble x) { return NSConvertSwappedDoubleToHost(x); } NS_INLINE float NSSwapLittleFloatToHost(NSSwappedFloat x) { return NSConvertSwappedFloatToHost(x); } NS_INLINE NSSwappedDouble NSSwapHostDoubleToLittle(double x) { return NSConvertHostDoubleToSwapped(x); } NS_INLINE NSSwappedFloat NSSwapHostFloatToLittle(float x) { return NSConvertHostFloatToSwapped(x); } #else #error Do not know the endianess of this architecture #endif /* NSCache.h Copyright (c) 2008-2012, Apple Inc. All rights reserved. */ #import @class NSString; @protocol NSCacheDelegate; NS_CLASS_AVAILABLE(10_6, 4_0) @interface NSCache : NSObject { @private id _delegate; void *_private[5]; void *_reserved; } - (void)setName:(NSString *)n; - (NSString *)name; - (void)setDelegate:(id )d; - (id )delegate; - (id)objectForKey:(id)key; - (void)setObject:(id)obj forKey:(id)key; // 0 cost - (void)setObject:(id)obj forKey:(id)key cost:(NSUInteger)g; - (void)removeObjectForKey:(id)key; - (void)removeAllObjects; - (void)setTotalCostLimit:(NSUInteger)lim; - (NSUInteger)totalCostLimit; // limits are imprecise/not strict - (void)setCountLimit:(NSUInteger)lim; - (NSUInteger)countLimit; // limits are imprecise/not strict - (BOOL)evictsObjectsWithDiscardedContent; - (void)setEvictsObjectsWithDiscardedContent:(BOOL)b; @end @protocol NSCacheDelegate @optional - (void)cache:(NSCache *)cache willEvictObject:(id)obj; @end /* NSCalendar.h Copyright (c) 2004-2012, Apple Inc. All rights reserved. */ #import #import #import #include @class NSDateComponents, NSLocale, NSTimeZone, NSString; typedef NS_ENUM(NSUInteger, NSCalendarUnit) { NSEraCalendarUnit = kCFCalendarUnitEra, NSYearCalendarUnit = kCFCalendarUnitYear, NSMonthCalendarUnit = kCFCalendarUnitMonth, NSDayCalendarUnit = kCFCalendarUnitDay, NSHourCalendarUnit = kCFCalendarUnitHour, NSMinuteCalendarUnit = kCFCalendarUnitMinute, NSSecondCalendarUnit = kCFCalendarUnitSecond, NSWeekCalendarUnit = kCFCalendarUnitWeek /* NS_DEPRECATED(10_4, 10_7, 2_0, 5_0) */, NSWeekdayCalendarUnit = kCFCalendarUnitWeekday, NSWeekdayOrdinalCalendarUnit = kCFCalendarUnitWeekdayOrdinal, NSQuarterCalendarUnit NS_ENUM_AVAILABLE(10_6, 4_0) = kCFCalendarUnitQuarter, NSWeekOfMonthCalendarUnit NS_ENUM_AVAILABLE(10_7, 5_0) = kCFCalendarUnitWeekOfMonth, NSWeekOfYearCalendarUnit NS_ENUM_AVAILABLE(10_7, 5_0) = kCFCalendarUnitWeekOfYear, NSYearForWeekOfYearCalendarUnit NS_ENUM_AVAILABLE(10_7, 5_0) = kCFCalendarUnitYearForWeekOfYear, NSCalendarCalendarUnit NS_ENUM_AVAILABLE(10_7, 4_0) = (1 << 20), NSTimeZoneCalendarUnit NS_ENUM_AVAILABLE(10_7, 4_0) = (1 << 21), }; @interface NSCalendar : NSObject + (id)currentCalendar; // users preferred calendar, tracks changes + (id)autoupdatingCurrentCalendar NS_AVAILABLE(10_5, 2_0); - (id)initWithCalendarIdentifier:(NSString *)ident; - (NSString *)calendarIdentifier; - (void)setLocale:(NSLocale *)locale; - (NSLocale *)locale; - (void)setTimeZone:(NSTimeZone *)tz; - (NSTimeZone *)timeZone; - (void)setFirstWeekday:(NSUInteger)weekday; - (NSUInteger)firstWeekday; - (void)setMinimumDaysInFirstWeek:(NSUInteger)mdw; - (NSUInteger)minimumDaysInFirstWeek; - (NSRange)minimumRangeOfUnit:(NSCalendarUnit)unit; - (NSRange)maximumRangeOfUnit:(NSCalendarUnit)unit; - (NSRange)rangeOfUnit:(NSCalendarUnit)smaller inUnit:(NSCalendarUnit)larger forDate:(NSDate *)date; - (NSUInteger)ordinalityOfUnit:(NSCalendarUnit)smaller inUnit:(NSCalendarUnit)larger forDate:(NSDate *)date; - (BOOL)rangeOfUnit:(NSCalendarUnit)unit startDate:(NSDate **)datep interval:(NSTimeInterval *)tip forDate:(NSDate *)date NS_AVAILABLE(10_5, 2_0); - (NSDate *)dateFromComponents:(NSDateComponents *)comps; - (NSDateComponents *)components:(NSUInteger)unitFlags fromDate:(NSDate *)date; - (NSDate *)dateByAddingComponents:(NSDateComponents *)comps toDate:(NSDate *)date options:(NSUInteger)opts; - (NSDateComponents *)components:(NSUInteger)unitFlags fromDate:(NSDate *)startingDate toDate:(NSDate *)resultDate options:(NSUInteger)opts; @end enum { NSWrapCalendarComponents = kCFCalendarComponentsWrap, // option for adding }; // This is a just used as an extensible struct, basically; // note that there are two uses: one for specifying a date // via components (some components may be missing, making the // specific date ambiguous), and the other for specifying a // set of component quantities (like, 3 months and 5 hours). // Undefined fields have (or fields can be set to) the value // NSUndefinedDateComponent. // NSDateComponents is not responsible for answering questions // about a date beyond the information it has been initialized // with; for example, if you initialize one with May 6, 2004, // and then ask for the weekday, you'll get Undefined, not Thurs. // A NSDateComponents is meaningless in itself, because you need // to know what calendar it is interpreted against, and you need // to know whether the values are absolute values of the units, // or quantities of the units. // When you create a new one of these, all values begin Undefined. enum { NSUndefinedDateComponent = NSIntegerMax }; @interface NSDateComponents : NSObject - (NSCalendar *)calendar NS_AVAILABLE(10_7, 4_0); - (NSTimeZone *)timeZone NS_AVAILABLE(10_7, 4_0); - (NSInteger)era; - (NSInteger)year; - (NSInteger)month; - (NSInteger)day; - (NSInteger)hour; - (NSInteger)minute; - (NSInteger)second; - (NSInteger)week; - (NSInteger)weekday; - (NSInteger)weekdayOrdinal; - (NSInteger)quarter NS_AVAILABLE(10_6, 4_0); - (NSInteger)weekOfMonth NS_AVAILABLE(10_7, 5_0); - (NSInteger)weekOfYear NS_AVAILABLE(10_7, 5_0); - (NSInteger)yearForWeekOfYear NS_AVAILABLE(10_7, 5_0); - (BOOL)isLeapMonth NS_AVAILABLE(10_8, 6_0); - (void)setCalendar:(NSCalendar *)cal NS_AVAILABLE(10_7, 4_0); - (void)setTimeZone:(NSTimeZone *)tz NS_AVAILABLE(10_7, 4_0); - (void)setEra:(NSInteger)v; - (void)setYear:(NSInteger)v; - (void)setMonth:(NSInteger)v; - (void)setDay:(NSInteger)v; - (void)setHour:(NSInteger)v; - (void)setMinute:(NSInteger)v; - (void)setSecond:(NSInteger)v; - (void)setWeek:(NSInteger)v; - (void)setWeekday:(NSInteger)v; - (void)setWeekdayOrdinal:(NSInteger)v; - (void)setQuarter:(NSInteger)v NS_AVAILABLE(10_6, 4_0); - (void)setWeekOfMonth:(NSInteger)w NS_AVAILABLE(10_7, 5_0); - (void)setWeekOfYear:(NSInteger)w NS_AVAILABLE(10_7, 5_0); - (void)setYearForWeekOfYear:(NSInteger)y NS_AVAILABLE(10_7, 5_0); - (void)setLeapMonth:(BOOL)lm NS_AVAILABLE(10_8, 6_0); - (NSDate *)date NS_AVAILABLE(10_7, 4_0); @end /* NSCharacterSet.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import #import #import #import @class NSData; enum { NSOpenStepUnicodeReservedBase = 0xF400 }; @interface NSCharacterSet : NSObject + (id)controlCharacterSet; + (id)whitespaceCharacterSet; + (id)whitespaceAndNewlineCharacterSet; + (id)decimalDigitCharacterSet; + (id)letterCharacterSet; + (id)lowercaseLetterCharacterSet; + (id)uppercaseLetterCharacterSet; + (id)nonBaseCharacterSet; + (id)alphanumericCharacterSet; + (id)decomposableCharacterSet; + (id)illegalCharacterSet; + (id)punctuationCharacterSet; + (id)capitalizedLetterCharacterSet; + (id)symbolCharacterSet; + (id)newlineCharacterSet NS_AVAILABLE(10_5, 2_0); + (id)characterSetWithRange:(NSRange)aRange; + (id)characterSetWithCharactersInString:(NSString *)aString; + (id)characterSetWithBitmapRepresentation:(NSData *)data; + (id)characterSetWithContentsOfFile:(NSString *)fName; - (BOOL)characterIsMember:(unichar)aCharacter; - (NSData *)bitmapRepresentation; - (NSCharacterSet *)invertedSet; - (BOOL)longCharacterIsMember:(UTF32Char)theLongChar; - (BOOL)isSupersetOfSet:(NSCharacterSet *)theOtherSet; - (BOOL)hasMemberInPlane:(uint8_t)thePlane; @end @interface NSMutableCharacterSet : NSCharacterSet - (void)addCharactersInRange:(NSRange)aRange; - (void)removeCharactersInRange:(NSRange)aRange; - (void)addCharactersInString:(NSString *)aString; - (void)removeCharactersInString:(NSString *)aString; - (void)formUnionWithCharacterSet:(NSCharacterSet *)otherSet; - (void)formIntersectionWithCharacterSet:(NSCharacterSet *)otherSet; - (void)invert; @end /* NSCoder.h Copyright (c) 1993-2012, Apple Inc. All rights reserved. */ #import @class NSString, NSData, NSSet; @interface NSCoder : NSObject - (void)encodeValueOfObjCType:(const char *)type at:(const void *)addr; - (void)encodeDataObject:(NSData *)data; - (void)decodeValueOfObjCType:(const char *)type at:(void *)data; - (NSData *)decodeDataObject; - (NSInteger)versionForClassName:(NSString *)className; @end @interface NSCoder (NSExtendedCoder) - (void)encodeObject:(id)object; - (void)encodeRootObject:(id)rootObject; - (void)encodeBycopyObject:(id)anObject; - (void)encodeByrefObject:(id)anObject; - (void)encodeConditionalObject:(id)object; - (void)encodeValuesOfObjCTypes:(const char *)types, ...; - (void)encodeArrayOfObjCType:(const char *)type count:(NSUInteger)count at:(const void *)array; - (void)encodeBytes:(const void *)byteaddr length:(NSUInteger)length; - (id)decodeObject; - (void)decodeValuesOfObjCTypes:(const char *)types, ...; - (void)decodeArrayOfObjCType:(const char *)itemType count:(NSUInteger)count at:(void *)array; - (void *)decodeBytesWithReturnedLength:(NSUInteger *)lengthp NS_RETURNS_INNER_POINTER; #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) - (void)encodePropertyList:(id)aPropertyList; - (id)decodePropertyList; #endif - (void)setObjectZone:(NSZone *)zone NS_AUTOMATED_REFCOUNT_UNAVAILABLE; - (NSZone *)objectZone NS_AUTOMATED_REFCOUNT_UNAVAILABLE; - (unsigned)systemVersion; - (BOOL)allowsKeyedCoding; - (void)encodeObject:(id)objv forKey:(NSString *)key; - (void)encodeConditionalObject:(id)objv forKey:(NSString *)key; - (void)encodeBool:(BOOL)boolv forKey:(NSString *)key; - (void)encodeInt:(int)intv forKey:(NSString *)key; - (void)encodeInt32:(int32_t)intv forKey:(NSString *)key; - (void)encodeInt64:(int64_t)intv forKey:(NSString *)key; - (void)encodeFloat:(float)realv forKey:(NSString *)key; - (void)encodeDouble:(double)realv forKey:(NSString *)key; - (void)encodeBytes:(const uint8_t *)bytesp length:(NSUInteger)lenv forKey:(NSString *)key; - (BOOL)containsValueForKey:(NSString *)key; - (id)decodeObjectForKey:(NSString *)key; - (BOOL)decodeBoolForKey:(NSString *)key; - (int)decodeIntForKey:(NSString *)key; - (int32_t)decodeInt32ForKey:(NSString *)key; - (int64_t)decodeInt64ForKey:(NSString *)key; - (float)decodeFloatForKey:(NSString *)key; - (double)decodeDoubleForKey:(NSString *)key; - (const uint8_t *)decodeBytesForKey:(NSString *)key returnedLength:(NSUInteger *)lengthp NS_RETURNS_INNER_POINTER; // returned bytes immutable! - (void)encodeInteger:(NSInteger)intv forKey:(NSString *)key NS_AVAILABLE(10_5, 2_0); - (NSInteger)decodeIntegerForKey:(NSString *)key NS_AVAILABLE(10_5, 2_0); // Returns YES if this coder requires secure coding. Secure coders check a list of allowed classes before decoding objects, and all objects must implement NSSecureCoding. - (BOOL)requiresSecureCoding NS_AVAILABLE(10_8, 6_0); // Specify what the expected class of the allocated object is. If the coder responds YES to -requiresSecureCoding, then an exception will be thrown if the class to be decoded does not implement NSSecureCoding or is not isKindOfClass: of the argument. If the coder responds NO to -requiresSecureCoding, then the class argument is ignored and no check of the class of the decoded object is performed, exactly as if decodeObjectForKey: had been called. - (id)decodeObjectOfClass:(Class)aClass forKey:(NSString *)key NS_AVAILABLE(10_8, 6_0); // The class of the object may be any class in the provided NSSet, or a subclass of any class in the set. Otherwise, the behavior is the same as -decodeObjectOfClass:forKey:. - (id)decodeObjectOfClasses:(NSSet *)classes forKey:(NSString *)key NS_AVAILABLE(10_8, 6_0); // Calls -decodeObjectOfClasses:forKey: with a set allowing only property list types. - (id)decodePropertyListForKey:(NSString *)key NS_AVAILABLE(10_8, 6_0); // Get the current set of allowed classes. - (NSSet *)allowedClasses NS_AVAILABLE(10_8, 6_0); @end #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) FOUNDATION_EXPORT NSObject *NXReadNSObjectFromCoder(NSCoder *decoder) NS_DEPRECATED(10_0, 10_5, 2_0, 2_0); /* Given an NSCoder, returns an object previously written with NXWriteNSObject(). The returned object is autoreleased. */ @interface NSCoder (NSTypedstreamCompatibility) - (void)encodeNXObject:(id)object NS_DEPRECATED(10_0, 10_5, 2_0, 2_0); /* Writes old-style object onto the coder. No sharing is done across separate -encodeNXObject:. Callers must have implemented an -encodeWithCoder:, which parallels the -write: methods, on all of their classes which may be touched by this operation. Object's -replacementObjectForCoder: compatibility method will take care of calling -startArchiving:. */ - (id)decodeNXObject NS_DEPRECATED(10_0, 10_5, 2_0, 2_0); /* Reads an object previously written with -encodeNXObject:. No sharing is done across separate -decodeNXObject. Callers must have implemented an -initWithCoder:, which parallels the -read: methods, on all of their classes which may be touched by this operation. Object's -awakeAfterUsingCoder: compatibility method will take care of calling -awake and -finishUnarchiving. The returned object is autoreleased. */ @end #endif /* NSComparisonPredicate.h Copyright (c) 2004-2012, Apple Inc. All rights reserved. */ #import // Flags(s) that can be passed to the factory to indicate that a operator operating on strings should do so in a case insensitive fashion. typedef NS_OPTIONS(NSUInteger, NSComparisonPredicateOptions) { NSCaseInsensitivePredicateOption = 0x01, NSDiacriticInsensitivePredicateOption = 0x02, NSNormalizedPredicateOption NS_ENUM_AVAILABLE(10_6, 4_0) = 0x04, /* Indicate that the strings to be compared have been preprocessed; this supersedes other options and is intended as a performance optimization option */ }; // Describes how the operator is modified: can be direct, ALL, or ANY typedef NS_ENUM(NSUInteger, NSComparisonPredicateModifier) { NSDirectPredicateModifier = 0, // Do a direct comparison NSAllPredicateModifier, // ALL toMany.x = y NSAnyPredicateModifier // ANY toMany.x = y }; // Type basic set of operators defined. Most are obvious; NSCustomSelectorPredicateOperatorType allows a developer to create an operator which uses the custom selector specified in the constructor to do the evaluation. typedef NS_ENUM(NSUInteger, NSPredicateOperatorType) { NSLessThanPredicateOperatorType = 0, // compare: returns NSOrderedAscending NSLessThanOrEqualToPredicateOperatorType, // compare: returns NSOrderedAscending || NSOrderedSame NSGreaterThanPredicateOperatorType, // compare: returns NSOrderedDescending NSGreaterThanOrEqualToPredicateOperatorType, // compare: returns NSOrderedDescending || NSOrderedSame NSEqualToPredicateOperatorType, // isEqual: returns true NSNotEqualToPredicateOperatorType, // isEqual: returns false NSMatchesPredicateOperatorType, NSLikePredicateOperatorType, NSBeginsWithPredicateOperatorType, NSEndsWithPredicateOperatorType, NSInPredicateOperatorType, // rhs contains lhs returns true NSCustomSelectorPredicateOperatorType, NSContainsPredicateOperatorType NS_ENUM_AVAILABLE(10_5, 3_0) = 99, // lhs contains rhs returns true NSBetweenPredicateOperatorType NS_ENUM_AVAILABLE(10_5, 3_0) }; @class NSPredicateOperator; @class NSExpression; // Comparison predicates are predicates which do some form of comparison between the results of two expressions and return a BOOL. They take an operator, a left expression, and a right expression, and return the result of invoking the operator with the results of evaluating the expressions. NS_CLASS_AVAILABLE(10_4, 3_0) @interface NSComparisonPredicate : NSPredicate { @private void *_reserved2; NSPredicateOperator *_predicateOperator; NSExpression *_lhs; NSExpression *_rhs; } + (NSPredicate *)predicateWithLeftExpression:(NSExpression *)lhs rightExpression:(NSExpression *)rhs modifier:(NSComparisonPredicateModifier)modifier type:(NSPredicateOperatorType)type options:(NSComparisonPredicateOptions)options; + (NSPredicate *)predicateWithLeftExpression:(NSExpression *)lhs rightExpression:(NSExpression *)rhs customSelector:(SEL)selector; - (id)initWithLeftExpression:(NSExpression *)lhs rightExpression:(NSExpression *)rhs modifier:(NSComparisonPredicateModifier)modifier type:(NSPredicateOperatorType)type options:(NSComparisonPredicateOptions)options; - (id)initWithLeftExpression:(NSExpression *)lhs rightExpression:(NSExpression *)rhs customSelector:(SEL)selector; - (NSPredicateOperatorType)predicateOperatorType; - (NSComparisonPredicateModifier)comparisonPredicateModifier; - (NSExpression *)leftExpression; - (NSExpression *)rightExpression; - (SEL)customSelector; - (NSComparisonPredicateOptions)options; @end /* NSCompoundPredicate.h Copyright (c) 2004-2012, Apple Inc. All rights reserved. */ #import @class NSArray; // Compound predicates are predicates which act on the results of evaluating other operators. We provide the basic boolean operators: AND, OR, and NOT. typedef NS_ENUM(NSUInteger, NSCompoundPredicateType) { NSNotPredicateType = 0, NSAndPredicateType, NSOrPredicateType, }; NS_CLASS_AVAILABLE(10_4, 3_0) @interface NSCompoundPredicate : NSPredicate { @private void *_reserved2; NSUInteger _type; NSArray *_subpredicates; } - (id)initWithType:(NSCompoundPredicateType)type subpredicates:(NSArray *)subpredicates; - (NSCompoundPredicateType)compoundPredicateType; - (NSArray *)subpredicates; /*** Convenience Methods ***/ + (NSPredicate *)andPredicateWithSubpredicates:(NSArray *)subpredicates; + (NSPredicate *)orPredicateWithSubpredicates:(NSArray *)subpredicates; + (NSPredicate *)notPredicateWithSubpredicate:(NSPredicate *)predicate; @end /* NSData.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import #import @class NSString, NSURL, NSError; /**************** Read/Write Options ****************/ typedef NS_OPTIONS(NSUInteger, NSDataReadingOptions) { NSDataReadingMappedIfSafe = 1UL << 0, // Hint to map the file in if possible and safe NSDataReadingUncached = 1UL << 1, // Hint to get the file not to be cached in the kernel NSDataReadingMappedAlways NS_ENUM_AVAILABLE(10_7, 5_0) = 1UL << 3, // Hint to map the file in if possible. This takes precedence over NSDataReadingMappedIfSafe if both are given. // Options with old names for NSData reading methods. Please stop using these old names. NSDataReadingMapped = NSDataReadingMappedIfSafe, // Deprecated name for NSDataReadingMappedIfSafe NSMappedRead = NSDataReadingMapped, // Deprecated name for NSDataReadingMapped NSUncachedRead = NSDataReadingUncached // Deprecated name for NSDataReadingUncached }; typedef NS_OPTIONS(NSUInteger, NSDataWritingOptions) { NSDataWritingAtomic = 1UL << 0, // Hint to use auxiliary file when saving; equivalent to atomically:YES NSDataWritingWithoutOverwriting NS_ENUM_AVAILABLE(10_8, 6_0) = 1UL << 1, // Hint to return prevent overwriting an existing file. Cannot be combined with NSDataWritingAtomic. NSDataWritingFileProtectionNone NS_ENUM_AVAILABLE_IOS(4_0) = 0x10000000, NSDataWritingFileProtectionComplete NS_ENUM_AVAILABLE_IOS(4_0) = 0x20000000, NSDataWritingFileProtectionCompleteUnlessOpen NS_ENUM_AVAILABLE_IOS(5_0) = 0x30000000, NSDataWritingFileProtectionCompleteUntilFirstUserAuthentication NS_ENUM_AVAILABLE_IOS(5_0) = 0x40000000, NSDataWritingFileProtectionMask NS_ENUM_AVAILABLE_IOS(4_0) = 0xf0000000, // Options with old names for NSData writing methods. Please stop using these old names. NSAtomicWrite = NSDataWritingAtomic // Deprecated name for NSDataWritingAtomic }; /**************** Data Search Options ****************/ typedef NS_OPTIONS(NSUInteger, NSDataSearchOptions) { NSDataSearchBackwards = 1UL << 0, NSDataSearchAnchored = 1UL << 1 } NS_ENUM_AVAILABLE(10_6, 4_0); /**************** Immutable Data ****************/ @interface NSData : NSObject - (NSUInteger)length; - (const void *)bytes NS_RETURNS_INNER_POINTER; @end @interface NSData (NSExtendedData) - (NSString *)description; - (void)getBytes:(void *)buffer length:(NSUInteger)length; - (void)getBytes:(void *)buffer range:(NSRange)range; - (BOOL)isEqualToData:(NSData *)other; - (NSData *)subdataWithRange:(NSRange)range; - (BOOL)writeToFile:(NSString *)path atomically:(BOOL)useAuxiliaryFile; - (BOOL)writeToURL:(NSURL *)url atomically:(BOOL)atomically; // the atomically flag is ignored if the url is not of a type the supports atomic writes - (BOOL)writeToFile:(NSString *)path options:(NSDataWritingOptions)writeOptionsMask error:(NSError **)errorPtr; - (BOOL)writeToURL:(NSURL *)url options:(NSDataWritingOptions)writeOptionsMask error:(NSError **)errorPtr; - (NSRange)rangeOfData:(NSData *)dataToFind options:(NSDataSearchOptions)mask range:(NSRange)searchRange NS_AVAILABLE(10_6, 4_0); @end @interface NSData (NSDataCreation) + (id)data; + (id)dataWithBytes:(const void *)bytes length:(NSUInteger)length; + (id)dataWithBytesNoCopy:(void *)bytes length:(NSUInteger)length; + (id)dataWithBytesNoCopy:(void *)bytes length:(NSUInteger)length freeWhenDone:(BOOL)b; + (id)dataWithContentsOfFile:(NSString *)path options:(NSDataReadingOptions)readOptionsMask error:(NSError **)errorPtr; + (id)dataWithContentsOfURL:(NSURL *)url options:(NSDataReadingOptions)readOptionsMask error:(NSError **)errorPtr; + (id)dataWithContentsOfFile:(NSString *)path; + (id)dataWithContentsOfURL:(NSURL *)url; - (id)initWithBytes:(const void *)bytes length:(NSUInteger)length; - (id)initWithBytesNoCopy:(void *)bytes length:(NSUInteger)length; - (id)initWithBytesNoCopy:(void *)bytes length:(NSUInteger)length freeWhenDone:(BOOL)b; - (id)initWithContentsOfFile:(NSString *)path options:(NSDataReadingOptions)readOptionsMask error:(NSError **)errorPtr; - (id)initWithContentsOfURL:(NSURL *)url options:(NSDataReadingOptions)readOptionsMask error:(NSError **)errorPtr; - (id)initWithContentsOfFile:(NSString *)path; - (id)initWithContentsOfURL:(NSURL *)url; - (id)initWithData:(NSData *)data; + (id)dataWithData:(NSData *)data; @end @interface NSData (NSDeprecated) /* This method is unsafe because it could potentially cause buffer overruns. You should use -getBytes:length: or -getBytes:range: instead. */ - (void)getBytes:(void *)buffer; /* These methods are deprecated. You should use +dataWithContentsOfURL:options:error: or -initWithContentsOfURL:options:error: with NSDataReadingMappedIfSafe or NSDataReadingMappedAlways instead. */ + (id)dataWithContentsOfMappedFile:(NSString *)path; - (id)initWithContentsOfMappedFile:(NSString *)path; @end /**************** Mutable Data ****************/ @interface NSMutableData : NSData - (void *)mutableBytes NS_RETURNS_INNER_POINTER; - (void)setLength:(NSUInteger)length; @end @interface NSMutableData (NSExtendedMutableData) - (void)appendBytes:(const void *)bytes length:(NSUInteger)length; - (void)appendData:(NSData *)other; - (void)increaseLengthBy:(NSUInteger)extraLength; - (void)replaceBytesInRange:(NSRange)range withBytes:(const void *)bytes; - (void)resetBytesInRange:(NSRange)range; - (void)setData:(NSData *)data; - (void)replaceBytesInRange:(NSRange)range withBytes:(const void *)replacementBytes length:(NSUInteger)replacementLength; @end @interface NSMutableData (NSMutableDataCreation) + (id)dataWithCapacity:(NSUInteger)aNumItems; + (id)dataWithLength:(NSUInteger)length; - (id)initWithCapacity:(NSUInteger)capacity; - (id)initWithLength:(NSUInteger)length; @end /**************** Purgeable Data ****************/ NS_CLASS_AVAILABLE(10_6, 4_0) @interface NSPurgeableData : NSMutableData { @private NSUInteger _length; int32_t _accessCount; uint8_t _private[32]; void *_reserved; } @end /* NSDate.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import @class NSString; FOUNDATION_EXPORT NSString * const NSSystemClockDidChangeNotification NS_AVAILABLE(10_6, 4_0); typedef double NSTimeInterval; #define NSTimeIntervalSince1970 978307200.0 @interface NSDate : NSObject - (NSTimeInterval)timeIntervalSinceReferenceDate; @end @interface NSDate (NSExtendedDate) - (NSTimeInterval)timeIntervalSinceDate:(NSDate *)anotherDate; - (NSTimeInterval)timeIntervalSinceNow; - (NSTimeInterval)timeIntervalSince1970; - (id)addTimeInterval:(NSTimeInterval)seconds NS_DEPRECATED(10_0, 10_6, 2_0, 4_0); - (id)dateByAddingTimeInterval:(NSTimeInterval)ti NS_AVAILABLE(10_6, 2_0); - (NSDate *)earlierDate:(NSDate *)anotherDate; - (NSDate *)laterDate:(NSDate *)anotherDate; - (NSComparisonResult)compare:(NSDate *)other; - (BOOL)isEqualToDate:(NSDate *)otherDate; - (NSString *)description; - (NSString *)descriptionWithLocale:(id)locale; + (NSTimeInterval)timeIntervalSinceReferenceDate; @end @interface NSDate (NSDateCreation) + (id)date; + (id)dateWithTimeIntervalSinceNow:(NSTimeInterval)secs; + (id)dateWithTimeIntervalSinceReferenceDate:(NSTimeInterval)secs; + (id)dateWithTimeIntervalSince1970:(NSTimeInterval)secs; + (id)dateWithTimeInterval:(NSTimeInterval)ti sinceDate:(NSDate *)date; + (id)distantFuture; + (id)distantPast; - (id)init; - (id)initWithTimeIntervalSinceNow:(NSTimeInterval)secs; - (id)initWithTimeIntervalSinceReferenceDate:(NSTimeInterval)secsToBeAdded; - (id)initWithTimeIntervalSince1970:(NSTimeInterval)ti; - (id)initWithTimeInterval:(NSTimeInterval)secsToBeAdded sinceDate:(NSDate *)anotherDate; @end /* NSDateFormatter.h Copyright (c) 1995-2012, Apple Inc. All rights reserved. */ #import #include @class NSLocale, NSDate, NSCalendar, NSTimeZone, NSError, NSArray, NSMutableDictionary; @interface NSDateFormatter : NSFormatter { @private NSMutableDictionary *_attributes; __strong CFDateFormatterRef _formatter; NSUInteger _counter; } // - (id)init; // designated initializer // Report the used range of the string and an NSError, in addition to the usual stuff from NSFormatter - (BOOL)getObjectValue:(out id *)obj forString:(NSString *)string range:(inout NSRange *)rangep error:(out NSError **)error; // Even though NSDateFormatter responds to the usual NSFormatter methods, // here are some convenience methods which are a little more obvious. - (NSString *)stringFromDate:(NSDate *)date; - (NSDate *)dateFromString:(NSString *)string; typedef NS_ENUM(NSUInteger, NSDateFormatterStyle) { // date and time format styles NSDateFormatterNoStyle = kCFDateFormatterNoStyle, NSDateFormatterShortStyle = kCFDateFormatterShortStyle, NSDateFormatterMediumStyle = kCFDateFormatterMediumStyle, NSDateFormatterLongStyle = kCFDateFormatterLongStyle, NSDateFormatterFullStyle = kCFDateFormatterFullStyle }; typedef NS_ENUM(NSUInteger, NSDateFormatterBehavior) { NSDateFormatterBehaviorDefault = 0, #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) NSDateFormatterBehavior10_0 = 1000, #endif NSDateFormatterBehavior10_4 = 1040, }; + (NSString *)localizedStringFromDate:(NSDate *)date dateStyle:(NSDateFormatterStyle)dstyle timeStyle:(NSDateFormatterStyle)tstyle NS_AVAILABLE(10_6, 4_0); + (NSString *)dateFormatFromTemplate:(NSString *)tmplate options:(NSUInteger)opts locale:(NSLocale *)locale NS_AVAILABLE(10_6, 4_0); // no options defined, pass 0 for now // Attributes of an NSDateFormatter - (NSString *)dateFormat; - (NSDateFormatterStyle)dateStyle; - (void)setDateStyle:(NSDateFormatterStyle)style; - (NSDateFormatterStyle)timeStyle; - (void)setTimeStyle:(NSDateFormatterStyle)style; - (NSLocale *)locale; - (void)setLocale:(NSLocale *)locale; - (BOOL)generatesCalendarDates; - (void)setGeneratesCalendarDates:(BOOL)b; - (NSDateFormatterBehavior)formatterBehavior; - (void)setFormatterBehavior:(NSDateFormatterBehavior)behavior; + (NSDateFormatterBehavior)defaultFormatterBehavior; + (void)setDefaultFormatterBehavior:(NSDateFormatterBehavior)behavior; - (void)setDateFormat:(NSString *)string; - (NSTimeZone *)timeZone; - (void)setTimeZone:(NSTimeZone *)tz; - (NSCalendar *)calendar; - (void)setCalendar:(NSCalendar *)calendar; - (BOOL)isLenient; - (void)setLenient:(BOOL)b; - (NSDate *)twoDigitStartDate; - (void)setTwoDigitStartDate:(NSDate *)date; - (NSDate *)defaultDate; - (void)setDefaultDate:(NSDate *)date; - (NSArray *)eraSymbols; - (void)setEraSymbols:(NSArray *)array; - (NSArray *)monthSymbols; - (void)setMonthSymbols:(NSArray *)array; - (NSArray *)shortMonthSymbols; - (void)setShortMonthSymbols:(NSArray *)array; - (NSArray *)weekdaySymbols; - (void)setWeekdaySymbols:(NSArray *)array; - (NSArray *)shortWeekdaySymbols; - (void)setShortWeekdaySymbols:(NSArray *)array; - (NSString *)AMSymbol; - (void)setAMSymbol:(NSString *)string; - (NSString *)PMSymbol; - (void)setPMSymbol:(NSString *)string; - (NSArray *)longEraSymbols NS_AVAILABLE(10_5, 2_0); - (void)setLongEraSymbols:(NSArray *)array NS_AVAILABLE(10_5, 2_0); - (NSArray *)veryShortMonthSymbols NS_AVAILABLE(10_5, 2_0); - (void)setVeryShortMonthSymbols:(NSArray *)array NS_AVAILABLE(10_5, 2_0); - (NSArray *)standaloneMonthSymbols NS_AVAILABLE(10_5, 2_0); - (void)setStandaloneMonthSymbols:(NSArray *)array NS_AVAILABLE(10_5, 2_0); - (NSArray *)shortStandaloneMonthSymbols NS_AVAILABLE(10_5, 2_0); - (void)setShortStandaloneMonthSymbols:(NSArray *)array NS_AVAILABLE(10_5, 2_0); - (NSArray *)veryShortStandaloneMonthSymbols NS_AVAILABLE(10_5, 2_0); - (void)setVeryShortStandaloneMonthSymbols:(NSArray *)array NS_AVAILABLE(10_5, 2_0); - (NSArray *)veryShortWeekdaySymbols NS_AVAILABLE(10_5, 2_0); - (void)setVeryShortWeekdaySymbols:(NSArray *)array NS_AVAILABLE(10_5, 2_0); - (NSArray *)standaloneWeekdaySymbols NS_AVAILABLE(10_5, 2_0); - (void)setStandaloneWeekdaySymbols:(NSArray *)array NS_AVAILABLE(10_5, 2_0); - (NSArray *)shortStandaloneWeekdaySymbols NS_AVAILABLE(10_5, 2_0); - (void)setShortStandaloneWeekdaySymbols:(NSArray *)array NS_AVAILABLE(10_5, 2_0); - (NSArray *)veryShortStandaloneWeekdaySymbols NS_AVAILABLE(10_5, 2_0); - (void)setVeryShortStandaloneWeekdaySymbols:(NSArray *)array NS_AVAILABLE(10_5, 2_0); - (NSArray *)quarterSymbols NS_AVAILABLE(10_5, 2_0); - (void)setQuarterSymbols:(NSArray *)array NS_AVAILABLE(10_5, 2_0); - (NSArray *)shortQuarterSymbols NS_AVAILABLE(10_5, 2_0); - (void)setShortQuarterSymbols:(NSArray *)array NS_AVAILABLE(10_5, 2_0); - (NSArray *)standaloneQuarterSymbols NS_AVAILABLE(10_5, 2_0); - (void)setStandaloneQuarterSymbols:(NSArray *)array NS_AVAILABLE(10_5, 2_0); - (NSArray *)shortStandaloneQuarterSymbols NS_AVAILABLE(10_5, 2_0); - (void)setShortStandaloneQuarterSymbols:(NSArray *)array NS_AVAILABLE(10_5, 2_0); - (NSDate *)gregorianStartDate NS_AVAILABLE(10_5, 2_0); - (void)setGregorianStartDate:(NSDate *)date NS_AVAILABLE(10_5, 2_0); - (BOOL)doesRelativeDateFormatting NS_AVAILABLE(10_6, 4_0); - (void)setDoesRelativeDateFormatting:(BOOL)b NS_AVAILABLE(10_6, 4_0); @end #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) @interface NSDateFormatter (NSDateFormatterCompatibility) - (id)initWithDateFormat:(NSString *)format allowNaturalLanguage:(BOOL)flag; - (BOOL)allowsNaturalLanguage; @end #endif /* NSDecimal.h Copyright (c) 1995-2012, Apple Inc. All rights reserved. */ #include #import @class NSDictionary; /*************** Type definitions ***********/ // Rounding policies : // Original // value 1.2 1.21 1.25 1.35 1.27 // Plain 1.2 1.2 1.3 1.4 1.3 // Down 1.2 1.2 1.2 1.3 1.2 // Up 1.2 1.3 1.3 1.4 1.3 // Bankers 1.2 1.2 1.2 1.4 1.3 typedef NS_ENUM(NSUInteger, NSRoundingMode) { NSRoundPlain, // Round up on a tie NSRoundDown, // Always down == truncate NSRoundUp, // Always up NSRoundBankers // on a tie round so last digit is even }; typedef NS_ENUM(NSUInteger, NSCalculationError) { NSCalculationNoError = 0, NSCalculationLossOfPrecision, // Result lost precision NSCalculationUnderflow, // Result became 0 NSCalculationOverflow, // Result exceeds possible representation NSCalculationDivideByZero }; #define NSDecimalMaxSize (8) // Give a precision of at least 38 decimal digits, 128 binary positions. #define NSDecimalNoScale SHRT_MAX typedef struct { signed int _exponent:8; unsigned int _length:4; // length == 0 && isNegative -> NaN unsigned int _isNegative:1; unsigned int _isCompact:1; unsigned int _reserved:18; unsigned short _mantissa[NSDecimalMaxSize]; } NSDecimal; NS_INLINE BOOL NSDecimalIsNotANumber(const NSDecimal *dcm) { return ((dcm->_length == 0) && dcm->_isNegative); } /*************** Operations ***********/ FOUNDATION_EXPORT void NSDecimalCopy(NSDecimal *destination, const NSDecimal *source); FOUNDATION_EXPORT void NSDecimalCompact(NSDecimal *number); FOUNDATION_EXPORT NSComparisonResult NSDecimalCompare(const NSDecimal *leftOperand, const NSDecimal *rightOperand); // NSDecimalCompare:Compares leftOperand and rightOperand. FOUNDATION_EXPORT void NSDecimalRound(NSDecimal *result, const NSDecimal *number, NSInteger scale, NSRoundingMode roundingMode); // Rounds num to the given scale using the given mode. // result may be a pointer to same space as num. // scale indicates number of significant digits after the decimal point FOUNDATION_EXPORT NSCalculationError NSDecimalNormalize(NSDecimal *number1, NSDecimal *number2, NSRoundingMode roundingMode); FOUNDATION_EXPORT NSCalculationError NSDecimalAdd(NSDecimal *result, const NSDecimal *leftOperand, const NSDecimal *rightOperand, NSRoundingMode roundingMode); // Exact operations. result may be a pointer to same space as leftOperand or rightOperand FOUNDATION_EXPORT NSCalculationError NSDecimalSubtract(NSDecimal *result, const NSDecimal *leftOperand, const NSDecimal *rightOperand, NSRoundingMode roundingMode); // Exact operations. result may be a pointer to same space as leftOperand or rightOperand FOUNDATION_EXPORT NSCalculationError NSDecimalMultiply(NSDecimal *result, const NSDecimal *leftOperand, const NSDecimal *rightOperand, NSRoundingMode roundingMode); // Exact operations. result may be a pointer to same space as leftOperand or rightOperand FOUNDATION_EXPORT NSCalculationError NSDecimalDivide(NSDecimal *result, const NSDecimal *leftOperand, const NSDecimal *rightOperand, NSRoundingMode roundingMode); // Division could be silently inexact; // Exact operations. result may be a pointer to same space as leftOperand or rightOperand FOUNDATION_EXPORT NSCalculationError NSDecimalPower(NSDecimal *result, const NSDecimal *number, NSUInteger power, NSRoundingMode roundingMode); FOUNDATION_EXPORT NSCalculationError NSDecimalMultiplyByPowerOf10(NSDecimal *result, const NSDecimal *number, short power, NSRoundingMode roundingMode); FOUNDATION_EXPORT NSString *NSDecimalString(const NSDecimal *dcm, id locale); /* NSDecimalNumber.h Copyright (c) 1995-2012, Apple Inc. All rights reserved. */ #import #import #import #import /*************** Exceptions ***********/ FOUNDATION_EXPORT NSString * const NSDecimalNumberExactnessException; FOUNDATION_EXPORT NSString * const NSDecimalNumberOverflowException; FOUNDATION_EXPORT NSString * const NSDecimalNumberUnderflowException; FOUNDATION_EXPORT NSString * const NSDecimalNumberDivideByZeroException; /*************** Rounding and Exception behavior ***********/ @class NSDecimalNumber; @protocol NSDecimalNumberBehaviors - (NSRoundingMode)roundingMode; - (short)scale; // The scale could return NO_SCALE for no defined scale. - (NSDecimalNumber *)exceptionDuringOperation:(SEL)operation error:(NSCalculationError)error leftOperand:(NSDecimalNumber *)leftOperand rightOperand:(NSDecimalNumber *)rightOperand; // Receiver can raise, return a new value, or return nil to ignore the exception. @end /*************** NSDecimalNumber: the class ***********/ @interface NSDecimalNumber : NSNumber { @private signed int _exponent:8; unsigned int _length:4; unsigned int _isNegative:1; unsigned int _isCompact:1; unsigned int _reserved:1; unsigned int _hasExternalRefCount:1; unsigned int _refs:16; unsigned short _mantissa[0]; /* GCC */ } - (id)initWithMantissa:(unsigned long long)mantissa exponent:(short)exponent isNegative:(BOOL)flag; - (id)initWithDecimal:(NSDecimal)dcm; - (id)initWithString:(NSString *)numberValue; - (id)initWithString:(NSString *)numberValue locale:(id)locale; - (NSString *)descriptionWithLocale:(id)locale; - (NSDecimal)decimalValue; + (NSDecimalNumber *)decimalNumberWithMantissa:(unsigned long long)mantissa exponent:(short)exponent isNegative:(BOOL)flag; + (NSDecimalNumber *)decimalNumberWithDecimal:(NSDecimal)dcm; + (NSDecimalNumber *)decimalNumberWithString:(NSString *)numberValue; + (NSDecimalNumber *)decimalNumberWithString:(NSString *)numberValue locale:(id)locale; + (NSDecimalNumber *)zero; + (NSDecimalNumber *)one; + (NSDecimalNumber *)minimumDecimalNumber; + (NSDecimalNumber *)maximumDecimalNumber; + (NSDecimalNumber *)notANumber; - (NSDecimalNumber *)decimalNumberByAdding:(NSDecimalNumber *)decimalNumber; - (NSDecimalNumber *)decimalNumberByAdding:(NSDecimalNumber *)decimalNumber withBehavior:(id )behavior; - (NSDecimalNumber *)decimalNumberBySubtracting:(NSDecimalNumber *)decimalNumber; - (NSDecimalNumber *)decimalNumberBySubtracting:(NSDecimalNumber *)decimalNumber withBehavior:(id )behavior; - (NSDecimalNumber *)decimalNumberByMultiplyingBy:(NSDecimalNumber *)decimalNumber; - (NSDecimalNumber *)decimalNumberByMultiplyingBy:(NSDecimalNumber *)decimalNumber withBehavior:(id )behavior; - (NSDecimalNumber *)decimalNumberByDividingBy:(NSDecimalNumber *)decimalNumber; - (NSDecimalNumber *)decimalNumberByDividingBy:(NSDecimalNumber *)decimalNumber withBehavior:(id )behavior; - (NSDecimalNumber *)decimalNumberByRaisingToPower:(NSUInteger)power; - (NSDecimalNumber *)decimalNumberByRaisingToPower:(NSUInteger)power withBehavior:(id )behavior; - (NSDecimalNumber *)decimalNumberByMultiplyingByPowerOf10:(short)power; - (NSDecimalNumber *)decimalNumberByMultiplyingByPowerOf10:(short)power withBehavior:(id )behavior; - (NSDecimalNumber *)decimalNumberByRoundingAccordingToBehavior:(id )behavior; // Round to the scale of the behavior. - (NSComparisonResult)compare:(NSNumber *)decimalNumber; // compare two NSDecimalNumbers + (void)setDefaultBehavior:(id )behavior; + (id )defaultBehavior; // One behavior per thread - The default behavior is // rounding mode: NSRoundPlain // scale: No defined scale (full precision) // ignore exactnessException // raise on overflow, underflow and divide by zero. - (const char *)objCType NS_RETURNS_INNER_POINTER; // return 'd' for double - (double)doubleValue; // return an approximate double value @end /*********** A class for defining common behaviors *******/ @interface NSDecimalNumberHandler : NSObject { @private signed int _scale:16; unsigned _roundingMode:3; unsigned _raiseOnExactness:1; unsigned _raiseOnOverflow:1; unsigned _raiseOnUnderflow:1; unsigned _raiseOnDivideByZero:1; unsigned _unused:9; void *_reserved2; void *_reserved; } + (id)defaultDecimalNumberHandler; // rounding mode: NSRoundPlain // scale: No defined scale (full precision) // ignore exactnessException (return nil) // raise on overflow, underflow and divide by zero. - (id)initWithRoundingMode:(NSRoundingMode)roundingMode scale:(short)scale raiseOnExactness:(BOOL)exact raiseOnOverflow:(BOOL)overflow raiseOnUnderflow:(BOOL)underflow raiseOnDivideByZero:(BOOL)divideByZero; + (id)decimalNumberHandlerWithRoundingMode:(NSRoundingMode)roundingMode scale:(short)scale raiseOnExactness:(BOOL)exact raiseOnOverflow:(BOOL)overflow raiseOnUnderflow:(BOOL)underflow raiseOnDivideByZero:(BOOL)divideByZero; @end /*********** Extensions to other classes *******/ @interface NSNumber (NSDecimalNumberExtensions) - (NSDecimal)decimalValue; // Could be silently inexact for float and double. @end @interface NSScanner (NSDecimalNumberScanning) - (BOOL)scanDecimal:(NSDecimal *)dcm; @end /* NSDictionary.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import #import @class NSArray, NSSet, NSString, NSURL; /**************** Immutable Dictionary ****************/ @interface NSDictionary : NSObject - (NSUInteger)count; - (id)objectForKey:(id)aKey; - (NSEnumerator *)keyEnumerator; @end @interface NSDictionary (NSExtendedDictionary) - (NSArray *)allKeys; - (NSArray *)allKeysForObject:(id)anObject; - (NSArray *)allValues; - (NSString *)description; - (NSString *)descriptionInStringsFileFormat; - (NSString *)descriptionWithLocale:(id)locale; - (NSString *)descriptionWithLocale:(id)locale indent:(NSUInteger)level; - (BOOL)isEqualToDictionary:(NSDictionary *)otherDictionary; - (NSEnumerator *)objectEnumerator; - (NSArray *)objectsForKeys:(NSArray *)keys notFoundMarker:(id)marker; - (BOOL)writeToFile:(NSString *)path atomically:(BOOL)useAuxiliaryFile; - (BOOL)writeToURL:(NSURL *)url atomically:(BOOL)atomically; // the atomically flag is ignored if url of a type that cannot be written atomically. - (NSArray *)keysSortedByValueUsingSelector:(SEL)comparator; - (void)getObjects:(id __unsafe_unretained [])objects andKeys:(id __unsafe_unretained [])keys; - (id)objectForKeyedSubscript:(id)key NS_AVAILABLE(10_8, 6_0); #if NS_BLOCKS_AVAILABLE - (void)enumerateKeysAndObjectsUsingBlock:(void (^)(id key, id obj, BOOL *stop))block NS_AVAILABLE(10_6, 4_0); - (void)enumerateKeysAndObjectsWithOptions:(NSEnumerationOptions)opts usingBlock:(void (^)(id key, id obj, BOOL *stop))block NS_AVAILABLE(10_6, 4_0); - (NSArray *)keysSortedByValueUsingComparator:(NSComparator)cmptr NS_AVAILABLE(10_6, 4_0); - (NSArray *)keysSortedByValueWithOptions:(NSSortOptions)opts usingComparator:(NSComparator)cmptr NS_AVAILABLE(10_6, 4_0); - (NSSet *)keysOfEntriesPassingTest:(BOOL (^)(id key, id obj, BOOL *stop))predicate NS_AVAILABLE(10_6, 4_0); - (NSSet *)keysOfEntriesWithOptions:(NSEnumerationOptions)opts passingTest:(BOOL (^)(id key, id obj, BOOL *stop))predicate NS_AVAILABLE(10_6, 4_0); #endif @end @interface NSDictionary (NSDictionaryCreation) + (id)dictionary; + (id)dictionaryWithObject:(id)object forKey:(id )key; #if TARGET_OS_WIN32 + (id)dictionaryWithObjects:(const id [])objects forKeys:(const id [])keys count:(NSUInteger)cnt; #else + (id)dictionaryWithObjects:(const id [])objects forKeys:(const id [])keys count:(NSUInteger)cnt; #endif + (id)dictionaryWithObjectsAndKeys:(id)firstObject, ... NS_REQUIRES_NIL_TERMINATION; + (id)dictionaryWithDictionary:(NSDictionary *)dict; + (id)dictionaryWithObjects:(NSArray *)objects forKeys:(NSArray *)keys; #if TARGET_OS_WIN32 - (id)initWithObjects:(const id [])objects forKeys:(const id [])keys count:(NSUInteger)cnt; #else - (id)initWithObjects:(const id [])objects forKeys:(const id [])keys count:(NSUInteger)cnt; #endif - (id)initWithObjectsAndKeys:(id)firstObject, ... NS_REQUIRES_NIL_TERMINATION; - (id)initWithDictionary:(NSDictionary *)otherDictionary; - (id)initWithDictionary:(NSDictionary *)otherDictionary copyItems:(BOOL)flag; - (id)initWithObjects:(NSArray *)objects forKeys:(NSArray *)keys; + (id)dictionaryWithContentsOfFile:(NSString *)path; + (id)dictionaryWithContentsOfURL:(NSURL *)url; - (id)initWithContentsOfFile:(NSString *)path; - (id)initWithContentsOfURL:(NSURL *)url; @end /**************** Mutable Dictionary ****************/ @interface NSMutableDictionary : NSDictionary - (void)removeObjectForKey:(id)aKey; - (void)setObject:(id)anObject forKey:(id )aKey; @end @interface NSMutableDictionary (NSExtendedMutableDictionary) - (void)addEntriesFromDictionary:(NSDictionary *)otherDictionary; - (void)removeAllObjects; - (void)removeObjectsForKeys:(NSArray *)keyArray; - (void)setDictionary:(NSDictionary *)otherDictionary; - (void)setObject:(id)obj forKeyedSubscript:(id )key NS_AVAILABLE(10_8, 6_0); @end @interface NSMutableDictionary (NSMutableDictionaryCreation) + (id)dictionaryWithCapacity:(NSUInteger)numItems; - (id)initWithCapacity:(NSUInteger)numItems; @end @interface NSDictionary (NSSharedKeySetDictionary) /* Use this method to create a key set to pass to +dictionaryWithSharedKeySet:. The keys are copied from the array and must be copyable. If the array parameter is nil or not an NSArray, an exception is thrown. If the array of keys is empty, an empty key set is returned. The array of keys may contain duplicates, which are ignored (it is undefined which object of each duplicate pair is used). As for any usage of hashing, is recommended that the keys have a well-distributed implementation of -hash, and the hash codes must satisfy the hash/isEqual: invariant. Keys with duplicate hash codes are allowed, but will cause lower performance and increase memory usage. */ + (id)sharedKeySetForKeys:(NSArray *)keys NS_AVAILABLE(10_8, 6_0); @end @interface NSMutableDictionary (NSSharedKeySetDictionary) /* Create a mutable dictionary which is optimized for dealing with a known set of keys. Keys that are not in the key set can still be set into the dictionary, but that usage is not optimal. As with any dictionary, the keys must be copyable. If keyset is nil, an exception is thrown. If keyset is not an object returned by +sharedKeySetForKeys:, an exception is thrown. */ + (id)dictionaryWithSharedKeySet:(id)keyset NS_AVAILABLE(10_8, 6_0); @end /* NSEnumerator.h Copyright (c) 1995-2012, Apple Inc. All rights reserved. */ #import @class NSArray; /* * The fast enumeration protocol NSFastEnumeration is adopted and * implemented by objects wishing to make use of a fast and safe * enumeration style. The language "foreach" construct then can * be used with such objects. * * The abstract class NSEnumerator itself is taught how to do this * for convenience by using -nextObject to return items one at a time. */ typedef struct { unsigned long state; id __unsafe_unretained *itemsPtr; unsigned long *mutationsPtr; unsigned long extra[5]; } NSFastEnumerationState; @protocol NSFastEnumeration - (NSUInteger)countByEnumeratingWithState:(NSFastEnumerationState *)state objects:(id __unsafe_unretained [])buffer count:(NSUInteger)len; @end @interface NSEnumerator : NSObject - (id)nextObject; @end @interface NSEnumerator (NSExtendedEnumerator) - (NSArray *)allObjects; @end /* NSError.h Copyright (c) 2003-2012, Apple Inc. All rights reserved. */ #import @class NSDictionary, NSArray; // Predefined domain for errors from most AppKit and Foundation APIs. FOUNDATION_EXPORT NSString *const NSCocoaErrorDomain; // Other predefined domains; value of "code" will correspond to preexisting values in these domains. FOUNDATION_EXPORT NSString *const NSPOSIXErrorDomain; FOUNDATION_EXPORT NSString *const NSOSStatusErrorDomain; FOUNDATION_EXPORT NSString *const NSMachErrorDomain; // Key in userInfo. A recommended standard way to embed NSErrors from underlying calls. The value of this key should be an NSError. FOUNDATION_EXPORT NSString *const NSUnderlyingErrorKey; // Keys in userInfo, for subsystems wishing to provide their error messages up-front. FOUNDATION_EXPORT NSString *const NSLocalizedDescriptionKey; // NSString FOUNDATION_EXPORT NSString *const NSLocalizedFailureReasonErrorKey ; // NSString FOUNDATION_EXPORT NSString *const NSLocalizedRecoverySuggestionErrorKey; // NSString FOUNDATION_EXPORT NSString *const NSLocalizedRecoveryOptionsErrorKey ; // NSArray of NSStrings FOUNDATION_EXPORT NSString *const NSRecoveryAttempterErrorKey; // Instance of a subclass of NSObject that conforms to the NSErrorRecoveryAttempting informal protocol FOUNDATION_EXPORT NSString *const NSHelpAnchorErrorKey ; // NSString containing a help anchor // Other standard keys in userInfo, for various error codes FOUNDATION_EXPORT NSString *const NSStringEncodingErrorKey ; // NSNumber containing NSStringEncoding FOUNDATION_EXPORT NSString *const NSURLErrorKey ; // NSURL FOUNDATION_EXPORT NSString *const NSFilePathErrorKey ; // NSString @interface NSError : NSObject { @private void *_reserved; NSInteger _code; NSString *_domain; NSDictionary *_userInfo; } /* Designated initializer. Domain cannot be nil; dict may be nil if no userInfo desired. */ - (id)initWithDomain:(NSString *)domain code:(NSInteger)code userInfo:(NSDictionary *)dict; + (id)errorWithDomain:(NSString *)domain code:(NSInteger)code userInfo:(NSDictionary *)dict; /* These define the error. Domains are described by names that are arbitrary strings used to differentiate groups of codes; for custom domain using reverse-DNS naming will help avoid conflicts. Codes are domain-specific. */ - (NSString *)domain; - (NSInteger)code; /* Additional info which may be used to describe the error further. Examples of keys that might be included in here are "Line Number", "Failed URL", etc. Embedding other errors in here can also be used as a way to communicate underlying reasons for failures; for instance "File System Error" embedded in the userInfo of an NSError returned from a higher level document object. If the embedded error information is itself NSError, the standard key NSUnderlyingErrorKey can be used. */ - (NSDictionary *)userInfo; /* The primary user-presentable message for the error. This method can be overridden by subclassers wishing to present better error strings. By default this looks for NSLocalizedDescriptionKey in the user info. If not present, it manufactures a string from the domain and code. Also, for some of the built-in domains it knows about, it might try to fetch an error string by calling a domain-specific function. In the absence of a custom error string, the manufactured one might not be suitable for presentation to the user, but can be used in logs or debugging. */ - (NSString *)localizedDescription; /* Return a complete sentence which describes why the operation failed. In many cases this will be just the "because" part of the error message (but as a complete sentence, which makes localization easier). This will return nil if string is not available. Default implementation of this will pick up the value of the NSLocalizedFailureReasonErrorKey from the userInfo dictionary. */ - (NSString *)localizedFailureReason; /* Return the string that can be displayed as the "informative" (aka "secondary") message on an alert panel. Returns nil if no such string is available. Default implementation of this will pick up the value of the NSLocalizedRecoverySuggestionErrorKey from the userInfo dictionary. */ - (NSString *)localizedRecoverySuggestion; /* Return titles of buttons that are appropriate for displaying in an alert. These should match the string provided as a part of localizedRecoverySuggestion. The first string would be the title of the right-most and default button, the second one next to it, and so on. If used in an alert the corresponding default return values are NSAlertFirstButtonReturn + n. Default implementation of this will pick up the value of the NSLocalizedRecoveryOptionsErrorKey from the userInfo dictionary. nil return usually implies no special suggestion, which would imply a single "OK" button. */ - (NSArray *)localizedRecoveryOptions; /* Return an object that conforms to the NSErrorRecoveryAttempting informal protocol. The recovery attempter must be an object that can correctly interpret an index into the array returned by -localizedRecoveryOptions. The default implementation of this method merely returns [[self userInfo] objectForKey:NSRecoveryAttempterErrorKey]. */ - (id)recoveryAttempter; /* Return the help anchor that can be used to create a help button to accompany the error when it's displayed to the user. This is done automatically by +[NSAlert alertWithError:], which the presentError: variants in NSApplication go through. The default implementation of this method merely returns [[self userInfo] objectForKey:NSHelpAnchorErrorKey]. */ - (NSString *)helpAnchor; @end @interface NSObject(NSErrorRecoveryAttempting) /* Given that an error alert has been presented document-modally to the user, and the user has chosen one of the error's recovery options, attempt recovery from the error, and send the selected message to the specified delegate. The option index is an index into the error's array of localized recovery options. The method selected by didRecoverSelector must have the same signature as: - (void)didPresentErrorWithRecovery:(BOOL)didRecover contextInfo:(void *)contextInfo; The value passed for didRecover must be YES if error recovery was completely successful, NO otherwise. */ - (void)attemptRecoveryFromError:(NSError *)error optionIndex:(NSUInteger)recoveryOptionIndex delegate:(id)delegate didRecoverSelector:(SEL)didRecoverSelector contextInfo:(void *)contextInfo; /* Given that an error alert has been presented applicaton-modally to the user, and the user has chosen one of the error's recovery options, attempt recovery from the error, and return YES if error recovery was completely successful, NO otherwise. The recovery option index is an index into the error's array of localized recovery options. */ - (BOOL)attemptRecoveryFromError:(NSError *)error optionIndex:(NSUInteger)recoveryOptionIndex; @end /* NSException.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import #import #import #import @class NSString, NSDictionary, NSArray; /*************** Generic Exception names ***************/ FOUNDATION_EXPORT NSString * const NSGenericException; FOUNDATION_EXPORT NSString * const NSRangeException; FOUNDATION_EXPORT NSString * const NSInvalidArgumentException; FOUNDATION_EXPORT NSString * const NSInternalInconsistencyException; FOUNDATION_EXPORT NSString * const NSMallocException; FOUNDATION_EXPORT NSString * const NSObjectInaccessibleException; FOUNDATION_EXPORT NSString * const NSObjectNotAvailableException; FOUNDATION_EXPORT NSString * const NSDestinationInvalidException; FOUNDATION_EXPORT NSString * const NSPortTimeoutException; FOUNDATION_EXPORT NSString * const NSInvalidSendPortException; FOUNDATION_EXPORT NSString * const NSInvalidReceivePortException; FOUNDATION_EXPORT NSString * const NSPortSendException; FOUNDATION_EXPORT NSString * const NSPortReceiveException; FOUNDATION_EXPORT NSString * const NSOldStyleException; /*************** Exception object ***************/ #if __OBJC2__ __attribute__((__objc_exception__)) #endif @interface NSException : NSObject { @private NSString *name; NSString *reason; NSDictionary *userInfo; id reserved; } + (NSException *)exceptionWithName:(NSString *)name reason:(NSString *)reason userInfo:(NSDictionary *)userInfo; - (id)initWithName:(NSString *)aName reason:(NSString *)aReason userInfo:(NSDictionary *)aUserInfo; - (NSString *)name; - (NSString *)reason; - (NSDictionary *)userInfo; - (NSArray *)callStackReturnAddresses NS_AVAILABLE(10_5, 2_0); - (NSArray *)callStackSymbols NS_AVAILABLE(10_6, 4_0); - (void)raise; @end @interface NSException (NSExceptionRaisingConveniences) + (void)raise:(NSString *)name format:(NSString *)format, ... NS_FORMAT_FUNCTION(2,3); + (void)raise:(NSString *)name format:(NSString *)format arguments:(va_list)argList NS_FORMAT_FUNCTION(2,0); @end #define NS_DURING @try { #define NS_HANDLER } @catch (NSException *localException) { #define NS_ENDHANDLER } #define NS_VALUERETURN(v,t) return (v) #define NS_VOIDRETURN return typedef void NSUncaughtExceptionHandler(NSException *exception); FOUNDATION_EXPORT NSUncaughtExceptionHandler *NSGetUncaughtExceptionHandler(void); FOUNDATION_EXPORT void NSSetUncaughtExceptionHandler(NSUncaughtExceptionHandler *); #if __clang__ #define __PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS _Pragma("clang diagnostic push") _Pragma("clang diagnostic ignored \"-Wformat-extra-args\"") #define __PRAGMA_POP_NO_EXTRA_ARG_WARNINGS _Pragma("clang diagnostic pop") #else #define __PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS #define __PRAGMA_POP_NO_EXTRA_ARG_WARNINGS #endif @class NSAssertionHandler; #if (defined(__STDC_VERSION__) && (199901L <= __STDC_VERSION__)) || (defined(__cplusplus) && (201103L <= __cplusplus)) #if !defined(NS_BLOCK_ASSERTIONS) #if !defined(_NSAssertBody) #define NSAssert(condition, desc, ...) \ do { \ __PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \ if (!(condition)) { \ [[NSAssertionHandler currentHandler] handleFailureInMethod:_cmd \ object:self file:[NSString stringWithUTF8String:__FILE__] \ lineNumber:__LINE__ description:(desc), ##__VA_ARGS__]; \ } \ __PRAGMA_POP_NO_EXTRA_ARG_WARNINGS \ } while(0) #endif #if !defined(_NSCAssertBody) #define NSCAssert(condition, desc, ...) \ do { \ __PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \ if (!(condition)) { \ [[NSAssertionHandler currentHandler] handleFailureInFunction:[NSString stringWithUTF8String:__PRETTY_FUNCTION__] \ file:[NSString stringWithUTF8String:__FILE__] \ lineNumber:__LINE__ description:(desc), ##__VA_ARGS__]; \ } \ __PRAGMA_POP_NO_EXTRA_ARG_WARNINGS \ } while(0) #endif #else // NS_BLOCK_ASSERTIONS defined #if !defined(_NSAssertBody) #define NSAssert(condition, desc, ...) do {} while (0) #endif #if !defined(_NSCAssertBody) #define NSCAssert(condition, desc, ...) do {} while (0) #endif #endif #if !defined(_NSAssertBody) #define NSAssert1(condition, desc, arg1) NSAssert((condition), (desc), (arg1)) #define NSAssert2(condition, desc, arg1, arg2) NSAssert((condition), (desc), (arg1), (arg2)) #define NSAssert3(condition, desc, arg1, arg2, arg3) NSAssert((condition), (desc), (arg1), (arg2), (arg3)) #define NSAssert4(condition, desc, arg1, arg2, arg3, arg4) NSAssert((condition), (desc), (arg1), (arg2), (arg3), (arg4)) #define NSAssert5(condition, desc, arg1, arg2, arg3, arg4, arg5) NSAssert((condition), (desc), (arg1), (arg2), (arg3), (arg4), (arg5)) #define NSParameterAssert(condition) NSAssert((condition), @"Invalid parameter not satisfying: %s", #condition) #endif #if !defined(_NSCAssertBody) #define NSCAssert1(condition, desc, arg1) NSCAssert((condition), (desc), (arg1)) #define NSCAssert2(condition, desc, arg1, arg2) NSCAssert((condition), (desc), (arg1), (arg2)) #define NSCAssert3(condition, desc, arg1, arg2, arg3) NSCAssert((condition), (desc), (arg1), (arg2), (arg3)) #define NSCAssert4(condition, desc, arg1, arg2, arg3, arg4) NSCAssert((condition), (desc), (arg1), (arg2), (arg3), (arg4)) #define NSCAssert5(condition, desc, arg1, arg2, arg3, arg4, arg5) NSCAssert((condition), (desc), (arg1), (arg2), (arg3), (arg4), (arg5)) #define NSCParameterAssert(condition) NSCAssert((condition), @"Invalid parameter not satisfying: %s", #condition) #endif #endif /* Non-vararg implementation of asserts (ignore) */ #if !defined(NS_BLOCK_ASSERTIONS) #if !defined(_NSAssertBody) #define _NSAssertBody(condition, desc, arg1, arg2, arg3, arg4, arg5) \ do { \ __PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \ if (!(condition)) { \ [[NSAssertionHandler currentHandler] handleFailureInMethod:_cmd object:self file:[NSString stringWithUTF8String:__FILE__] \ lineNumber:__LINE__ description:(desc), (arg1), (arg2), (arg3), (arg4), (arg5)]; \ } \ __PRAGMA_POP_NO_EXTRA_ARG_WARNINGS \ } while(0) #endif #if !defined(_NSCAssertBody) #define _NSCAssertBody(condition, desc, arg1, arg2, arg3, arg4, arg5) \ do { \ __PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \ if (!(condition)) { \ [[NSAssertionHandler currentHandler] handleFailureInFunction:[NSString stringWithUTF8String:__PRETTY_FUNCTION__] file:[NSString stringWithUTF8String:__FILE__] \ lineNumber:__LINE__ description:(desc), (arg1), (arg2), (arg3), (arg4), (arg5)]; \ } \ __PRAGMA_POP_NO_EXTRA_ARG_WARNINGS \ } while(0) #endif #else #if !defined(_NSAssertBody) #define _NSAssertBody(condition, desc, arg1, arg2, arg3, arg4, arg5) #endif #if !defined(_NSCAssertBody) #define _NSCAssertBody(condition, desc, arg1, arg2, arg3, arg4, arg5) #endif #endif /* * Asserts to use in Objective-C method bodies */ #if !defined(NSAssert) #define NSAssert5(condition, desc, arg1, arg2, arg3, arg4, arg5) \ __PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \ _NSAssertBody((condition), (desc), (arg1), (arg2), (arg3), (arg4), (arg5)) \ __PRAGMA_POP_NO_EXTRA_ARG_WARNINGS #define NSAssert4(condition, desc, arg1, arg2, arg3, arg4) \ __PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \ _NSAssertBody((condition), (desc), (arg1), (arg2), (arg3), (arg4), 0) \ __PRAGMA_POP_NO_EXTRA_ARG_WARNINGS #define NSAssert3(condition, desc, arg1, arg2, arg3) \ __PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \ _NSAssertBody((condition), (desc), (arg1), (arg2), (arg3), 0, 0) \ __PRAGMA_POP_NO_EXTRA_ARG_WARNINGS #define NSAssert2(condition, desc, arg1, arg2) \ __PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \ _NSAssertBody((condition), (desc), (arg1), (arg2), 0, 0, 0) \ __PRAGMA_POP_NO_EXTRA_ARG_WARNINGS #define NSAssert1(condition, desc, arg1) \ __PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \ _NSAssertBody((condition), (desc), (arg1), 0, 0, 0, 0) \ __PRAGMA_POP_NO_EXTRA_ARG_WARNINGS #define NSAssert(condition, desc) \ __PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \ _NSAssertBody((condition), (desc), 0, 0, 0, 0, 0) \ __PRAGMA_POP_NO_EXTRA_ARG_WARNINGS #endif #if !defined(NSParameterAssert) #define NSParameterAssert(condition) \ __PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \ _NSAssertBody((condition), @"Invalid parameter not satisfying: %s", #condition, 0, 0, 0, 0) \ __PRAGMA_POP_NO_EXTRA_ARG_WARNINGS #endif #if !defined(NSCAssert) #define NSCAssert5(condition, desc, arg1, arg2, arg3, arg4, arg5) \ __PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \ _NSCAssertBody((condition), (desc), (arg1), (arg2), (arg3), (arg4), (arg5)) \ __PRAGMA_POP_NO_EXTRA_ARG_WARNINGS #define NSCAssert4(condition, desc, arg1, arg2, arg3, arg4) \ __PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \ _NSCAssertBody((condition), (desc), (arg1), (arg2), (arg3), (arg4), 0) \ __PRAGMA_POP_NO_EXTRA_ARG_WARNINGS #define NSCAssert3(condition, desc, arg1, arg2, arg3) \ __PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \ _NSCAssertBody((condition), (desc), (arg1), (arg2), (arg3), 0, 0) \ __PRAGMA_POP_NO_EXTRA_ARG_WARNINGS #define NSCAssert2(condition, desc, arg1, arg2) \ __PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \ _NSCAssertBody((condition), (desc), (arg1), (arg2), 0, 0, 0) \ __PRAGMA_POP_NO_EXTRA_ARG_WARNINGS #define NSCAssert1(condition, desc, arg1) \ __PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \ _NSCAssertBody((condition), (desc), (arg1), 0, 0, 0, 0) \ __PRAGMA_POP_NO_EXTRA_ARG_WARNINGS #define NSCAssert(condition, desc) \ __PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \ _NSCAssertBody((condition), (desc), 0, 0, 0, 0, 0) \ __PRAGMA_POP_NO_EXTRA_ARG_WARNINGS #endif #if !defined(NSCParameterAssert) #define NSCParameterAssert(condition) \ __PRAGMA_PUSH_NO_EXTRA_ARG_WARNINGS \ _NSCAssertBody((condition), @"Invalid parameter not satisfying: %s", #condition, 0, 0, 0, 0) \ __PRAGMA_POP_NO_EXTRA_ARG_WARNINGS #endif FOUNDATION_EXPORT NSString * const NSAssertionHandlerKey NS_AVAILABLE(10_6, 4_0); @interface NSAssertionHandler : NSObject { @private void *_reserved; } + (NSAssertionHandler *)currentHandler; - (void)handleFailureInMethod:(SEL)selector object:(id)object file:(NSString *)fileName lineNumber:(NSInteger)line description:(NSString *)format,... NS_FORMAT_FUNCTION(5,6); - (void)handleFailureInFunction:(NSString *)functionName file:(NSString *)fileName lineNumber:(NSInteger)line description:(NSString *)format,... NS_FORMAT_FUNCTION(4,5); @end /* NSExpression.h Copyright (c) 2004-2012, Apple Inc. All rights reserved. */ #import @class NSString; @class NSArray; @class NSMutableDictionary; @class NSPredicate; // Expressions are the core of the predicate implementation. When expressionValueWithObject: is called, the expression is evaluated, and a value returned which can then be handled by an operator. Expressions can be anything from constants to method invocations. Scalars should be wrapped in appropriate NSValue classes. typedef NS_ENUM(NSUInteger, NSExpressionType) { NSConstantValueExpressionType = 0, // Expression that always returns the same value NSEvaluatedObjectExpressionType, // Expression that always returns the parameter object itself NSVariableExpressionType, // Expression that always returns whatever is stored at 'variable' in the bindings dictionary NSKeyPathExpressionType, // Expression that returns something that can be used as a key path NSFunctionExpressionType, // Expression that returns the result of evaluating a symbol NSUnionSetExpressionType NS_ENUM_AVAILABLE(10_5, 3_0), // Expression that returns the result of doing a unionSet: on two expressions that evaluate to flat collections (arrays or sets) NSIntersectSetExpressionType NS_ENUM_AVAILABLE(10_5, 3_0), // Expression that returns the result of doing an intersectSet: on two expressions that evaluate to flat collections (arrays or sets) NSMinusSetExpressionType NS_ENUM_AVAILABLE(10_5, 3_0), // Expression that returns the result of doing a minusSet: on two expressions that evaluate to flat collections (arrays or sets) NSSubqueryExpressionType NS_ENUM_AVAILABLE(10_5, 3_0) = 13, NSAggregateExpressionType NS_ENUM_AVAILABLE(10_5, 3_0) #if NS_BLOCKS_AVAILABLE , NSBlockExpressionType = 19 #endif /* NS_BLOCKS_AVAILABLE */ }; NS_CLASS_AVAILABLE(10_4, 3_0) @interface NSExpression : NSObject { @private void *_reserved; NSExpressionType _expressionType; } + (NSExpression *)expressionWithFormat:(NSString *)expressionFormat argumentArray:(NSArray *)arguments NS_AVAILABLE(10_6,4_0); + (NSExpression *)expressionWithFormat:(NSString *)expressionFormat, ... NS_AVAILABLE(10_6,4_0); + (NSExpression *)expressionWithFormat:(NSString *)expressionFormat arguments:(va_list)argList NS_AVAILABLE(10_6,4_0); + (NSExpression *)expressionForConstantValue:(id)obj; // Expression that returns a constant value + (NSExpression *)expressionForEvaluatedObject; // Expression that returns the object being evaluated + (NSExpression *)expressionForVariable:(NSString *)string; // Expression that pulls a value from the variable bindings dictionary + (NSExpression *)expressionForKeyPath:(NSString *)keyPath; // Expression that invokes valueForKeyPath with keyPath + (NSExpression *)expressionForFunction:(NSString *)name arguments:(NSArray *)parameters; // Expression that invokes one of the predefined functions. Will throw immediately if the selector is bad; will throw at runtime if the parameters are incorrect. // Predefined functions are: // name parameter array contents returns //------------------------------------------------------------------------------------------------------------------------------------- // sum: NSExpression instances representing numbers NSNumber // count: NSExpression instances representing numbers NSNumber // min: NSExpression instances representing numbers NSNumber // max: NSExpression instances representing numbers NSNumber // average: NSExpression instances representing numbers NSNumber // median: NSExpression instances representing numbers NSNumber // mode: NSExpression instances representing numbers NSArray (returned array will contain all occurrences of the mode) // stddev: NSExpression instances representing numbers NSNumber // add:to: NSExpression instances representing numbers NSNumber // from:subtract: two NSExpression instances representing numbers NSNumber // multiply:by: two NSExpression instances representing numbers NSNumber // divide:by: two NSExpression instances representing numbers NSNumber // modulus:by: two NSExpression instances representing numbers NSNumber // sqrt: one NSExpression instance representing numbers NSNumber // log: one NSExpression instance representing a number NSNumber // ln: one NSExpression instance representing a number NSNumber // raise:toPower: one NSExpression instance representing a number NSNumber // exp: one NSExpression instance representing a number NSNumber // floor: one NSExpression instance representing a number NSNumber // ceiling: one NSExpression instance representing a number NSNumber // abs: one NSExpression instance representing a number NSNumber // trunc: one NSExpression instance representing a number NSNumber // uppercase: one NSExpression instance representing a string NSString // lowercase: one NSExpression instance representing a string NSString // random none NSNumber (integer) // random: one NSExpression instance representing a number NSNumber (integer) such that 0 <= rand < param // now none [NSDate now] // bitwiseAnd:with: two NSExpression instances representing numbers NSNumber (numbers will be treated as NSInteger) // bitwiseOr:with: two NSExpression instances representing numbers NSNumber (numbers will be treated as NSInteger) // bitwiseXor:with: two NSExpression instances representing numbers NSNumber (numbers will be treated as NSInteger) // leftshift:by: two NSExpression instances representing numbers NSNumber (numbers will be treated as NSInteger) // rightshift:by: two NSExpression instances representing numbers NSNumber (numbers will be treated as NSInteger) // onesComplement: one NSExpression instance representing a numbers NSNumber (numbers will be treated as NSInteger) // noindex: an NSExpression parameter (used by CoreData to indicate that an index should be dropped) + (NSExpression *)expressionForAggregate:(NSArray *)subexpressions NS_AVAILABLE(10_5, 3_0); // Expression that returns a collection containing the results of other expressions + (NSExpression *)expressionForUnionSet:(NSExpression *)left with:(NSExpression *)right NS_AVAILABLE(10_5, 3_0); // return an expression that will return the union of the collections expressed by left and right + (NSExpression *)expressionForIntersectSet:(NSExpression *)left with:(NSExpression *)right NS_AVAILABLE(10_5, 3_0); // return an expression that will return the intersection of the collections expressed by left and right + (NSExpression *)expressionForMinusSet:(NSExpression *)left with:(NSExpression *)right NS_AVAILABLE(10_5, 3_0); // return an expression that will return the disjunction of the collections expressed by left and right + (NSExpression *)expressionForSubquery:(NSExpression *)expression usingIteratorVariable:(NSString *)variable predicate:(id)predicate NS_AVAILABLE(10_5, 3_0); // Expression that filters a collection by storing elements in the collection in the variable variable and keeping the elements for which qualifer returns true; variable is used as a local variable, and will shadow any instances of variable in the bindings dictionary, the variable is removed or the old value replaced once evaluation completes + (NSExpression *)expressionForFunction:(NSExpression *)target selectorName:(NSString *)name arguments:(NSArray *)parameters NS_AVAILABLE(10_5, 3_0); // Expression that invokes the selector on target with parameters. Will throw at runtime if target does not implement selector or if parameters are wrong. #if NS_BLOCKS_AVAILABLE + (NSExpression *)expressionForBlock:(id (^)(id evaluatedObject, NSArray *expressions, NSMutableDictionary *context))block arguments:(NSArray *)arguments NS_AVAILABLE(10_6, 4_0); // Expression that invokes the block with the parameters; note that block expressions are not encodable or representable as parseable strings. #endif - (id)initWithExpressionType:(NSExpressionType)type; // designated initializer // accessors for individual parameters - raise if not applicable - (NSExpressionType)expressionType; - (id)constantValue; - (NSString *)keyPath; - (NSString *)function; - (NSString *)variable; - (NSExpression *)operand; // the object on which the selector will be invoked (the result of evaluating a key path or one of the defined functions) - (NSArray *)arguments; // array of expressions which will be passed as parameters during invocation of the selector on the operand of a function expression - (id)collection NS_AVAILABLE(10_5, 3_0); - (NSPredicate *)predicate NS_AVAILABLE(10_5, 3_0); - (NSExpression *)leftExpression NS_AVAILABLE(10_5, 3_0); // expression which represents the left side of a set expression - (NSExpression *)rightExpression NS_AVAILABLE(10_5, 3_0); // expression which represents the right side of a set expression #if NS_BLOCKS_AVAILABLE - (id (^)(id, NSArray *, NSMutableDictionary *))expressionBlock NS_AVAILABLE(10_6, 4_0); #endif /* NS_BLOCKS_AVAILABLE */ // evaluate the expression using the object and bindings- note that context is mutable here and can be used by expressions to store temporary state for one predicate evaluation - (id)expressionValueWithObject:(id)object context:(NSMutableDictionary *)context; @end /* NSFileCoordinator.h Copyright (c) 2010-2012, Apple Inc. All rights reserved. */ #import @class NSArray, NSError, NSMutableDictionary, NSURL; @protocol NSFilePresenter; typedef NS_OPTIONS(NSUInteger, NSFileCoordinatorReadingOptions) { /* Whether reading does _not_ trigger sending of -savePresentedItemChangesWithCompletionHandler: to certain NSFilePresenters in the system and waiting for those NSFilePresenters to respond. The default behavior during coordinated reading is to send -savePresentedItemChangesWithCompletionHandler: to NSFilePresenters. */ NSFileCoordinatorReadingWithoutChanges = 1 << 0, /* Whether reading of an item that might be a symbolic link file causes the resolution of the link if it is. This affects the URL passed to the block passed to an invocation of one of the -coordinateReadingItemAtURL:... methods. This is not a valid option to use with -prepareForReadingItemsAtURLs:options:writingItemsAtURLs:options:error:byAccessor:. */ NSFileCoordinatorReadingResolvesSymbolicLink = 1 << 1 }; typedef NS_OPTIONS(NSUInteger, NSFileCoordinatorWritingOptions) { /* You can use only one of these writing options at a time. Using none of them indicates that the writing will simply update the item. */ /* Whether the writing to be done is actually the deletion of the item. This affects how the writing waits for previously scheduled coordinated reading and writing, how the writing causes subsequently scheduled reading and writing to wait, and what NSFilePresenter messaging is done. See the comments in the Single File Coordination section below. This option is how you trigger sending of -accommodatePresentedItemDeletionWithCompletionHandler: or -accommodatePresentedSubitemDeletionAtURL:completionHandler: messages to NSFilePresenters. For example, Finder uses this when it's emptying the trash to give NSFilePresenters a chance to close documents before their files disappear, or would disappear if the files weren't still open. */ NSFileCoordinatorWritingForDeleting = 1 << 0, /* Whether the writing to be done is actually the moving or renaming of the item. This affects how the writing waits for previously scheduled coordinated reading and writing, how the writing causes subsequently scheduled reading and writing to wait, and what NSFilePresenter messaging is done. See the comments in the Single File Coordination section below. This option has no effect when what's being moved is a plain file so you can use it in code that moves file system items without checking whether the items are files or directories. Any such check would invite a race condition anyway. For example, Finder uses this when it's moving items that the user has dragged and dropped so as not to yank files contained by moved folders out from underneath applications that are reading or writing those files. */ NSFileCoordinatorWritingForMoving = 1 << 1, /* Whether coordinated writing triggers sending of -savePresentedItemChangesWithCompletionHandler: to certain NSFilePresenters in the system and waiting for those NSFilePresenters to respond. */ NSFileCoordinatorWritingForMerging = 1 << 2, /* Whether the writing to be done is actually the replacement of the item with a different item. It causes the same behavior as NSFileCoordinatorWritingForDeleting except that when the item being written to is renamed or moved while the writer is being made to wait the item is considered to have been a different item, so the writer is not passed an updated URL to reflect the renaming or moving. Use this when the moving or creation of an item will replace any item that gets in its way. To avoid a race condition use it regardless of whether there is actually an item in the way before the writing begins. Don't use this when simply updating the contents of a file, even if the way you do that is writing the contents to another file and renaming it into place. This is not a valid option to use with -prepareForReadingItemsAtURLs:options:writingItemsAtURLs:options:error:byAccessor:. For example, NSDocument uses this for NSSaveAsOperation and NSSaveToOperation to announce that it is possibly overwriting an item with a brand new file or file package. This gives any NSFilePresenter of the overwritten item, including perhaps a different instance of NSDocument, perhaps in the same application, a chance to close itself before the item is overwritten. For another example, the most accurate and safe way to coordinate a move is to invoke -coordinateWritingItemAtURL:options:writingItemAtURL:options:error:byAccessor: using the NSFileCoordinatorWritingForMoving option with the source URL and NSFileCoordinatorWritingForReplacing with the destination URL. */ NSFileCoordinatorWritingForReplacing = 1 << 3 }; NS_CLASS_AVAILABLE(10_7, 5_0) @interface NSFileCoordinator : NSObject { @private id _accessArbiter; id _fileReactor; id _purposeID; NSURL *_recentFilePresenterURL; id _accessClaimIDOrIDs; BOOL _isCancelled; NSMutableDictionary *_movedItems; } #pragma mark *** File Presenters *** /* The process' file presenters. If you invoke +addFilePresenter: you have to do a balancing invocation of +removeFilePresenter: before the file presenter is deallocated, even in a garbage-collected application. If your application reads an item and then registers a file presenter for it there is a possible race condition in which between those two steps another process does coordinated reading or writing of the item, without any messages sent to your not-quite-registered file presenter. This can leave your file presenter ignorant of the fact that what it knows about the item it just read is already out of date, or under the misconception that just because it hasn't received a -relinquish... method it owns the item. To avoid that race condition you can invoke +addFilePresenter: in the same block that you pass to -coordinateReadingItemAtURL:options:error:byAccessor: to read what the file presenter will present. */ + (void)addFilePresenter:(id)filePresenter; + (void)removeFilePresenter:(id)filePresenter; + (NSArray *)filePresenters; /* The designated initializer. If an NSFilePresenter is provided then the receiver is considered to have been created by that NSFilePresenter, or on its behalf. NSFileCoordinator is meant to be instantiated on a per-file-operation basis, where a file operation is something like the opening or saving of a document, or the copying or moving of a batch of folders and files. There is no benefit to keeping an instance of it alive in your application for much more time than it takes to actually perform the file operation. Doing so can be harmful, or at least wasteful of memory, because NSFileCoordinators may retain NSFilePresenters. You pass an NSFilePresenter to this initializer when the operation whose file access is to be coordinated is being performed by that NSFilePresenter. Associating an NSFileCoordinator with an NSFilePresenter accomplishes a few important things: - It prevents the NSFileCoordinator from sending messages to that NSFilePresenter, so the NSFilePresenter does not have to somehow filter out messages about its own file operations. The exception to this rule is that messages about versions of the presented item being added, remove, or resolved during coordinated writing are sent to every relevant NSFilePresenter, even the one passed to -initWithFilePresenter:. - It allows the file coordination mechanism to determine when coordinated writing is being done in response to an NSFilePresenter receiving a -savePresentedItemChangesWithCompletionHandler: message, and not deadlock. Usually coordinated writing done by one NSFileCoordinator must wait for coordinated reading of the same file or directory done by another NSFileCoordinator. But, for example, when coordinated reading is begun with one NSFileCoordinator, and that causes an NSFilePresenter to do coordinated writing using another NSFileCoordinator, the writing done with the second NSFileCoordinator should not wait for the completion of the first NSFileCoordinator's reading, it should instead happen while the first NSFileCoordinator is waiting to read. - It allows the file coordination mechanism to handle a race condition that can occur when it has sent an NSFilePresenter a -presentedItemDidMoveToURL: message in the NSFilePresenter's operation queue but before that message is dequeued the NSFilePresenter enqueues, on a different queue, an operation using the old URL. For this to be effective however the NSFileCoordinator must be initialized in the same operation queue in which NSFilePresenter messages are received. - It allows the file coordination mechanism to gracefully handle your application's registration of an NSFilePresenter that at first returns nil when sent -presentedItemURL but can later return non-nil at the end of doing a coordinated write that creates the presented item in the file system for the very first time. AppKit for example takes advantage of this by registering brand new untitled NSDocuments as NSFilePresenters immediately, instead of waiting until after the first time the user causes the document to be saved to a file, which would be more complicated. For example, NSDocument creates a single NSFileCoordinator for all of the coordinated reading and writing it does during the saving of a document. It always creates the NSFileCoordinator in the main queue even when it is doing the actual coordinated reading and writing in a background queue to implement asynchronous saving. */ - (id)initWithFilePresenter:(id)filePresenterOrNil; #if NS_BLOCKS_AVAILABLE #pragma mark *** Single File Coordination *** /* You can consider "item" in method names in this header file to be an abbreviation of "fileOrDirectory." As always, a directory might actually be a file package. The next two methods follow the same pattern: given a URL that locates a file or directory, each synchronously waits for certain other readers and writers and then, if no error occurs, invokes the passed-in block. Until the invocation of that block returns, certain other readers and writers are made to synchronously wait. If instead an error occurs then *outError is set to an NSError and the passed-in block is not invoked. When the block is invoked it is passed the URL that locates the item, taking into account the fact that the item might have been moved or renamed during the waiting. In general a coordinated reader waits for a coordinated writer of the same item, and a coordinated writer waits for coordinated readers and other coordinated writers of the same item. Coordinated readers do not wait for each other. Coordinated reading or writing of items in a file package is treated as coordinated reading or writing of the file package as a whole. A coordinated reader of a directory that is not a file package does not wait for coordinated writers of contained items, or cause such writers to wait. With one exception, a coordinated writer of a directory that is not a file package does not wait for coordinated readers and writers of contained items, or cause such readers and writers to wait. The exception is when you use NSFileCoordinatorWritingForDeleting, NSFileCoordinatorWritingForMoving, or NSFileCoordinatorWritingForReplacing. They make your coordinated writer wait for previously scheduled coordinated readers and writers of contained items, and causes subsequently scheduled coordinated readers and writers of contained items to wait. None of those rules apply to coordinated readers and writers that are using the exact same instance of NSFileCoordinator. Instances of NSFileCoordinator never block themselves. You can take advantage of that in a couple of ways but take care because doing so raises the possibility of deadlocking with other processes that are doing the same sort of thing. If you have a choice use one of the batched file coordination methods in the next section instead. You can invoke these methods to serialize your process' access of files and directories with other processes' access of the same files and directories so that inconsistencies due to overlapping reading and writing don't occur. They also cause messages to be sent to NSFilePresenters, and wait for NSFilePresenters to react, as described below. To accommodate the fact that file system items can be moved or renamed while one of these methods is waiting to invoke the block you passed when invoking it, the block you pass in should always use the passed-in URL do its work, not the one passed in the method invocation. Each of these methods returns an NSError by reference but are uncommon among Cocoa framework methods in that they don't also return a result indicating success or failure. The success of the waiting that they do is typically not interesting to invokers. Only the success of file system access done by the passed-in block is interesting. (The failure of either is of course interesting.) When invoking these methods it's cleanest to just declare a __block variable outside of the block and initialize it to a value that signals failure, and then inside the block set it to a value that signals success. If the waiting fails then the invoked method sets the error reference to an NSError that describes what went wrong, your block will not be invoked, your __block variable will not be set to a value that signals success, and all will be as it should be, with failure signaled and an NSError that describes the failure. */ /* Readers do not wait for other readers, but they wait for writers, and they also wait for NSFilePresenters that are messaged as part of the coordinated reading. Coordinated reading of an item triggers the sending of messages to NSFilePresenters that implement the corresponding optional methods, even those in other processes, except the one specified when -initWithFilePresenter: was invoked: - -relinquishPresentedItemToReader: is sent to NSFilePresenters of the item and, if the item is in a file package, NSFilePresenters of the file package. If there are nested file packages then the message is sent to NSFilePresenters of all of them. - If NSFileCoordinatorReadingWithoutChanges is not used then -savePresentedItemChangesWithCompletionHandler: is also sent to the same NSFilePresenters. If there are multiple NSFilePresenters involved then the order in which they are messaged is undefined. If an NSFilePresenter signals failure then waiting will fail and *outError will be set to an NSError describing the failure. */ - (void)coordinateReadingItemAtURL:(NSURL *)url options:(NSFileCoordinatorReadingOptions)options error:(NSError **)outError byAccessor:(void (^)(NSURL *newURL))reader; /* Writers wait for readers and other writers, and they also wait for NSFilePresenters that are messaged as part of the coordinated writing. Coordinated writing of an item triggers the sending of messages to NSFilePresenters that implement the corresponding optional methods, even those in other processes, except the one specified when -initWithFilePresenter: was invoked: - -relinquishPresentedItemToWriter: is sent to NSFilePresenters of the item and, if the item is in a file package, NSFilePresenters of the file package. If there are nested file packages then the message is sent to NSFilePresenters of all of them. - If NSFileCoordinatorWritingForDeleting, NSFileCoordinatorWritingForMoving, or NSFileCoordinatorWritingForReplacing is used and the item is a directory then -relinquishPresentedItemToWriter: is also sent to NSFilePresenters of each item contained by it. - If NSFileCoordinatorWritingForDeleting or NSFileCoordinatorWritingForReplacing is used then -accommodatePresentedItemDeletionWithCompletionHandler: is sent to NSFilePresenters of the item and, if the item is a directory, NSFilePresenters of each item contained by it. -accommodatePresentedSubitemDeletionAtURL:completionHandler: is sent to NSFilePresenters of each file package that contains the item. - When NSFileCoordinatorWritingForReplacing is used the the definition of "the item" depends on what happened while waiting for other writers. See the description of it above. - If NSFileCoordinatorWritingForMerging is used then -savePresentedItemChangesWithCompletionHandler: is sent to NSFilePresenters of the item and, if the item is in a file package, NSFilePresenters of the file package. If there are nested file packages then the message is sent to NSFilePresenters of all of them. If there are multiple NSFilePresenters involved then the order in which they are messaged is undefined. If an NSFilePresenter signals failure then waiting will fail and *outError will be set to an NSError describing the failure. */ - (void)coordinateWritingItemAtURL:(NSURL *)url options:(NSFileCoordinatorWritingOptions)options error:(NSError **)outError byAccessor:(void (^)(NSURL *newURL))writer; #pragma mark *** Multiple File Coordination *** /* Do the same thing that an invocation of -coordinateReadingItemAtURL:options:error:byAccessor: passed a block that invokes -coordinateWritingItemAtURL:options:error:byAccessor: would do, without the risk of deadlock that doing exactly that would introduce. */ - (void)coordinateReadingItemAtURL:(NSURL *)readingURL options:(NSFileCoordinatorReadingOptions)readingOptions writingItemAtURL:(NSURL *)writingURL options:(NSFileCoordinatorWritingOptions)writingOptions error:(NSError **)outError byAccessor:(void (^)(NSURL *newReadingURL, NSURL *newWritingURL))readerWriter; /* Do the same thing that an invocation of -coordinateWritingItemAtURL:options:error:byAccessor: passed a block that invokes -coordinateWritingItemAtURL:options:error:byAccessor: again would do, without the risk of deadlock that doing exactly that would introduce. */ - (void)coordinateWritingItemAtURL:(NSURL *)url1 options:(NSFileCoordinatorWritingOptions)options1 writingItemAtURL:(NSURL *)url2 options:(NSFileCoordinatorWritingOptions)options2 error:(NSError **)outError byAccessor:(void (^)(NSURL *newURL1, NSURL *newURL2))writer; #pragma mark *** Batched File Coordination *** /* Prepare to more efficiently do a large number of invocations of -coordinate... methods, first synchronously messaging and waiting for NSFilePresenters in a variation of what individual invocations of the -coordinate... methods would do, and then, if no error occurs, invoke the passed-in block. The passed-in block must invoke the completion handler passed to it when all of the coordinated reading and writing it does is done. The completion handler block can be invoked on any thread (or from any dispatch queue, if that's how you think of it). This method returns errors in the same manner as the -coordinate... methods. The -coordinate... methods must use interprocess communication to message instances of NSFileCoordinator and NSFilePresenter in other processes in the system. That is an expense best avoided when reading or writing many files in one operation. Using this method can greatly reduce the amount of interprocess communication required by, for example, a large batched copying or moving of files. You use it by moving all of the invocations of the -coordinate... methods your application will do during a batch operation, or the scheduling of them if the operation's work is done in a multithreaded fashion, into a block and passing that block to an invocation of this method, remembering that the completion handler passed to that block must be invoked when the operation is done. You don't simply pass all URLs that will be passed into invocations of the -coordinate... methods when invoking this method. Instead you pass the top-level files and directories involved in the operation. This method triggers messages to not just NSFilePresenters of those items, but also NSFilePresenters of items contained by those items. For example, when Finder uses this method during a copy operation readingURLs is an array of the URLs of the exact files and folders that the user has selected, even though those folders may contain many files and subfolders for which Finder is going to do coordinated reading, and writingURLs is an array that contains just the URL of the destination folder. In most cases it is redundant to pass the same reading or writing options in an invocation of this method as are passed to individual invocations of the -coordinate... methods invoked by the block passed to an invocation of this method. For example, when Finder invokes this method during a copy operation it does not pass NSFileCoordinatorReadingWithoutChanges because it is appropriate to trigger the saving of document changes right away, but it does pass it when doing the nested invocations of -coordinate... methods because it is not necessary to trigger saving again, even if the user changes the document before the Finder proceeds far enough to actually copy that document's file. */ - (void)prepareForReadingItemsAtURLs:(NSArray *)readingURLs options:(NSFileCoordinatorReadingOptions)readingOptions writingItemsAtURLs:(NSArray *)writingURLs options:(NSFileCoordinatorWritingOptions)writingOptions error:(NSError **)outError byAccessor:(void (^)(void (^completionHandler)(void)))batchAccessor; #endif #pragma mark *** Renaming and Moving Notification *** /*Announce that the item located by a URL is going to be located by another URL. Support for App Sandbox on OS X. Some applications can rename files while saving them. For example, when a user adds attachments to a rich text document, TextEdit changes the document's extension from .rtf to .rtfd. A sandboxed application like TextEdit must ordinarily prompt the user for approval before renaming a document. You can invoke this method to make your process declare its intent to rename a document without user approval. After the renaming succeeds you must invoke -itemAtURL:didMoveToURL:, with the same arguments, for the process to keep access to the file with its new name and to give up access to any file that appears with the old name. If the renaming fails you should probably not invoke -itemAtURL:willMoveToURL:. There is no reason to invoke this method from applications that do not use App Sandbox. Invoking it does nothing on iOS. */ - (void)itemAtURL:(NSURL *)oldURL willMoveToURL:(NSURL *)newURL NS_AVAILABLE(10_8, 6_0); /* Announce that the item located by a URL is now located by another URL. This triggers the sending of messages to NSFilePresenters that implement the corresponding optional methods, even those in other processes, except the one specified when -initWithFilePresenter: was invoked: - -presentedItemDidMoveToURL: is sent to NSFilePresenters of the item. - If the item is a directory then -presentedItemDidMoveToURL: is sent to NSFilePresenters of each item contained by it. - -presentedSubitemAtURL:didMoveToURL: is sent to NSFilePresenters of each directory that contains the item, unless that method is not implemented but -presentedItemDidChange is, and the directory is actually a file package, in which case -presentedItemDidChange is sent instead. This also balances invocations of -itemAtURL:willMoveToURL:, as described above. Useless invocations of this method are harmless, so you don't have to write code that compares NSURLs for equality, which is not straightforward. This method must be invoked from within the block passed to an invocation of -coordinateWritingItemAtURL:options:error:byAccessor: or -coordinateReadingItemAtURL:options:writingItemAtURL:options:error:byAccessor:. */ - (void)itemAtURL:(NSURL *)oldURL didMoveToURL:(NSURL *)newURL; #pragma mark *** Cancellation *** /* Cancel all invocations of -coordinate... and -prepare... methods for the receiver. Any current invocation of one of those methods will stop waiting and return immediately, unless it has already invoked the passed-in block, in which case it will return when the passed-in block returns. Subsequent invocations of those methods will not invoke the blocks passed into them at all. When an invocation of -coordinate... or -prepare... returns without invoking the passed-in block because this method was invoked it instead returns an error whose domain is NSCocoaErrorDomain and whose code is NSUserCancelledError. Messages that have already been sent to NSFilePresenters will not be cancelled but the file coordination machinery will stop waiting for the replies. This method this can be invoked from any thread. It always returns immediately, without waiting for anything. Cancellation is racy; you usually cannot assume that no block passed into a -coordinate... or -prepare... method is already being invoked, so the code inside those blocks typically still has to check for cancellation, whatever that means in your application. */ - (void)cancel; @end /* NSFileHandle.h Copyright (c) 1995-2012, Apple Inc. All rights reserved. */ #import #import #import @class NSString, NSData, NSError; @interface NSFileHandle : NSObject - (NSData *)availableData; - (NSData *)readDataToEndOfFile; - (NSData *)readDataOfLength:(NSUInteger)length; - (void)writeData:(NSData *)data; - (unsigned long long)offsetInFile; - (unsigned long long)seekToEndOfFile; - (void)seekToFileOffset:(unsigned long long)offset; - (void)truncateFileAtOffset:(unsigned long long)offset; - (void)synchronizeFile; - (void)closeFile; @end @interface NSFileHandle (NSFileHandleCreation) + (id)fileHandleWithStandardInput; + (id)fileHandleWithStandardOutput; + (id)fileHandleWithStandardError; + (id)fileHandleWithNullDevice; + (id)fileHandleForReadingAtPath:(NSString *)path; + (id)fileHandleForWritingAtPath:(NSString *)path; + (id)fileHandleForUpdatingAtPath:(NSString *)path; + (id)fileHandleForReadingFromURL:(NSURL *)url error:(NSError **)error NS_AVAILABLE(10_6, 4_0); + (id)fileHandleForWritingToURL:(NSURL *)url error:(NSError **)error NS_AVAILABLE(10_6, 4_0); + (id)fileHandleForUpdatingURL:(NSURL *)url error:(NSError **)error NS_AVAILABLE(10_6, 4_0); @end FOUNDATION_EXPORT NSString * const NSFileHandleOperationException; FOUNDATION_EXPORT NSString * const NSFileHandleReadCompletionNotification; FOUNDATION_EXPORT NSString * const NSFileHandleReadToEndOfFileCompletionNotification; FOUNDATION_EXPORT NSString * const NSFileHandleConnectionAcceptedNotification; FOUNDATION_EXPORT NSString * const NSFileHandleDataAvailableNotification; FOUNDATION_EXPORT NSString * const NSFileHandleNotificationDataItem; FOUNDATION_EXPORT NSString * const NSFileHandleNotificationFileHandleItem; FOUNDATION_EXPORT NSString * const NSFileHandleNotificationMonitorModes NS_DEPRECATED(10_0, 10_7, 2_0, 5_0); @interface NSFileHandle (NSFileHandleAsynchronousAccess) - (void)readInBackgroundAndNotifyForModes:(NSArray *)modes; - (void)readInBackgroundAndNotify; - (void)readToEndOfFileInBackgroundAndNotifyForModes:(NSArray *)modes; - (void)readToEndOfFileInBackgroundAndNotify; - (void)acceptConnectionInBackgroundAndNotifyForModes:(NSArray *)modes; - (void)acceptConnectionInBackgroundAndNotify; - (void)waitForDataInBackgroundAndNotifyForModes:(NSArray *)modes; - (void)waitForDataInBackgroundAndNotify; #ifdef __BLOCKS__ @property (copy) void (^readabilityHandler)(NSFileHandle *) NS_AVAILABLE(10_7, 5_0); @property (copy) void (^writeabilityHandler)(NSFileHandle *) NS_AVAILABLE(10_7, 5_0); #endif @end @interface NSFileHandle (NSFileHandlePlatformSpecific) - (id)initWithFileDescriptor:(int)fd closeOnDealloc:(BOOL)closeopt; - (id)initWithFileDescriptor:(int)fd; - (int)fileDescriptor; @end @interface NSPipe : NSObject - (NSFileHandle *)fileHandleForReading; - (NSFileHandle *)fileHandleForWriting; - (id)init; + (id)pipe; @end /* NSFileManager.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import #import #import #import #import @class NSArray, NSData, NSDate, NSDirectoryEnumerator, NSError, NSNumber; @protocol NSFileManagerDelegate; /* Version number where NSFileManager can copy/move/enumerate resources forks correctly. */ #define NSFoundationVersionWithFileManagerResourceForkSupport 412 typedef NS_OPTIONS(NSUInteger, NSVolumeEnumerationOptions) { /* The mounted volume enumeration will skip hidden volumes. */ NSVolumeEnumerationSkipHiddenVolumes = 1UL << 1, /* The mounted volume enumeration will produce file reference URLs rather than path-based URLs. */ NSVolumeEnumerationProduceFileReferenceURLs = 1UL << 2 } NS_ENUM_AVAILABLE(10_6, 4_0); typedef NS_OPTIONS(NSUInteger, NSDirectoryEnumerationOptions) { /* NSDirectoryEnumerationSkipsSubdirectoryDescendants causes the NSDirectoryEnumerator to perform a shallow enumeration and not descend into directories it encounters. */ NSDirectoryEnumerationSkipsSubdirectoryDescendants = 1UL << 0, /* NSDirectoryEnumerationSkipsPackageDescendants will cause the NSDirectoryEnumerator to not descend into packages. */ NSDirectoryEnumerationSkipsPackageDescendants = 1UL << 1, /* NSDirectoryEnumerationSkipsHiddenFiles causes the NSDirectoryEnumerator to not enumerate hidden files. */ NSDirectoryEnumerationSkipsHiddenFiles = 1UL << 2 } NS_ENUM_AVAILABLE(10_6, 4_0); typedef NS_OPTIONS(NSUInteger, NSFileManagerItemReplacementOptions) { /* NSFileManagerItemReplacementUsingNewMetadataOnly causes -replaceItemAtURL:withItemAtURL:backupItemName:options:resultingItemURL:error: to use metadata from the new item only and not to attempt to preserve metadata from the original item. */ NSFileManagerItemReplacementUsingNewMetadataOnly = 1UL << 0, /* NSFileManagerItemReplacementWithoutDeletingBackupItem causes -replaceItemAtURL:withItemAtURL:backupItemName:options:resultingItemURL:error: to leave the backup item in place after a successful replacement. The default behavior is to remove the item. */ NSFileManagerItemReplacementWithoutDeletingBackupItem = 1UL << 1 } NS_ENUM_AVAILABLE(10_6, 4_0); /* Notification sent after the current ubiquity identity has changed. */ extern NSString * const NSUbiquityIdentityDidChangeNotification NS_AVAILABLE(10_8, 6_0); @interface NSFileManager : NSObject /* Returns the default singleton instance. */ + (NSFileManager *)defaultManager; /* -mountedVolumeURLsIncludingResourceValuesForKeys:options: returns an NSArray of NSURLs locating the mounted volumes available on the computer. The property keys that can be requested are available in . */ - (NSArray *)mountedVolumeURLsIncludingResourceValuesForKeys:(NSArray *)propertyKeys options:(NSVolumeEnumerationOptions)options NS_AVAILABLE(10_6, 4_0); /* -contentsOfDirectoryAtURL:includingPropertiesForKeys:options:error: returns an NSArray of NSURLs identifying the the directory entries. If this method returns nil, an NSError will be returned by reference in the 'error' parameter. If the directory contains no entries, this method will return the empty array. When an array is specified for the 'keys' parameter, the specified property values will be pre-fetched and cached with each enumerated URL. This method always does a shallow enumeration of the specified directory (i.e. it always acts as if NSDirectoryEnumerationSkipsSubdirectoryDescendants has been specified). If you need to perform a deep enumeration, use -[NSFileManager enumeratorAtURL:includingPropertiesForKeys:options:errorHandler:]. If you wish to only receive the URLs and no other attributes, then pass '0' for 'options' and an empty NSArray ('[NSArray array]') for 'keys'. If you wish to have the property caches of the vended URLs pre-populated with a default set of attributes, then pass '0' for 'options' and 'nil' for 'keys'. */ - (NSArray *)contentsOfDirectoryAtURL:(NSURL *)url includingPropertiesForKeys:(NSArray *)keys options:(NSDirectoryEnumerationOptions)mask error:(NSError **)error NS_AVAILABLE(10_6, 4_0); /* -URLsForDirectory:inDomains: is analogous to NSSearchPathForDirectoriesInDomains(), but returns an array of NSURL instances for use with URL-taking APIs. This API is suitable when you need to search for a file or files which may live in one of a variety of locations in the domains specified. */ - (NSArray *)URLsForDirectory:(NSSearchPathDirectory)directory inDomains:(NSSearchPathDomainMask)domainMask NS_AVAILABLE(10_6, 4_0); /* -URLForDirectory:inDomain:appropriateForURL:create:error: is a URL-based replacement for FSFindFolder(). It allows for the specification and (optional) creation of a specific directory for a particular purpose (e.g. the replacement of a particular item on disk, or a particular Library directory. You may pass only one of the values from the NSSearchPathDomainMask enumeration, and you may not pass NSAllDomainsMask. */ - (NSURL *)URLForDirectory:(NSSearchPathDirectory)directory inDomain:(NSSearchPathDomainMask)domain appropriateForURL:(NSURL *)url create:(BOOL)shouldCreate error:(NSError **)error NS_AVAILABLE(10_6, 4_0); /* createDirectoryAtURL:withIntermediateDirectories:attributes:error: creates a directory at the specified URL. If you pass 'NO' for withIntermediateDirectories, the directory must not exist at the time this call is made. Passing 'YES' for withIntermediateDirectories will create any necessary intermediate directories. This method returns YES if all directories specified in 'url' were created and attributes were set. Directories are created with attributes specified by the dictionary passed to 'attributes'. If no dictionary is supplied, directories are created according to the umask of the process. This method returns NO if a failure occurs at any stage of the operation. If an error parameter was provided, a presentable NSError will be returned by reference. */ - (BOOL)createDirectoryAtURL:(NSURL *)url withIntermediateDirectories:(BOOL)createIntermediates attributes:(NSDictionary *)attributes error:(NSError **)error NS_AVAILABLE(10_7, 5_0); /* createSymbolicLinkAtURL:withDestinationURL:error: returns YES if the symbolic link that point at 'destURL' was able to be created at the location specified by 'url'. 'destURL' is always resolved against its base URL, if it has one. If 'destURL' has no base URL and it's 'relativePath' is indeed a relative path, then a relative symlink will be created. If this method returns NO, the link was unable to be created and an NSError will be returned by reference in the 'error' parameter. This method does not traverse a terminal symlink. */ - (BOOL)createSymbolicLinkAtURL:(NSURL *)url withDestinationURL:(NSURL *)destURL error:(NSError **)error NS_AVAILABLE(10_7, 5_0); /* Instances of NSFileManager may now have delegates. Each instance has one delegate, and the delegate is not retained. In versions of Mac OS X prior to 10.5, the behavior of calling [[NSFileManager alloc] init] was undefined. In Mac OS X 10.5 "Leopard" and later, calling [[NSFileManager alloc] init] returns a new instance of an NSFileManager. */ - (void)setDelegate:(id)delegate NS_AVAILABLE(10_5, 2_0); - (id)delegate NS_AVAILABLE(10_5, 2_0); /* setAttributes:ofItemAtPath:error: returns YES when the attributes specified in the 'attributes' dictionary are set successfully on the item specified by 'path'. If this method returns NO, a presentable NSError will be provided by-reference in the 'error' parameter. If no error is required, you may pass 'nil' for the error. This method replaces changeFileAttributes:atPath:. */ - (BOOL)setAttributes:(NSDictionary *)attributes ofItemAtPath:(NSString *)path error:(NSError **)error NS_AVAILABLE(10_5, 2_0); /* createDirectoryAtPath:withIntermediateDirectories:attributes:error: creates a directory at the specified path. If you pass 'NO' for createIntermediates, the directory must not exist at the time this call is made. Passing 'YES' for 'createIntermediates' will create any necessary intermediate directories. This method returns YES if all directories specified in 'path' were created and attributes were set. Directories are created with attributes specified by the dictionary passed to 'attributes'. If no dictionary is supplied, directories are created according to the umask of the process. This method returns NO if a failure occurs at any stage of the operation. If an error parameter was provided, a presentable NSError will be returned by reference. This method replaces createDirectoryAtPath:attributes: */ - (BOOL)createDirectoryAtPath:(NSString *)path withIntermediateDirectories:(BOOL)createIntermediates attributes:(NSDictionary *)attributes error:(NSError **)error NS_AVAILABLE(10_5, 2_0); /* contentsOfDirectoryAtPath:error: returns an NSArray of NSStrings representing the filenames of the items in the directory. If this method returns 'nil', an NSError will be returned by reference in the 'error' parameter. If the directory contains no items, this method will return the empty array. This method replaces directoryContentsAtPath: */ - (NSArray *)contentsOfDirectoryAtPath:(NSString *)path error:(NSError **)error NS_AVAILABLE(10_5, 2_0); /* subpathsOfDirectoryAtPath:error: returns an NSArray of NSStrings represeting the filenames of the items in the specified directory and all its subdirectories recursively. If this method returns 'nil', an NSError will be returned by reference in the 'error' parameter. If the directory contains no items, this method will return the empty array. This method replaces subpathsAtPath: */ - (NSArray *)subpathsOfDirectoryAtPath:(NSString *)path error:(NSError **)error NS_AVAILABLE(10_5, 2_0); /* attributesOfItemAtPath:error: returns an NSDictionary of key/value pairs containing the attributes of the item (file, directory, symlink, etc.) at the path in question. If this method returns 'nil', an NSError will be returned by reference in the 'error' parameter. This method does not traverse a terminal symlink. This method replaces fileAttributesAtPath:traverseLink:. */ - (NSDictionary *)attributesOfItemAtPath:(NSString *)path error:(NSError **)error NS_AVAILABLE(10_5, 2_0); /* attributesOfFileSystemForPath:error: returns an NSDictionary of key/value pairs containing the attributes of the filesystem containing the provided path. If this method returns 'nil', an NSError will be returned by reference in the 'error' parameter. This method does not traverse a terminal symlink. This method replaces fileSystemAttributesAtPath:. */ - (NSDictionary *)attributesOfFileSystemForPath:(NSString *)path error:(NSError **)error NS_AVAILABLE(10_5, 2_0); /* createSymbolicLinkAtPath:withDestination:error: returns YES if the symbolic link that point at 'destPath' was able to be created at the location specified by 'path'. If this method returns NO, the link was unable to be created and an NSError will be returned by reference in the 'error' parameter. This method does not traverse a terminal symlink. This method replaces createSymbolicLinkAtPath:pathContent: */ - (BOOL)createSymbolicLinkAtPath:(NSString *)path withDestinationPath:(NSString *)destPath error:(NSError **)error NS_AVAILABLE(10_5, 2_0); /* destinationOfSymbolicLinkAtPath:error: returns an NSString containing the path of the item pointed at by the symlink specified by 'path'. If this method returns 'nil', an NSError will be returned by reference in the 'error' parameter. This method replaces pathContentOfSymbolicLinkAtPath: */ - (NSString *)destinationOfSymbolicLinkAtPath:(NSString *)path error:(NSError **)error NS_AVAILABLE(10_5, 2_0); /* These methods replace their non-error returning counterparts below. See the NSFileManagerFileOperationAdditions category below for methods that are dispatched to the NSFileManager instance's delegate. */ - (BOOL)copyItemAtPath:(NSString *)srcPath toPath:(NSString *)dstPath error:(NSError **)error NS_AVAILABLE(10_5, 2_0); - (BOOL)moveItemAtPath:(NSString *)srcPath toPath:(NSString *)dstPath error:(NSError **)error NS_AVAILABLE(10_5, 2_0); - (BOOL)linkItemAtPath:(NSString *)srcPath toPath:(NSString *)dstPath error:(NSError **)error NS_AVAILABLE(10_5, 2_0); - (BOOL)removeItemAtPath:(NSString *)path error:(NSError **)error NS_AVAILABLE(10_5, 2_0); /* These methods are URL-taking equivalents of the four methods above. Their delegate methods are defined in the NSFileManagerFileOperationAdditions category below. */ - (BOOL)copyItemAtURL:(NSURL *)srcURL toURL:(NSURL *)dstURL error:(NSError **)error NS_AVAILABLE(10_6, 4_0); - (BOOL)moveItemAtURL:(NSURL *)srcURL toURL:(NSURL *)dstURL error:(NSError **)error NS_AVAILABLE(10_6, 4_0); - (BOOL)linkItemAtURL:(NSURL *)srcURL toURL:(NSURL *)dstURL error:(NSError **)error NS_AVAILABLE(10_6, 4_0); - (BOOL)removeItemAtURL:(NSURL *)URL error:(NSError **)error NS_AVAILABLE(10_6, 4_0); /* trashItemAtURL:resultingItemURL:error: returns YES if the item at 'url' was successfully moved to a Trash. Since the operation may require renaming the file to avoid collisions, it also returns by reference the resulting URL that the item was moved to. If this method returns NO, the item was not moved and an NSError will be returned by reference in the 'error' parameter. */ - (BOOL)trashItemAtURL:(NSURL *)url resultingItemURL:(NSURL **)outResultingURL error:(NSError **)error NS_AVAILABLE_MAC(10_8); /* The following methods are deprecated on Mac OS X 10.5. Their URL-based and/or error-returning replacements are listed above. */ - (NSDictionary *)fileAttributesAtPath:(NSString *)path traverseLink:(BOOL)yorn NS_DEPRECATED(10_0, 10_5, 2_0, 2_0); - (BOOL)changeFileAttributes:(NSDictionary *)attributes atPath:(NSString *)path NS_DEPRECATED(10_0, 10_5, 2_0, 2_0); - (NSArray *)directoryContentsAtPath:(NSString *)path NS_DEPRECATED(10_0, 10_5, 2_0, 2_0); - (NSDictionary *)fileSystemAttributesAtPath:(NSString *)path NS_DEPRECATED(10_0, 10_5, 2_0, 2_0); - (NSString *)pathContentOfSymbolicLinkAtPath:(NSString *)path NS_DEPRECATED(10_0, 10_5, 2_0, 2_0); - (BOOL)createSymbolicLinkAtPath:(NSString *)path pathContent:(NSString *)otherpath NS_DEPRECATED(10_0, 10_5, 2_0, 2_0); - (BOOL)createDirectoryAtPath:(NSString *)path attributes:(NSDictionary *)attributes NS_DEPRECATED(10_0, 10_5, 2_0, 2_0); #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || TARGET_OS_WIN32 - (BOOL)linkPath:(NSString *)src toPath:(NSString *)dest handler:(id)handler NS_DEPRECATED(10_0, 10_5, 2_0, 2_0); - (BOOL)copyPath:(NSString *)src toPath:(NSString *)dest handler:(id)handler NS_DEPRECATED(10_0, 10_5, 2_0, 2_0); - (BOOL)movePath:(NSString *)src toPath:(NSString *)dest handler:(id)handler NS_DEPRECATED(10_0, 10_5, 2_0, 2_0); - (BOOL)removeFileAtPath:(NSString *)path handler:(id)handler NS_DEPRECATED(10_0, 10_5, 2_0, 2_0); #endif /* Process working directory management. Despite the fact that these are instance methods on NSFileManager, these methods report and change (respectively) the working directory for the entire process. Developers are cautioned that doing so is fraught with peril. */ - (NSString *)currentDirectoryPath; - (BOOL)changeCurrentDirectoryPath:(NSString *)path; /* The following methods are of limited utility. Attempting to predicate behavior based on the current state of the filesystem or a particular file on the filesystem is encouraging odd behavior in the face of filesystem race conditions. It's far better to attempt an operation (like loading a file or creating a directory) and handle the error gracefully than it is to try to figure out ahead of time whether the operation will succeed. */ - (BOOL)fileExistsAtPath:(NSString *)path; - (BOOL)fileExistsAtPath:(NSString *)path isDirectory:(BOOL *)isDirectory; - (BOOL)isReadableFileAtPath:(NSString *)path; - (BOOL)isWritableFileAtPath:(NSString *)path; - (BOOL)isExecutableFileAtPath:(NSString *)path; - (BOOL)isDeletableFileAtPath:(NSString *)path; /* -contentsEqualAtPath:andPath: does not take into account data stored in the resource fork or filesystem extended attributes. */ - (BOOL)contentsEqualAtPath:(NSString *)path1 andPath:(NSString *)path2; /* displayNameAtPath: returns an NSString suitable for presentation to the user. For directories which have localization information, this will return the appropriate localized string. This string is not suitable for passing to anything that must interact with the filesystem. */ - (NSString *)displayNameAtPath:(NSString *)path; /* componentsToDisplayForPath: returns an NSArray of display names for the path provided. Localization will occur as in displayNameAtPath: above. This array cannot and should not be reassembled into an usable filesystem path for any kind of access. */ - (NSArray *)componentsToDisplayForPath:(NSString *)path; /* enumeratorAtPath: returns an NSDirectoryEnumerator rooted at the provided path. If the enumerator cannot be created, this returns NULL. Because NSDirectoryEnumerator is a subclass of NSEnumerator, the returned object can be used in the for...in construct. */ - (NSDirectoryEnumerator *)enumeratorAtPath:(NSString *)path; #if NS_BLOCKS_AVAILABLE /* enumeratorAtURL:includingPropertiesForKeys:options:errorHandler: returns an NSDirectoryEnumerator rooted at the provided directory URL. The NSDirectoryEnumerator returns NSURLs from the -nextObject method. The optional 'includingPropertiesForKeys' parameter indicates which resource properties should be pre-fetched and cached with each enumerated URL. The optional 'errorHandler' block argument is invoked when an error occurs. Parameters to the block are the URL on which an error occurred and the error. When the error handler returns YES, enumeration continues if possible. Enumeration stops immediately when the error handler returns NO. If you wish to only receive the URLs and no other attributes, then pass '0' for 'options' and an empty NSArray ('[NSArray array]') for 'keys'. If you wish to have the property caches of the vended URLs pre-populated with a default set of attributes, then pass '0' for 'options' and 'nil' for 'keys'. */ - (NSDirectoryEnumerator *)enumeratorAtURL:(NSURL *)url includingPropertiesForKeys:(NSArray *)keys options:(NSDirectoryEnumerationOptions)mask errorHandler:(BOOL (^)(NSURL *url, NSError *error))handler NS_AVAILABLE(10_6, 4_0); #endif /* subpathsAtPath: returns an NSArray of all contents and subpaths recursively from the provided path. This may be very expensive to compute for deep filesystem hierarchies, and should probably be avoided. */ - (NSArray *)subpathsAtPath:(NSString *)path; /* These methods are provided here for compatibility. The corresponding methods on NSData which return NSErrors should be regarded as the primary method of creating a file from an NSData or retrieving the contents of a file as an NSData. */ - (NSData *)contentsAtPath:(NSString *)path; - (BOOL)createFileAtPath:(NSString *)path contents:(NSData *)data attributes:(NSDictionary *)attr; /* fileSystemRepresentationWithPath: returns an array of characters suitable for passing to lower-level POSIX style APIs. The string is provided in the representation most appropriate for the filesystem in question. */ - (__strong const char *)fileSystemRepresentationWithPath:(NSString *)path NS_RETURNS_INNER_POINTER; /* stringWithFileSystemRepresentation:length: returns an NSString created from an array of bytes that are in the filesystem representation. */ - (NSString *)stringWithFileSystemRepresentation:(const char *)str length:(NSUInteger)len; /* -replaceItemAtURL:withItemAtURL:backupItemName:options:resultingItemURL:error: is for developers who wish to perform a safe-save without using the full NSDocument machinery that is available in the AppKit. The `originalItemURL` is the item being replaced. `newItemURL` is the item which will replace the original item. This item should be placed in a temporary directory as provided by the OS, or in a uniquely named directory placed in the same directory as the original item if the temporary directory is not available. If `backupItemName` is provided, that name will be used to create a backup of the original item. The backup is placed in the same directory as the original item. If an error occurs during the creation of the backup item, the operation will fail. If there is already an item with the same name as the backup item, that item will be removed. The backup item will be removed in the event of success unless the `NSFileManagerItemReplacementWithoutDeletingBackupItem` option is provided in `options`. For `options`, pass `0` to get the default behavior, which uses only the metadata from the new item while adjusting some properties using values from the original item. Pass `NSFileManagerItemReplacementUsingNewMetadataOnly` in order to use all possible metadata from the new item. */ - (BOOL)replaceItemAtURL:(NSURL *)originalItemURL withItemAtURL:(NSURL *)newItemURL backupItemName:(NSString *)backupItemName options:(NSFileManagerItemReplacementOptions)options resultingItemURL:(NSURL **)resultingURL error:(NSError **)error NS_AVAILABLE(10_6, 4_0); /* Changes whether the item for the specified URL is ubiquitous and moves the item to the destination URL. When making an item ubiquitous, the destination URL must be prefixed with a URL from -URLForUbiquityContainerIdentifier:. Returns YES if the change is successful, NO otherwise. */ - (BOOL)setUbiquitous:(BOOL)flag itemAtURL:(NSURL *)url destinationURL:(NSURL *)destinationURL error:(NSError **)error NS_AVAILABLE(10_7, 5_0); /* Returns YES if the item for the specified URL is ubiquitous, NO otherwise. */ - (BOOL)isUbiquitousItemAtURL:(NSURL *)url NS_AVAILABLE(10_7, 5_0); /* Start downloading a local instance of the specified ubiquitous item, if necessary. Returns YES if the download started successfully or wasn't necessary, NO otherwise. */ - (BOOL)startDownloadingUbiquitousItemAtURL:(NSURL *)url error:(NSError **)error NS_AVAILABLE(10_7, 5_0); /* Removes the local instance of the ubiquitous item at the given URL. Returns YES if removal was successful, NO otherwise. */ - (BOOL)evictUbiquitousItemAtURL:(NSURL *)url error:(NSError **)error NS_AVAILABLE(10_7, 5_0); /* Returns a file URL for the root of the ubiquity container directory corresponding to the supplied container ID. Returns nil if the mobile container does not exist or could not be determined. */ - (NSURL *)URLForUbiquityContainerIdentifier:(NSString *)containerIdentifier NS_AVAILABLE(10_7, 5_0); /* Returns a URL that can be shared with other users to allow them download a copy of the specified ubiquitous item. Also returns the date after which the item will no longer be accessible at the returned URL. The URL must be prefixed with a URL from -URLForUbiquityContainerIdentifier:. */ - (NSURL *)URLForPublishingUbiquitousItemAtURL:(NSURL *)url expirationDate:(NSDate **)outDate error:(NSError **)error NS_AVAILABLE(10_7, 5_0); /* Returns an opaque token that represents the current ubiquity identity. This object can be copied, encoded, or compared with isEqual:. When ubiquity containers are unavailable because the user has disabled them, or when the user is simply not logged in, this method will return nil. The NSUbiquityIdentityDidChangeNotification notification is posted after this value changes. If you don't need the container URL and just want to check if ubiquity containers are available you should use this method instead of checking -URLForUbiquityContainerIdentifier:. */ - (id )ubiquityIdentityToken NS_AVAILABLE(10_8, 6_0); @end /* These delegate methods are for the use of the deprecated handler-taking methods on NSFileManager for copying, moving, linking or deleting files. */ @interface NSObject (NSCopyLinkMoveHandler) - (BOOL)fileManager:(NSFileManager *)fm shouldProceedAfterError:(NSDictionary *)errorInfo NS_DEPRECATED(10_0, 10_5, 2_0, 2_0); - (void)fileManager:(NSFileManager *)fm willProcessPath:(NSString *)path NS_DEPRECATED(10_0, 10_5, 2_0, 2_0); @end @protocol NSFileManagerDelegate @optional /* fileManager:shouldCopyItemAtPath:toPath: gives the delegate an opportunity to filter the resulting copy. Returning YES from this method will allow the copy to happen. Returning NO from this method causes the item in question to be skipped. If the item skipped was a directory, no children of that directory will be copied, nor will the delegate be notified of those children. If the delegate does not implement this method, the NSFileManager instance acts as if this method returned YES. */ - (BOOL)fileManager:(NSFileManager *)fileManager shouldCopyItemAtPath:(NSString *)srcPath toPath:(NSString *)dstPath; - (BOOL)fileManager:(NSFileManager *)fileManager shouldCopyItemAtURL:(NSURL *)srcURL toURL:(NSURL *)dstURL NS_AVAILABLE(10_6, 4_0); /* fileManager:shouldProceedAfterError:copyingItemAtPath:toPath: gives the delegate an opportunity to recover from or continue copying after an error. If an error occurs, the error object will contain an NSError indicating the problem. The source path and destination paths are also provided. If this method returns YES, the NSFileManager instance will continue as if the error had not occurred. If this method returns NO, the NSFileManager instance will stop copying, return NO from copyItemAtPath:toPath:error: and the error will be provied there. If the delegate does not implement this method, the NSFileManager instance acts as if this method returned NO. */ - (BOOL)fileManager:(NSFileManager *)fileManager shouldProceedAfterError:(NSError *)error copyingItemAtPath:(NSString *)srcPath toPath:(NSString *)dstPath; - (BOOL)fileManager:(NSFileManager *)fileManager shouldProceedAfterError:(NSError *)error copyingItemAtURL:(NSURL *)srcURL toURL:(NSURL *)dstURL NS_AVAILABLE(10_6, 4_0); /* fileManager:shouldMoveItemAtPath:toPath: gives the delegate an opportunity to not move the item at the specified path. If the source path and the destination path are not on the same device, a copy is performed to the destination path and the original is removed. If the copy does not succeed, an error is returned and the incomplete copy is removed, leaving the original in place. If the delegate does not implement this method, the NSFileManager instance acts as if this method returned YES. */ - (BOOL)fileManager:(NSFileManager *)fileManager shouldMoveItemAtPath:(NSString *)srcPath toPath:(NSString *)dstPath; - (BOOL)fileManager:(NSFileManager *)fileManager shouldMoveItemAtURL:(NSURL *)srcURL toURL:(NSURL *)dstURL NS_AVAILABLE(10_6, 4_0); /* fileManager:shouldProceedAfterError:movingItemAtPath:toPath: functions much like fileManager:shouldProceedAfterError:copyingItemAtPath:toPath: above. The delegate has the opportunity to remedy the error condition and allow the move to continue. If the delegate does not implement this method, the NSFileManager instance acts as if this method returned NO. */ - (BOOL)fileManager:(NSFileManager *)fileManager shouldProceedAfterError:(NSError *)error movingItemAtPath:(NSString *)srcPath toPath:(NSString *)dstPath; - (BOOL)fileManager:(NSFileManager *)fileManager shouldProceedAfterError:(NSError *)error movingItemAtURL:(NSURL *)srcURL toURL:(NSURL *)dstURL NS_AVAILABLE(10_6, 4_0); /* fileManager:shouldLinkItemAtPath:toPath: acts as the other "should" methods, but this applies to the file manager creating hard links to the files in question. If the delegate does not implement this method, the NSFileManager instance acts as if this method returned YES. */ - (BOOL)fileManager:(NSFileManager *)fileManager shouldLinkItemAtPath:(NSString *)srcPath toPath:(NSString *)dstPath; - (BOOL)fileManager:(NSFileManager *)fileManager shouldLinkItemAtURL:(NSURL *)srcURL toURL:(NSURL *)dstURL NS_AVAILABLE(10_6, 4_0); /* fileManager:shouldProceedAfterError:linkingItemAtPath:toPath: allows the delegate an opportunity to remedy the error which occurred in linking srcPath to dstPath. If the delegate returns YES from this method, the linking will continue. If the delegate returns NO from this method, the linking operation will stop and the error will be returned via linkItemAtPath:toPath:error:. If the delegate does not implement this method, the NSFileManager instance acts as if this method returned NO. */ - (BOOL)fileManager:(NSFileManager *)fileManager shouldProceedAfterError:(NSError *)error linkingItemAtPath:(NSString *)srcPath toPath:(NSString *)dstPath; - (BOOL)fileManager:(NSFileManager *)fileManager shouldProceedAfterError:(NSError *)error linkingItemAtURL:(NSURL *)srcURL toURL:(NSURL *)dstURL NS_AVAILABLE(10_6, 4_0); /* fileManager:shouldRemoveItemAtPath: allows the delegate the opportunity to not remove the item at path. If the delegate returns YES from this method, the NSFileManager instance will attempt to remove the item. If the delegate returns NO from this method, the remove skips the item. If the item is a directory, no children of that item will be visited. If the delegate does not implement this method, the NSFileManager instance acts as if this method returned YES. */ - (BOOL)fileManager:(NSFileManager *)fileManager shouldRemoveItemAtPath:(NSString *)path; - (BOOL)fileManager:(NSFileManager *)fileManager shouldRemoveItemAtURL:(NSURL *)URL NS_AVAILABLE(10_6, 4_0); /* fileManager:shouldProceedAfterError:removingItemAtPath: allows the delegate an opportunity to remedy the error which occurred in removing the item at the path provided. If the delegate returns YES from this method, the removal operation will continue. If the delegate returns NO from this method, the removal operation will stop and the error will be returned via linkItemAtPath:toPath:error:. If the delegate does not implement this method, the NSFileManager instance acts as if this method returned NO. */ - (BOOL)fileManager:(NSFileManager *)fileManager shouldProceedAfterError:(NSError *)error removingItemAtPath:(NSString *)path; - (BOOL)fileManager:(NSFileManager *)fileManager shouldProceedAfterError:(NSError *)error removingItemAtURL:(NSURL *)URL NS_AVAILABLE(10_6, 4_0); @end @interface NSDirectoryEnumerator : NSEnumerator /* For NSDirectoryEnumerators created with -enumeratorAtPath:, the -fileAttributes and -directoryAttributes methods return an NSDictionary containing the keys listed below. For NSDirectoryEnumerators created with -enumeratorAtURL:includingPropertiesForKeys:options:errorHandler:, these two methods return nil. */ - (NSDictionary *)fileAttributes; - (NSDictionary *)directoryAttributes; - (void)skipDescendents; /* This method returns the number of levels deep the current object is in the directory hierarchy being enumerated. The directory passed to -enumeratorAtURL:includingPropertiesForKeys:options:errorHandler: is considered to be level 0. */ - (NSUInteger)level NS_AVAILABLE(10_6, 4_0); /* This method is spelled correctly. */ - (void)skipDescendants NS_AVAILABLE(10_6, 4_0); @end FOUNDATION_EXPORT NSString * const NSFileType; FOUNDATION_EXPORT NSString * const NSFileTypeDirectory; FOUNDATION_EXPORT NSString * const NSFileTypeRegular; FOUNDATION_EXPORT NSString * const NSFileTypeSymbolicLink; FOUNDATION_EXPORT NSString * const NSFileTypeSocket; FOUNDATION_EXPORT NSString * const NSFileTypeCharacterSpecial; FOUNDATION_EXPORT NSString * const NSFileTypeBlockSpecial; FOUNDATION_EXPORT NSString * const NSFileTypeUnknown; FOUNDATION_EXPORT NSString * const NSFileSize; FOUNDATION_EXPORT NSString * const NSFileModificationDate; FOUNDATION_EXPORT NSString * const NSFileReferenceCount; FOUNDATION_EXPORT NSString * const NSFileDeviceIdentifier; FOUNDATION_EXPORT NSString * const NSFileOwnerAccountName; FOUNDATION_EXPORT NSString * const NSFileGroupOwnerAccountName; FOUNDATION_EXPORT NSString * const NSFilePosixPermissions; FOUNDATION_EXPORT NSString * const NSFileSystemNumber; FOUNDATION_EXPORT NSString * const NSFileSystemFileNumber; FOUNDATION_EXPORT NSString * const NSFileExtensionHidden; FOUNDATION_EXPORT NSString * const NSFileHFSCreatorCode; FOUNDATION_EXPORT NSString * const NSFileHFSTypeCode; FOUNDATION_EXPORT NSString * const NSFileImmutable; FOUNDATION_EXPORT NSString * const NSFileAppendOnly; FOUNDATION_EXPORT NSString * const NSFileCreationDate; FOUNDATION_EXPORT NSString * const NSFileOwnerAccountID; FOUNDATION_EXPORT NSString * const NSFileGroupOwnerAccountID; FOUNDATION_EXPORT NSString * const NSFileBusy; FOUNDATION_EXPORT NSString * const NSFileProtectionKey NS_AVAILABLE_IOS(4_0); FOUNDATION_EXPORT NSString * const NSFileProtectionNone NS_AVAILABLE_IOS(4_0); FOUNDATION_EXPORT NSString * const NSFileProtectionComplete NS_AVAILABLE_IOS(4_0); FOUNDATION_EXPORT NSString * const NSFileProtectionCompleteUnlessOpen NS_AVAILABLE_IOS(5_0); FOUNDATION_EXPORT NSString * const NSFileProtectionCompleteUntilFirstUserAuthentication NS_AVAILABLE_IOS(5_0); FOUNDATION_EXPORT NSString * const NSFileSystemSize; FOUNDATION_EXPORT NSString * const NSFileSystemFreeSize; FOUNDATION_EXPORT NSString * const NSFileSystemNodes; FOUNDATION_EXPORT NSString * const NSFileSystemFreeNodes; @interface NSDictionary (NSFileAttributes) - (unsigned long long)fileSize; - (NSDate *)fileModificationDate; - (NSString *)fileType; - (NSUInteger)filePosixPermissions; - (NSString *)fileOwnerAccountName; - (NSString *)fileGroupOwnerAccountName; - (NSInteger)fileSystemNumber; - (NSUInteger)fileSystemFileNumber; - (BOOL)fileExtensionHidden; - (OSType)fileHFSCreatorCode; - (OSType)fileHFSTypeCode; - (BOOL)fileIsImmutable; - (BOOL)fileIsAppendOnly; - (NSDate *)fileCreationDate; - (NSNumber *)fileOwnerAccountID; - (NSNumber *)fileGroupOwnerAccountID; @end /* NSFilePresenter.h Copyright (c) 2010-2012, Apple Inc. All rights reserved. */ #import @class NSError, NSFileVersion, NSOperationQueue, NSURL; /* A protocol to be implemented by objects that present the contents of files or directories to the user for viewing or editing. The objects can take an active role in operations that access those files or directories, even operations performed by other processes in the system. For an NSFilePresenter to be aware of such file access it must be "coordinated" file access. The NSFileCoordinator class that is used to do coordinated file access is declared in . Starting in version 10.7 many components of Mac OS X use NSFileCoordinator, including AppKit, Finder, and various applications. NSDocument conforms to the NSFilePresenter protocol and has useful implementations of all of its methods. You are unlikely to have to implement NSFilePresenter yourself in an NSDocument-based application. See the comments for -[NSFileCoordinator initWithFilePresenter:] for information about how an NSFilePresenter can avoid receiving messages about its own reading and writing. You can consider "item" in method names in this header file to be an abbreviation of "fileOrDirectory." As always, a directory might actually be a file package. */ @protocol NSFilePresenter @required /* The NSURL that locates the file or directory that the receiver is presenting to the user. Implementations of this method must be prepared to be invoked by Cocoa in any queue, at any time, including from within invocations of NSFileCoordinator methods. A nil value is valid and means that the presented item does not exist yet. An NSFilePresenter with a nil presentedItemURL will be asked for its presentedItemURL again when coordinated file access on behalf of that NSFilePresenter completes, in case the presented item was just created. For example, NSDocument has a -presentedItemURL method that usually returns [self fileURL]. In a shoebox application that stores the user's data in files somewhere on the user's computer you can implement this method to specify the directory that contains those files. */ @property (readonly) NSURL *presentedItemURL; /* The operation queue in which all of the other NSFilePresenter messages except -presentedItemURL will be sent to the receiver. Implementations of this method must be prepared to be invoked by Cocoa in any queue, at any time, including from within invocations of NSFileCoordinator methods. A nil value is not valid. For example, NSDocument has a -presentedItemOperationQueue method that returns a private queue. In very simple cases you can return [NSOperationQueue mainQueue], but doing so is often an invitation to deadlocks. */ @property (readonly) NSOperationQueue *presentedItemOperationQueue; @optional /* Support for App Sandbox on OS X. Some applications, given a user-selected file, require access to additional files or directories with related names. For example, a movie player might have to automatically load subtitles for a movie that the user opened. By convention, the subtitle file has the same name as the movie, but a different file extension. If the movie player is sandboxed, its use of NSOpenPanel will grant it access to the user-selected movie (the primary item). However, access to the subtitle file (the secondary item) will not be granted by NSOpenPanel. To get access to a secondary item, a process can register an NSFilePresenter for it and unregister the NSFilePresenter once the application is finished accessing it. Each NSFilePresenter of a secondary item must return an NSURL to the primary item on request. You make that happen by providing an implementation of -primaryPresentedItemURL that returns an NSURL for the primary item. */ @property (readonly) NSURL *primaryPresentedItemURL NS_AVAILABLE(10_8, NA); #if NS_BLOCKS_AVAILABLE /* Given that something in the system is waiting to read from the presented file or directory, do whatever it takes to ensure that the application will behave properly while that reading is happening, and then invoke the completion handler. The definition of "properly" depends on what kind of ownership model the application implements. Implementations of this method must always invoke the passed-in reader block because other parts of the system will wait until it is invoked or until the user loses patience and cancels the waiting. When an implementation of this method invokes the passed-in block it can pass that block yet another block, which will be invoked in the receiver's operation queue when reading is complete. A common sequence that your NSFilePresenter must handle is the file coordination mechanism sending this message, then sending -savePresentedItemChangesWithCompletionHandler:, and then, after you have invoked that completion handler, invoking your reacquirer. */ - (void)relinquishPresentedItemToReader:(void (^)(void (^reacquirer)(void)))reader; /* Given that something in the system is waiting to write to the presented file or directory, do whatever it takes to ensure that the application will behave properly while that writing is happening, and then invoke the completion handler. The definition of "properly" depends on what kind of ownership model the application implements. Implementations of this method must always invoke the passed-in writer block because other parts of the system will wait until it is invoked or until the user loses patience and cancels the waiting. When an implementation of this method invokes the passed-in block it can pass that block yet another block, which will be invoked in the receiver's operation queue when writing is complete. A common sequence that your NSFilePresenter must handle is the file coordination mechanism sending this message, then sending -accommodatePresentedItemDeletionWithCompletionHandler: or -savePresentedItemChangesWithCompletionHandler:, and then, after you have invoked that completion handler, invoking your reacquirer. It is also common for your NSFilePresenter to be sent a combination of the -presented... messages listed below in between relinquishing and reacquiring. */ - (void)relinquishPresentedItemToWriter:(void (^)(void (^reacquirer)(void)))writer; /* Given that something in the system is waiting to read from the presented file or directory, do whatever it takes to ensure that the contents of the presented file or directory is completely up to date, and then invoke the completion handler. If successful (including when there is simply nothing to do) pass nil to the completion handler, or if not successful pass an NSError that encapsulates the reason why saving failed. Implementations of this method must always invoke the completion handler because other parts of the system will wait until it is invoked or the user loses patience and cancels the waiting. If this method is not implemented then the NSFilePresenter is assumed to be one that never lets the user make changes that need to be saved. For example, NSDocument has an implementation of this method that autosaves the document if it has been changed since the last time it was saved or autosaved. That way when another process tries to read the document file it always reads the same version of the document that the user is looking at in your application. (WYSIWGCBF - What You See Is What Gets Copied By Finder.) A shoebox application would also implement this method. The file coordination mechanism does not always send -relinquishPresentedItemToReader: or -relinquishPresentedItemToWriter: to your NSFilePresenter before sending this message. For example, other process' use of -[NSFileCoordinator prepareForReadingItemsAtURLs:options:writingItemsAtURLs:options:error:byAccessor:] can cause this to happen. */ - (void)savePresentedItemChangesWithCompletionHandler:(void (^)(NSError *errorOrNil))completionHandler; /* Given that something in the system is waiting to delete the presented file or directory, do whatever it takes to ensure that the deleting will succeed and that the receiver's application will behave properly when the deleting has happened, and then invoke the completion handler. If successful (including when there is simply nothing to do) pass nil to the completion handler, or if not successful pass an NSError that encapsulates the reason why preparation failed. Implementations of this method must always invoke the completion handler because other parts of the system will wait until it is invoked or until the user loses patience and cancels the waiting. For example, NSDocument has an implementation of this method that closes the document. That way if the document is in the trash and the user empties the trash the document is simply closed before its file is deleted. This means that emptying the trash will not fail with an alert about the file being "in use" just because the document's file is memory mapped by the application. It also means that the document won't be left open with no document file underneath it. A shoebox application would only implement this method to be robust against surprising things like the user deleting its data directory while the application is running. The file coordination mechanism does not always send -relinquishPresentedItemToReader: or -relinquishPresentedItemToWriter: to your NSFilePresenter before sending this message. For example, other process' use of -[NSFileCoordinator prepareForReadingItemsAtURLs:options:writingItemsAtURLs:options:error:byAccessor:] can cause this to happen. */ - (void)accommodatePresentedItemDeletionWithCompletionHandler:(void (^)(NSError *errorOrNil))completionHandler; #endif /* Be notified that the file or directory has been moved or renamed, or a directory containing it has been moved or renamed. A typical implementation of this method will cause subsequent invocations of -presentedItemURL to return the new URL. The new URL may have a different file name extension than the current value of the presentedItemURL property. For example, NSDocument implements this method to handle document file moving and renaming. A shoebox application would only implement this method to be robust against surprising things like the user moving its data directory while the application is running. Not all programs use file coordination. Your NSFileProvider may be sent this message without being sent -relinquishPresentedItemToWriter: first. Make your application do the best it can in that case. */ - (void)presentedItemDidMoveToURL:(NSURL *)newURL; #pragma mark *** Files and File Packages *** /* These messages are sent by the file coordination machinery only when the presented item is a file or file package. */ /* Be notified that the file or file package's contents or attributes have been been written to. Because this method may be be invoked when the attributes have changed but the contents have not, implementations that read the contents must use modification date checking to avoid needless rereading. They should check that the modification date has changed since the receiver most recently read from or wrote to the item. To avoid race conditions, getting the modification date should typically be done within invocations of one of the -[NSFileCoordinator coordinate...] methods. For example, NSDocument implements this method to react to both contents changes (like the user overwriting the document file with another application) and attribute changes (like the user toggling the "Hide extension" checkbox in a Finder info panel). It uses modification date checking as described above. Not all programs use file coordination. Your NSFileProvider may be sent this message without being sent -relinquishPresentedItemToWriter: first. Make your application do the best it can in that case. */ - (void)presentedItemDidChange; /* Be notified that something in the system has added, removed, or resolved a version of the file or file package. For example, NSDocument has implementations of these methods that help decide whether to present a versions browser when it has reacquired after relinquishing to a writer, and to react to versions being added and removed while it is presenting the versions browser. */ - (void)presentedItemDidGainVersion:(NSFileVersion *)version; - (void)presentedItemDidLoseVersion:(NSFileVersion *)version; - (void)presentedItemDidResolveConflictVersion:(NSFileVersion *)version; #pragma mark *** Directories *** /* These methods are sent by the file coordination machinery only when the presented item is a directory. "Contained by the directory" in these comments means contained by the directory, a directory contained by the directory, and so on. */ #if NS_BLOCKS_AVAILABLE /* Given that something in the system is waiting to delete a file or directory contained by the directory, do whatever it takes to ensure that the deleting will succeed and that the receiver's application will behave properly when the deleting has happened, and then invoke the completion handler. If successful (including when there is simply nothing to do) pass nil to the completion handler, or if not successful pass an NSError that encapsulates the reason why preparation failed. Implementations of this method must always invoke the completion handler because other parts of the system will wait until it is invoked or until the user loses patience and cancels the waiting. The file coordination mechanism does not always send -relinquishPresentedItemToReader: or -relinquishPresentedItemToWriter: to your NSFilePresenter before sending this message. For example, other process' use of -[NSFileCoordinator prepareForReadingItemsAtURLs:options:writingItemsAtURLs:options:error:byAccessor:] can cause this to happen. */ - (void)accommodatePresentedSubitemDeletionAtURL:(NSURL *)url completionHandler:(void (^)(NSError *errorOrNil))completionHandler; #endif /* Be notified that a file or directory contained by the directory has been added. If this method is not implemented but -presentedItemDidChange is, and the directory is actually a file package, then the file coordination machinery will invoke -presentedItemDidChange instead. Not all programs use file coordination. Your NSFileProvider may be sent this message without being sent -relinquishPresentedItemToWriter: first. Make your application do the best it can in that case. */ - (void)presentedSubitemDidAppearAtURL:(NSURL *)url; /* Be notified that a file or directory contained by the directory has been moved or renamed. If this method is not implemented but -presentedItemDidChange is, and the directory is actually a file package, then the file coordination machinery will invoke -presentedItemDidChange instead. Not all programs use file coordination. Your NSFileProvider may be sent this message without being sent -relinquishPresentedItemToWriter: first. Make your application do the best it can in that case. */ - (void)presentedSubitemAtURL:(NSURL *)oldURL didMoveToURL:(NSURL *)newURL; /* Be notified that the contents or attributes of a file or directory contained by the directory have been been written to. Depending on the situation the advice given for -presentedItemDidChange may apply here too. If this method is not implemented but -presentedItemDidChange is, and the directory is actually a file package, then the file coordination machinery will invoke -presentedItemDidChange instead. Not all programs use file coordination. Your NSFileProvider may be sent this message without being sent -relinquishPresentedItemToWriter: first. Make your application do the best it can in that case. */ - (void)presentedSubitemDidChangeAtURL:(NSURL *)url; /* Be notified that the something in the system has added, removed, or resolved a version of a file or directory contained by the directory. */ - (void)presentedSubitemAtURL:(NSURL *)url didGainVersion:(NSFileVersion *)version; - (void)presentedSubitemAtURL:(NSURL *)url didLoseVersion:(NSFileVersion *)version; - (void)presentedSubitemAtURL:(NSURL *)url didResolveConflictVersion:(NSFileVersion *)version; @end /* NSFileVersion.h Copyright (c) 2010-2012, Apple Inc. All rights reserved. */ #import @class NSArray, NSDate, NSDictionary, NSError, NSString, NSURL; typedef NS_OPTIONS(NSUInteger, NSFileVersionAddingOptions) { /* Whether +addVersionOfItemAtURL:withContentsOfURL:options:error: can move the new version contents file into the version store instead of copying it. Moving is much faster. See the comment for -temporaryDirectoryURLForNewVersionOfItemAtURL: for an example of when this useful. */ NSFileVersionAddingByMoving = 1 << 0 }; typedef NS_OPTIONS(NSUInteger, NSFileVersionReplacingOptions) { /* Whether -replaceItemAtURL:options:error: must move the version's contents out of the version store instead of copying it. This is useful when you want to promote a version's contents to a separate file. You wouldn't use this to restore a version of a file. */ NSFileVersionReplacingByMoving = 1 << 0 }; /* Instances of NSFileVersion for the same version of the same file are equal, and instances of NSFileVersion for different versions of the same file are not equal, but the equality of NSFileVersions for different files is undefined. Repeated invocations of the methods that return NSFileVersions do not necessarily return the exact same instance of NSFileVersion. */ NS_CLASS_AVAILABLE(10_7, 5_0) @interface NSFileVersion : NSObject { @private NSURL *_fileURL; id _library; NSString *_clientID; NSString *_name; NSURL *_contentsURL; BOOL _isBackup; NSString *_localizedName; NSString *_localizedComputerName; NSDate *_modificationDate; BOOL _isResolved; BOOL _contentsURLIsAccessed; id _reserved1; id _reserved2; } /* Return an NSFileVersion that represents the contents of the file located by a URL, or nil if there is no such file. */ + (NSFileVersion *)currentVersionOfItemAtURL:(NSURL *)url; /* Return an array of NSFileVersions associated with the file located by a URL, or nil if there is no such file. The array never contains an NSFileVersion equal to what +currentVersionOfItemAtURL: would return. */ + (NSArray *)otherVersionsOfItemAtURL:(NSURL *)url; /* Return an array of NSFileVersions that represent unresolved conflicts for the file located by a URL, or nil if there is no such file. */ + (NSArray *)unresolvedConflictVersionsOfItemAtURL:(NSURL *)url; /* For a file located by a URL, return the NSFileVersion identified by a persistent identifier of the sort returned by -persistentIdentifier, or nil if the version no longer exists. */ + (NSFileVersion *)versionOfItemAtURL:(NSURL *)url forPersistentIdentifier:(id)persistentIdentifier; /* Add a new version of the file located by a URL, with the contents coming from a file located by either the same or a different URL, and return a new instance that represents the version if successful. If not successful, return NO after setting *outError to an NSError that encapsulates why not. You can add versions only on Mac OS X. When adding or removing versions of a file you should do it as part of a "coordinated" write to the file. The NSFileCoordinator class that you use to do coordinated file access is declared in . Using it properly ensures that NSFilePresenters of the file, or directories that contain the file, receive accurate notifications about versions being added or removed. NSFilePresenter is declared in . For example, use -[NSFileCoordinator coordinateWritingItemAtURL:options:error:byAccessor:] when the file URL and the contents url are the same. (NSFileVersion doesn't simply use NSFileCoordinator itself because that would be insufficient when the adding or removing of versions is part of a larger operation that should be treated as one coordinated file access.) */ + (NSFileVersion *)addVersionOfItemAtURL:(NSURL *)url withContentsOfURL:(NSURL *)contentsURL options:(NSFileVersionAddingOptions)options error:(NSError **)outError NS_AVAILABLE_MAC(10_7); /* Given a URL, create a new directory that is suitable for using as the container of a new temporary file that you will create and use with NSFileVersionAddingByMoving. This is useful when you want to create a new version of a file out of something other than the file's current contents, for example, the contents in memory of a document that has not yet been saved to its file. You must remove this directory when you are done with it, using -[NSFileManager removeItemAtURL:error:] for example. */ + (NSURL *)temporaryDirectoryURLForNewVersionOfItemAtURL:(NSURL *)url NS_AVAILABLE_MAC(10_7); /* The location of the receiver's storage, or possibly nil if the receiver's storage has been deleted. The storage is read-only. The URL will have an arcane path. You must not derive user-presentable text from it. */ @property (readonly) NSURL *URL; /* The user-presentable name of the version, or possibly nil if the receiver's storage has been deleted. This will be different from the user-presentable name of the versioned file if, for example, the file has been renamed since the version was added. */ @property (readonly) NSString *localizedName; /* The user-presentable name of the computer on which the version was saved, or possibly nil if the receiver's storage has been deleted, or nil if no computer name was recorded. The computer name is guaranteed to have been recorded only if the version is a conflict version. This will be different from that computer's current name if the computer's name has been changed since the version was retrieved from that computer. */ @property (readonly) NSString *localizedNameOfSavingComputer; /* The modification date of the version, or possibly nil if the receiver's storage has been deleted. */ @property (readonly) NSDate *modificationDate; /* An object that can be encoded and, after subsequent decoding, passed to -versionOfItemAtURL:forPersistentIdentifier: to create a new instance of NSFileVersion that is equal to the receiver. */ @property (readonly) id persistentIdentifier; /* Whether the version was created as a result of the discovery of a conflict between two writers of the versioned file. */ @property (readonly, getter=isConflict) BOOL conflict; /* If the version is a conflict version, whether the conflict has been resolved. If the version is not a conflict version, simply YES. The operating system's reaction to your setting this to YES is complicated and subject to change in future releases. One result however is that the version won't appear in arrays returned by +unresolvedConflictVersionsOfItemAtURL: anymore, unless setting fails. Once you have indicated that a conflict has been resolved you cannot make it unresolved again. Setting this to NO causes an exception to be thrown. */ @property (getter=isResolved) BOOL resolved; /* Whether the system is allowed to automatically delete the receiver's storage in the future, at an unpredictable time. Setting this to YES can fail so you must not depend on discarding for correct operation. Once you have indicated that a version is discardable you cannot make it undiscardable again. Setting this to NO causes an exception to be thrown. You cannot make the versioned file itself discardable. Setting the value of this property always throws an exception when sent to the result of invoking +currentVersionOfItemAtURL:. Versions can be discardable only on Mac OS X. */ @property (getter=isDiscardable) BOOL discardable NS_AVAILABLE_MAC(10_7); /* If the passed-in URL locates a file, replace the file with a file whose contents are taken from the version but whose display name is taken from the file. If the passed-in URL does not locate a file then simply write one. If successful, return a URL that locates the resulting file; it may be different from the passed-in URL. The one exception to taking the display name from an existing file is if the version is of a different type than the overwritten file. In that case the file name extension will be taken from the version. (When file name extensions are being hidden in a user-friendly way this is not actually an exception.) If not successful, return NO after setting *outError to an NSError that encapsulates why not. When you use NSFileVersionReplacingByMoving you remove a version of the file, and should do it as part of a coordinated write to the file. The advice about this for +addVersionOfItemAtURL:withContentsOfURL:options:error: applies here too. When you use it to promote a version to a separate file you actually write to two files, and should do it as part of a coordinated write to two files, using -[NSFileCoordinator coordinateWritingItemAtURL:options:writingItemAtURL:options:error:byAccessor:], most likely using NSFileCoordinatorWritingForReplacing for the file you're promoting the version to. */ - (NSURL *)replaceItemAtURL:(NSURL *)url options:(NSFileVersionReplacingOptions)options error:(NSError **)error; /* Delete the receiver's storage, and return YES if successful. If not successful, return NO after setting *outError to an NSError that encapsulates why not. Subsequent invocations of +versionsOfItemAtURL: won't include an NSFileVersion for a successfully removed version. You cannot use this method to delete the versioned file itself. This method always throws an exception when sent to the result of invoking +currentVersionOfItemAtURL:. Use -[NSFileManager removeItemAtURL:error:] for that instead. When removing versions of a file you should do it as part of a coordinated write to the file. The advice about this for +addVersionOfItemAtURL:withContentsOfURL:options:error: applies here too. */ - (BOOL)removeAndReturnError:(NSError **)outError; /* Delete all of the versions associated with the file located by a URL, except for the current one, and return YES if successful. If not successful, return NO after setting *outError to an NSError that encapsulates why not. When removing versions of a file you should do it as part of a coordinated write to the file. The advice about this for +addVersionOfItemAtURL:withContentsOfURL:options:error: applies here too. */ + (BOOL)removeOtherVersionsOfItemAtURL:(NSURL *)url error:(NSError **)outError; @end /* NSFileWrapper.h Copyright (c) 1995-2012, Apple Inc. All rights reserved. */ #import @class NSData, NSDictionary, NSError, NSURL; typedef NS_OPTIONS(NSUInteger, NSFileWrapperReadingOptions) { /* Whether the contents are read immediately, applied recursively in the case of directory file wrappers. If reading with this option succeeds then subsequent invocations of -fileWrappers, -regularFileContents, -symbolicLinkDestinationURL:, -serializedRepresentation, and, on Mac OS X, -[NSFileWrapper(NSExtensions) icon] sent to the receiver and all its descendant file wrappers won't fail. For performance NSFileWrapper may or may not immediately read the contents of some file packages immediately even when this option is chosen. For example, the contents of bundles (not all file packages are bundles) are immutable to the user so on Mac OS X NSFileWrapper may read the children of such a directory lazily. You can use this option to take a reasonable snapshot of a file or folder for writing later. For example, a Mac OS X application like TextEdit can use this option when creating new file wrappers to represent attachments that the user creates by copying and pasting or dragging and dropping from the Finder to a TextEdit document. You wouldn't use this option when reading a document file package because that would cause unnecessarily bad perfomance. For example, an application wouldn't use this option when creating file wrappers to represent attachments as it's opening a document stored in a file package. */ NSFileWrapperReadingImmediate = 1 << 0, /* Whether file mapping for regular file wrappers is disallowed. In Mac OS 10.6 and newer NSFileWrapper only ever memory maps files on internal drives, regardless of whether this option is used. It never memory maps files on external drives or network volumes. You can use this option to keep NSFileWrapper from memory mapping files at all, even ones on internal drives. This is useful if you want to make sure your application doesn't hold files open (mapped files are open files) and therefore prevent the user from ejecting DVDs, unmounting disk partitions, or unmounting disk images. */ NSFileWrapperReadingWithoutMapping = 1 << 1 } NS_ENUM_AVAILABLE(10_6, 4_0); typedef NS_OPTIONS(NSUInteger, NSFileWrapperWritingOptions) { /* Whether writing is done atomically. You can use this option to ensure that when overwriting a file package the overwriting either completely succeeds or completely fails, with no possibility of leaving the file package in an inconsistent state. Because this option causes additional I/O you shouldn't use it unnecessarily. For example, on Mac OS X you wouldn't use this option in an override of -[NSDocument writeToURL:ofType:error:] because NSDocument's implementation of safe saving already does atomic writing. */ NSFileWrapperWritingAtomic = 1 << 0, /* Whether descendant file wrappers are sent -setFilename: if the writing succeeds. This is necessary when your application passes original contents URLs to -writeToURL:options:originalContentsURL:error:. Without using this and reusing child file wrappers properly subsequent invocations of -writeToURL:options:originalContentsURL:error: wouldn't be able to reliably create hard links in a new file package for performance because the record of names in the old file package would be out of date. */ NSFileWrapperWritingWithNameUpdating = 1 << 1 } NS_ENUM_AVAILABLE(10_6, 4_0); NS_CLASS_AVAILABLE(10_0, 4_0) @interface NSFileWrapper : NSObject { @private NSDictionary *_fileAttributes; NSString *_preferredFileName; NSString *_fileName; id _contents; id _icon; id _moreVars; } #pragma mark *** Initialization *** /* A designated initializer for creating an instance whose kind (directory, regular file, or symbolic link) is determined based on what the URL locates. If reading is not successful return nil after setting *outError to an NSError that encapsulates the reason why the file wrapper could not be read. */ - (id)initWithURL:(NSURL *)url options:(NSFileWrapperReadingOptions)options error:(NSError **)outError NS_AVAILABLE(10_6, 4_0); /* A designated initializer for creating an instance for which -isDirectory returns YES. The passed-in dictionary must contain entries whose values are the file wrappers that are to become children and whose keys are file names. Each file wrapper that does not already have a preferred file name is sent -setPreferredFilename: with the corresponding key as the argument. */ - (id)initDirectoryWithFileWrappers:(NSDictionary *)childrenByPreferredName; /* A designated initializer for creating an instance for which -isRegularFile returns YES. */ - (id)initRegularFileWithContents:(NSData *)contents; /* A designated initializer for creating an instance for which -isSymbolicLink returns YES. -writeToURL:options:originalContentsURL:error: uses the result of sending -relativePath to this URL when creating a symbolic link. (An NSURL initialized by -initFileURLWithPath: returns that entire path when sent -relativePath though.) */ - (id)initSymbolicLinkWithDestinationURL:(NSURL *)url NS_AVAILABLE(10_6, 4_0); /* A designated initializer. The data must be in the same format as that returned by -serializedRepresentation. */ - (id)initWithSerializedRepresentation:(NSData *)serializeRepresentation; #pragma mark *** Properties Applicable to Every Kind of File Wrapper *** /* What kind of file wrapper it is. Invocations of -readFromURL:options:error: may change what subsequent invocations of these methods return. */ - (BOOL)isDirectory; - (BOOL)isRegularFile; - (BOOL)isSymbolicLink; /* The file name that is "preferred." When the receiver is added to a parent directory file wrapper the parent will attempt to use this name as the key into its dictionary of children. Usually the preferred file name will actually get used in this situation but it won't be if that key is already in use. The default implementation of this method causes existing parents to remove and re-add the child to accommodate the change. Preferred file names of children are not effectively preserved when you write a file wrapper to disk and then later instantiate another file wrapper by reading. If your application needs to preserve the user-visible names of attachments it has to make its own arrangements for their storage. */ - (void)setPreferredFilename:(NSString *)fileName; - (NSString *)preferredFilename; /* The actual file name. Often it will be the same as the preferred file name but might instead be a name derived from the preferred file name. You can use this method to find out the name of a child that's just been read but you should not use it to find out the name of a child that's about to be written, because the name might be about to change. Send -keyForFileWrapper: to the parent instead. */ - (void)setFilename:(NSString *)fileName; - (NSString *)filename; /* The file attributes, in a dictionary of the same sort as those returned by -[NSFileManager attributesOfItemAtPath:error:]. */ - (void)setFileAttributes:(NSDictionary *)fileAttributes; - (NSDictionary *)fileAttributes; /* On Mac OS X methods for setting and getting the icon are in AppKit's NSFileWrapper(NSExtensions), declared in . */ #pragma mark *** Reading *** /* Whether the receiver matches the directory, regular file, or symbolic link that is located by the URL. For a directory, children are compared against the files in the directory, recursively. The contents of files are not compared; matching of regular files is based on file modification dates. Because children of directory file wrappers are not read immediately by -initWithURL:options:error: or -readFromURL:options:error: unless NSFileWrapperReadingImmediate is used, creating a file wrapper and then later sending it this message is not a reliable way to simply check whether anything in a directory has changed. You can use this method to determine whether the receiver's contents in memory are out of date relative to the file system. */ - (BOOL)matchesContentsOfURL:(NSURL *)url NS_AVAILABLE(10_6, 4_0); /* Recursively reread the entire contents of the receiver from the specified location, and return YES if successful. If not successful, return NO after setting *outError to an NSError that encapsulates the reason why the file wrapper could not be reread. When reading a directory children are added and removed as necessary to match the file system. */ - (BOOL)readFromURL:(NSURL *)url options:(NSFileWrapperReadingOptions)options error:(NSError **)outError NS_AVAILABLE(10_6, 4_0); #pragma mark *** Writing *** /* Recursively write the entire contents of the receiver at the specified location, and return YES if successful. If not successful, return NO after setting *outError to an NSError that encapsulates the reason why the file wrapper could not be written. originalContentsURL may be nil or it may be the location of a previous revision of what is being written. If it is not nil the default implementation of this method attempts to avoid unnecessary I/O by merely writing hard links to regular files instead of actually writing out their contents. The descendant file wrappers must return accurate values when sent -filename for this to work (use NSFileWrapperWritingWithNameUpdating to increase the likelihood of that). */ - (BOOL)writeToURL:(NSURL *)url options:(NSFileWrapperWritingOptions)options originalContentsURL:(NSURL *)originalContentsURL error:(NSError **)outError NS_AVAILABLE(10_6, 4_0); #pragma mark *** Serialization *** /* Return an NSData suitable for passing to -initWithSerializedRepresentation:. This method may return nil if the receiver is the result of reading from the file system (use NSFileWrapperReadingImmediately if appropriate to prevent that). */ - (NSData *)serializedRepresentation; #pragma mark *** Directories *** /* Each of these methods throw an exception when [receiver isDirectory]==NO. */ /* Add a file wrapper to the receiver's children and return the file name that uniquely identifies it among the receiver's children. The unique file name will be the same as the passed-in file wrapper's preferred file name unless that name is already in use as a key into the receiver's dictionary of children. Beware of the fact that -initDirectoryWithFileWrappers:, -initRegularFileWithContents:, and -initSymbolicLinkWithDestinationURL: do not automatically set the preferred file name. */ - (NSString *)addFileWrapper:(NSFileWrapper *)child; /* A convenience method. The default implementation merely allocates a new file wrapper, initializes it with -initRegularFileWithContents:, sends it -setPreferredFileName:fileName, adds it to the receiver with -addFileWrapper:, and returns what -addFileWrapper: returned. */ - (NSString *)addRegularFileWithContents:(NSData *)data preferredFilename:(NSString *)fileName; /* Remove a file wrapper from the receiver's children. */ - (void)removeFileWrapper:(NSFileWrapper *)child; /* Return a dictionary whose values are the receiver's children and whose keys are the unique file name that has been assigned to each one. This method may return nil if the receiver is the result of reading a parent from the file system (use NSFileWrapperReadingImmediately if appropriate to prevent that). */ - (NSDictionary *)fileWrappers; /* Return the unique file name that has been assigned to a child or nil if it is not a child of the receiver. */ - (NSString *)keyForFileWrapper:(NSFileWrapper *)child; #pragma mark *** Regular Files *** /* This method throws an exception when [receiver isRegularFile]==NO. */ /* Return the receiver's contents. This may return nil if the receiver is the result of reading a parent from the file system (use NSFileWrapperReadingImmediately if appropriate to prevent that). */ - (NSData *)regularFileContents; #pragma mark *** Symbolic Links *** /* This method throws an exception when [receiver isSymbolicLink]==NO. */ /* Return the destination link of the receiver. This may return nil if the receiver is the result of reading a parent from the file system (use NSFileWrapperReadingImmediately if appropriate to prevent that). */ - (NSURL *)symbolicLinkDestinationURL NS_AVAILABLE(10_6, 4_0); @end #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) @interface NSFileWrapper(NSDeprecated) #pragma mark *** Backward Compatibility *** /* Methods that were deprecated in Mac OS 10.6 and never available on iPhone OS. You can instead use -initWithURL:options:error: and -initSymbolicLinkWithDestinationURL:. One thing to pay attention to is that -initSymbolicLinkWithDestination: sets the preferrred file name but its replacement, -initSymbolicLinkWithDestinationURL:, does not, for better consistency with -initDirectoryWithFileWrappers: and -initRegularFileWithContents:. */ - (id)initWithPath:(NSString *)path; - (id)initSymbolicLinkWithDestination:(NSString *)path; /* Methods that were deprecated in Mac OS 10.6 and never available on iPhone OS. You can instead use -matchesContentsOfURL: and -readFromURL:options:error:. */ - (BOOL)needsToBeUpdatedFromPath:(NSString *)path; - (BOOL)updateFromPath:(NSString *)path; /* Methods that were deprecated in Mac OS 10.6 and never available on iPhone OS. You can instead use -writeToURL:options:originalContentsURL:error:. */ - (BOOL)writeToFile:(NSString *)path atomically:(BOOL)atomicFlag updateFilenames:(BOOL)updateFilenamesFlag; /* Methods that were deprecated in Mac OS 10.6 and never available on iPhone OS. You can instead instantiate NSFileWrapper with one of the initializers, send it -setPreferredFileName: if necessary, and pass the result to -addFileWrapper:. */ - (NSString *)addFileWithPath:(NSString *)path; - (NSString *)addSymbolicLinkWithDestination:(NSString *)path preferredFilename:(NSString *)filename; /* Methods that were deprecated in Mac OS 10.6 and never available on iPhone OS. You can instead use -symbolicLinkDestinationURL. */ - (NSString *)symbolicLinkDestination; @end #endif /* NSFormatter.h Copyright (c) 1995-2012, Apple Inc. All rights reserved. */ #import #import @class NSString; @class NSAttributedString; @class NSDictionary; @interface NSFormatter : NSObject - (NSString *)stringForObjectValue:(id)obj; - (NSAttributedString *)attributedStringForObjectValue:(id)obj withDefaultAttributes:(NSDictionary *)attrs; - (NSString *)editingStringForObjectValue:(id)obj; - (BOOL)getObjectValue:(out id *)obj forString:(NSString *)string errorDescription:(out NSString **)error; - (BOOL)isPartialStringValid:(NSString *)partialString newEditingString:(NSString **)newString errorDescription:(NSString **)error; // Compatibility method. If a subclass overrides this and does not override the new method below, this will be called as before (the new method just calls this one by default). The selection range will always be set to the end of the text with this method if replacement occurs. - (BOOL)isPartialStringValid:(NSString **)partialStringPtr proposedSelectedRange:(NSRangePointer)proposedSelRangePtr originalString:(NSString *)origString originalSelectedRange:(NSRange)origSelRange errorDescription:(NSString **)error; @end /* NSHTTPCookie.h Copyright (c) 2003-2012, Apple Inc. All rights reserved. Public header file. */ #import @class NSArray; @class NSDate; @class NSDictionary; @class NSString; @class NSURL; /*! @const NSHTTPCookieName @discussion Key for cookie name */ FOUNDATION_EXPORT NSString * const NSHTTPCookieName; /*! @const NSHTTPCookieValue @discussion Key for cookie value */ FOUNDATION_EXPORT NSString * const NSHTTPCookieValue; /*! @const NSHTTPCookieOriginURL @discussion Key for cookie origin URL */ FOUNDATION_EXPORT NSString * const NSHTTPCookieOriginURL; /*! @const NSHTTPCookieVersion @discussion Key for cookie version */ FOUNDATION_EXPORT NSString * const NSHTTPCookieVersion; /*! @const NSHTTPCookieDomain @discussion Key for cookie domain */ FOUNDATION_EXPORT NSString * const NSHTTPCookieDomain; /*! @const NSHTTPCookiePath @discussion Key for cookie path */ FOUNDATION_EXPORT NSString * const NSHTTPCookiePath; /*! @const NSHTTPCookieSecure @discussion Key for cookie secure flag */ FOUNDATION_EXPORT NSString * const NSHTTPCookieSecure; /*! @const NSHTTPCookieExpires @discussion Key for cookie expiration date */ FOUNDATION_EXPORT NSString * const NSHTTPCookieExpires; /*! @const NSHTTPCookieComment @discussion Key for cookie comment text */ FOUNDATION_EXPORT NSString * const NSHTTPCookieComment; /*! @const NSHTTPCookieCommentURL @discussion Key for cookie comment URL */ FOUNDATION_EXPORT NSString * const NSHTTPCookieCommentURL; /*! @const NSHTTPCookieDiscard @discussion Key for cookie discard (session-only) flag */ FOUNDATION_EXPORT NSString * const NSHTTPCookieDiscard; /*! @const NSHTTPCookieMaximumAge @discussion Key for cookie maximum age (an alternate way of specifying the expiration) */ FOUNDATION_EXPORT NSString * const NSHTTPCookieMaximumAge; /*! @const NSHTTPCookiePort @discussion Key for cookie ports */ FOUNDATION_EXPORT NSString * const NSHTTPCookiePort; @class NSHTTPCookieInternal; /*! @class NSHTTPCookie @abstract NSHTTPCookie represents an http cookie. @discussion A NSHTTPCookie instance represents a single http cookie. It is an immutable object initialized from a dictionary that contains the various cookie attributes. It has accessors to get the various attributes of a cookie. */ @interface NSHTTPCookie : NSObject { @private NSHTTPCookieInternal * _cookiePrivate; } /*! @method initWithProperties: @abstract Initialize a NSHTTPCookie object with a dictionary of parameters @param properties The dictionary of properties to be used to initialize this cookie. @discussion Supported dictionary keys and value types for the given dictionary are as follows. All properties can handle an NSString value, but some can also handle other types.
Property key constant Type of value Required Description
NSHTTPCookieComment NSString NO Comment for the cookie. Only valid for version 1 cookies and later. Default is nil.
NSHTTPCookieCommentURL NSURL or NSString NO Comment URL for the cookie. Only valid for version 1 cookies and later. Default is nil.
NSHTTPCookieDomain NSString Special, a value for either NSHTTPCookieOriginURL or NSHTTPCookieDomain must be specified. Domain for the cookie. Inferred from the value for NSHTTPCookieOriginURL if not provided.
NSHTTPCookieDiscard NSString NO A string stating whether the cookie should be discarded at the end of the session. String value must be either "TRUE" or "FALSE". Default is "FALSE", unless this is cookie is version 1 or greater and a value for NSHTTPCookieMaximumAge is not specified, in which case it is assumed "TRUE".
NSHTTPCookieExpires NSDate or NSString NO Expiration date for the cookie. Used only for version 0 cookies. Ignored for version 1 or greater.
NSHTTPCookieMaximumAge NSString NO A string containing an integer value stating how long in seconds the cookie should be kept, at most. Only valid for version 1 cookies and later. Default is "0".
NSHTTPCookieName NSString YES Name of the cookie
NSHTTPCookieOriginURL NSURL or NSString Special, a value for either NSHTTPCookieOriginURL or NSHTTPCookieDomain must be specified. URL that set this cookie. Used as default for other fields as noted.
NSHTTPCookiePath NSString NO Path for the cookie. Inferred from the value for NSHTTPCookieOriginURL if not provided. Default is "/".
NSHTTPCookiePort NSString NO comma-separated integer values specifying the ports for the cookie. Only valid for version 1 cookies and later. Default is empty string ("").
NSHTTPCookieSecure NSString NO A string stating whether the cookie should be transmitted only over secure channels. String value must be either "TRUE" or "FALSE". Default is "FALSE".
NSHTTPCookieValue NSString YES Value of the cookie
NSHTTPCookieVersion NSString NO Specifies the version of the cookie. Must be either "0" or "1". Default is "0".

All other keys are ignored. @result An initialized NSHTTPCookie, or nil if the set of dictionary keys is invalid, for example because a required key is missing, or a recognized key maps to an illegal value. */ - (id)initWithProperties:(NSDictionary *)properties; /*! @method cookieWithProperties: @abstract Allocates and initializes an NSHTTPCookie with the given dictionary. @discussion See the NSHTTPCookie -initWithProperties: method for more information on the constraints imposed on the dictionary, and for descriptions of the supported keys and values. @param properties The dictionary to use to initialize this cookie. @result A newly-created and autoreleased NSHTTPCookie instance, or nil if the set of dictionary keys is invalid, for example because a required key is missing, or a recognized key maps to an illegal value. */ + (id)cookieWithProperties:(NSDictionary *)properties; /*! @method requestHeaderFieldsWithCookies: @abstract Return a dictionary of header fields that can be used to add the specified cookies to the request. @param cookies The cookies to turn into request headers. @result An NSDictionary where the keys are header field names, and the values are the corresponding header field values. */ + (NSDictionary *)requestHeaderFieldsWithCookies:(NSArray *)cookies; /*! @method cookiesWithResponseHeaderFields:forURL: @abstract Return an array of cookies parsed from the specified response header fields and URL. @param headerFields The response header fields to check for cookies. @param URL The URL that the cookies came from - relevant to how the cookies are interpeted. @result An NSArray of NSHTTPCookie objects @discussion This method will ignore irrelevant header fields so you can pass a dictionary containing data other than cookie data. */ + (NSArray *)cookiesWithResponseHeaderFields:(NSDictionary *)headerFields forURL:(NSURL *)URL; /*! @method properties @abstract Returns a dictionary representation of the receiver. @discussion This method returns a dictionary representation of the NSHTTPCookie which can be saved and passed to -initWithProperties: or +cookieWithProperties: later to reconstitute an equivalent cookie.

See the NSHTTPCookie -initWithProperties: method for more information on the constraints imposed on the dictionary, and for descriptions of the supported keys and values. @result The dictionary representation of the receiver. */ - (NSDictionary *)properties; /*! @method version @abstract Returns the version of the receiver. @discussion Version 0 maps to "old-style" Netscape cookies. Version 1 maps to RFC2965 cookies. There may be future versions. @result the version of the receiver. */ - (NSUInteger)version; /*! @method name @abstract Returns the name of the receiver. @result the name of the receiver. */ - (NSString *)name; /*! @method value @abstract Returns the value of the receiver. @result the value of the receiver. */ - (NSString *)value; /*! @method expiresDate @abstract Returns the expires date of the receiver. @result the expires date of the receiver. @discussion The expires date is the date when the cookie should be deleted. The result will be nil if there is no specific expires date. This will be the case only for "session-only" cookies. @result The expires date of the receiver. */ - (NSDate *)expiresDate; /*! @method isSessionOnly @abstract Returns whether the receiver is session-only. @result YES if this receiver should be discarded at the end of the session (regardless of expiration date), NO if receiver need not be discarded at the end of the session. */ - (BOOL)isSessionOnly; /*! @method domain @abstract Returns the domain of the receiver. @discussion This value specifies URL domain to which the cookie should be sent. A domain with a leading dot means the cookie should be sent to subdomains as well, assuming certain other restrictions are valid. See RFC 2965 for more detail. @result The domain of the receiver. */ - (NSString *)domain; /*! @method path @abstract Returns the path of the receiver. @discussion This value specifies the URL path under the cookie's domain for which this cookie should be sent. The cookie will also be sent for children of that path, so "/" is the most general. @result The path of the receiver. */ - (NSString *)path; /*! @method isSecure @abstract Returns whether the receiver should be sent only over secure channels @discussion Cookies may be marked secure by a server (or by a javascript). Cookies marked as such must only be sent via an encrypted connection to trusted servers (i.e. via SSL or TLS), and should not be delievered to any javascript applications to prevent cross-site scripting vulnerabilities. @result YES if this cookie should be sent only over secure channels, NO otherwise. */ - (BOOL)isSecure; /*! @method isHTTPOnly @abstract Returns whether the receiver should only be sent to HTTP servers per RFC 2965 @discussion Cookies may be marked as HTTPOnly by a server (or by a javascript). Cookies marked as such must only be sent via HTTP Headers in HTTP Requests for URL's that match both the path and domain of the respective Cookies. Specifically these cookies should not be delivered to any javascript applications to prevent cross-site scripting vulnerabilities. @result YES if this cookie should only be sent via HTTP headers, NO otherwise. */ - (BOOL)isHTTPOnly; /*! @method comment @abstract Returns the comment of the receiver. @discussion This value specifies a string which is suitable for presentation to the user explaining the contents and purpose of this cookie. It may be nil. @result The comment of the receiver, or nil if the receiver has no comment. */ - (NSString *)comment; /*! @method commentURL @abstract Returns the comment URL of the receiver. @discussion This value specifies a URL which is suitable for presentation to the user as a link for further information about this cookie. It may be nil. @result The comment URL of the receiver, or nil if the receiver has no comment URL. */ - (NSURL *)commentURL; /*! @method portList @abstract Returns the list ports to which the receiver should be sent. @discussion This value specifies an NSArray of NSNumbers (containing integers) which specify the only ports to which this cookie should be sent. @result The list ports to which the receiver should be sent. The array may be nil, in which case this cookie can be sent to any port. */ - (NSArray *)portList; @end /* NSHTTPCookieStorage.h Copyright (c) 2003-2012, Apple Inc. All rights reserved. Public header file. */ #import @class NSArray; @class NSHTTPCookie; @class NSURL; /*! @enum NSHTTPCookieAcceptPolicy @abstract Values for the different cookie accept policies @constant NSHTTPCookieAcceptPolicyAlways Accept all cookies @constant NSHTTPCookieAcceptPolicyNever Reject all cookies @constant NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain Accept cookies only from the main document domain */ typedef NS_ENUM(NSUInteger, NSHTTPCookieAcceptPolicy) { NSHTTPCookieAcceptPolicyAlways, NSHTTPCookieAcceptPolicyNever, NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain }; @class NSHTTPCookieStorageInternal; /*! @class NSHTTPCookieStorage @discussion NSHTTPCookieStorage implements a singleton object (shared instance) which manages the shared cookie store. It has methods to allow clients to set and remove cookies, and get the current set of cookies. It also has convenience methods to parse and generate cookie-related HTTP header fields. */ @interface NSHTTPCookieStorage : NSObject { @private NSHTTPCookieStorageInternal *_internal; } /*! @method sharedHTTPCookieStorage @abstract Get the shared cookie storage in the default location. @result The shared cookie storage */ + (NSHTTPCookieStorage *)sharedHTTPCookieStorage; /*! @method cookies @abstract Get all the cookies @result An NSArray of NSHTTPCookies */ - (NSArray *)cookies; /*! @method setCookie: @abstract Set a cookie @discussion The cookie will override an existing cookie with the same name, domain and path, if any. */ - (void)setCookie:(NSHTTPCookie *)cookie; /*! @method deleteCookie: @abstract Delete the specified cookie */ - (void)deleteCookie:(NSHTTPCookie *)cookie; /*! @method cookiesForURL: @abstract Returns an array of cookies to send to the given URL. @param URL The URL for which to get cookies. @result an NSArray of NSHTTPCookie objects. @discussion The cookie manager examines the cookies it stores and includes those which should be sent to the given URL. You can use +[NSCookie requestHeaderFieldsWithCookies:] to turn this array into a set of header fields to add to a request. */ - (NSArray *)cookiesForURL:(NSURL *)URL; /*! @method setCookies:forURL:mainDocumentURL: @abstract Adds an array cookies to the cookie store, following the cookie accept policy. @param cookies The cookies to set. @param URL The URL from which the cookies were sent. @param mainDocumentURL The main document URL to be used as a base for the "same domain as main document" policy. @discussion For mainDocumentURL, the caller should pass the URL for an appropriate main document, if known. For example, when loading a web page, the URL of the main html document for the top-level frame should be passed. To save cookies based on a set of response headers, you can use +[NSCookie cookiesWithResponseHeaderFields:forURL:] on a header field dictionary and then use this method to store the resulting cookies in accordance with policy settings. */ - (void)setCookies:(NSArray *)cookies forURL:(NSURL *)URL mainDocumentURL:(NSURL *)mainDocumentURL; /*! @method cookieAcceptPolicy @abstract Returns the cookie accept policy preference of the receiver. @result The cookie accept policy preference of the receiver. */ - (NSHTTPCookieAcceptPolicy)cookieAcceptPolicy; /*! @method setCookieAcceptPolicy: @abstract Sets the cookie accept policy preference of the receiver. @param cookieAcceptPolicy The new cookie accept policy for the receiver. */ - (void)setCookieAcceptPolicy:(NSHTTPCookieAcceptPolicy)cookieAcceptPolicy; /*! @method sortedCookiesUsingDescriptors: @abstract Returns an array of all cookies in the store, sorted according to the key value and sorting direction of the NSSortDescriptors specified in the parameter. @param sortOrder an array of NSSortDescriptors which represent the preferred sort order of the resulting array. @discussion proper sorting of cookies may require extensive string conversion, which can be avoided by allowing the system to perform the sorting. This API is to be preferred over the more generic -[NSHTTPCookieStorage cookies] API, if sorting is going to be performed. */ - (NSArray*)sortedCookiesUsingDescriptors:(NSArray*) sortOrder NS_AVAILABLE(10_7, 5_0); @end /*! @const NSHTTPCookieManagerAcceptPolicyChangedNotification @discussion Name of notification that should be posted to the distributed notification center whenever the accept cookies preference is changed */ FOUNDATION_EXPORT NSString * const NSHTTPCookieManagerAcceptPolicyChangedNotification; /*! @const NSHTTPCookieManagerCookiesChangedNotification @abstract Notification sent when the set of cookies changes */ FOUNDATION_EXPORT NSString * const NSHTTPCookieManagerCookiesChangedNotification; /* NSHashTable.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import #import #import #if !defined(__FOUNDATION_NSHASHTABLE__) #define __FOUNDATION_NSHASHTABLE__ 1 @class NSArray, NSSet, NSHashTable; /* An NSHashTable is modeled after a set, although, because of its options, is not a set because it can behave differently (for example, if pointer equality is specified two isEqual strings will both be entered). The major option is to provide for "weak" references that are removed automatically. An NSHashTable can also be configured to operate on arbitrary pointers and not just objects. We recommend the C function API for "void *" access. To configure for pointer use, consult and choose the appropriate NSPointerFunctionsOptions or configure or use an NSPointerFunctions object itself for initialization. */ enum { NSHashTableStrongMemory NS_ENUM_AVAILABLE(10_5, 6_0) = 0, // NSPointerFunctionsStrongMemory #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || TARGET_OS_WIN32 NSHashTableZeroingWeakMemory NS_ENUM_DEPRECATED_MAC(10_5, 10_8) = NSPointerFunctionsZeroingWeakMemory, #endif NSHashTableCopyIn NS_ENUM_AVAILABLE(10_5, 6_0) = NSPointerFunctionsCopyIn, NSHashTableObjectPointerPersonality NS_ENUM_AVAILABLE(10_5, 6_0) = NSPointerFunctionsObjectPointerPersonality, NSHashTableWeakMemory NS_ENUM_AVAILABLE(10_8, 6_0) = NSPointerFunctionsWeakMemory }; typedef NSUInteger NSHashTableOptions; NS_CLASS_AVAILABLE(10_5, 6_0) @interface NSHashTable : NSObject - (id)initWithOptions:(NSPointerFunctionsOptions)options capacity:(NSUInteger)initialCapacity; - (id)initWithPointerFunctions:(NSPointerFunctions *)functions capacity:(NSUInteger)initialCapacity; // conveniences + (id)hashTableWithOptions:(NSPointerFunctionsOptions)options; #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || TARGET_OS_WIN32 + (id)hashTableWithWeakObjects NS_DEPRECATED_MAC(10_5, 10_8); // GC zeroing, otherwise unsafe unretained #endif + (id)weakObjectsHashTable NS_AVAILABLE(10_8, 6_0); // hash table with zeroing weak object references /* return an NSPointerFunctions object reflecting the functions in use. This is a new autoreleased object that can be subsequently modified and/or used directly in the creation of other pointer "collections". */ - (NSPointerFunctions *)pointerFunctions; - (NSUInteger)count; - (id)member:(id)object; - (NSEnumerator *)objectEnumerator; - (void)addObject:(id)object; - (void)removeObject:(id)object; - (void)removeAllObjects; - (NSArray *)allObjects; // convenience - (id)anyObject; - (BOOL)containsObject:(id)anObject; - (BOOL)intersectsHashTable:(NSHashTable *)other; - (BOOL)isEqualToHashTable:(NSHashTable *)other; - (BOOL)isSubsetOfHashTable:(NSHashTable *)other; - (void)intersectHashTable:(NSHashTable *)other; - (void)unionHashTable:(NSHashTable *)other; - (void)minusHashTable:(NSHashTable *)other; - (NSSet *)setRepresentation; // create a set of the contents @end #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || TARGET_OS_WIN32 /**************** (void *) Hash table operations ****************/ typedef struct {NSUInteger _pi; NSUInteger _si; void *_bs;} NSHashEnumerator; FOUNDATION_EXPORT void NSFreeHashTable(NSHashTable *table); FOUNDATION_EXPORT void NSResetHashTable(NSHashTable *table); FOUNDATION_EXPORT BOOL NSCompareHashTables(NSHashTable *table1, NSHashTable *table2); FOUNDATION_EXPORT NSHashTable *NSCopyHashTableWithZone(NSHashTable *table, NSZone *zone); FOUNDATION_EXPORT void *NSHashGet(NSHashTable *table, const void *pointer); FOUNDATION_EXPORT void NSHashInsert(NSHashTable *table, const void *pointer); FOUNDATION_EXPORT void NSHashInsertKnownAbsent(NSHashTable *table, const void *pointer); FOUNDATION_EXPORT void *NSHashInsertIfAbsent(NSHashTable *table, const void *pointer); FOUNDATION_EXPORT void NSHashRemove(NSHashTable *table, const void *pointer); FOUNDATION_EXPORT NSHashEnumerator NSEnumerateHashTable(NSHashTable *table); FOUNDATION_EXPORT void *NSNextHashEnumeratorItem(NSHashEnumerator *enumerator); FOUNDATION_EXPORT void NSEndHashTableEnumeration(NSHashEnumerator *enumerator); FOUNDATION_EXPORT NSUInteger NSCountHashTable(NSHashTable *table); FOUNDATION_EXPORT NSString *NSStringFromHashTable(NSHashTable *table); FOUNDATION_EXPORT NSArray *NSAllHashTableObjects(NSHashTable *table); /**************** Legacy ****************/ typedef struct { NSUInteger (*hash)(NSHashTable *table, const void *); BOOL (*isEqual)(NSHashTable *table, const void *, const void *); void (*retain)(NSHashTable *table, const void *); void (*release)(NSHashTable *table, void *); NSString *(*describe)(NSHashTable *table, const void *); } NSHashTableCallBacks; FOUNDATION_EXPORT NSHashTable *NSCreateHashTableWithZone(NSHashTableCallBacks callBacks, NSUInteger capacity, NSZone *zone); FOUNDATION_EXPORT NSHashTable *NSCreateHashTable(NSHashTableCallBacks callBacks, NSUInteger capacity); FOUNDATION_EXPORT const NSHashTableCallBacks NSIntegerHashCallBacks NS_AVAILABLE_MAC(10_5); FOUNDATION_EXPORT const NSHashTableCallBacks NSNonOwnedPointerHashCallBacks; FOUNDATION_EXPORT const NSHashTableCallBacks NSNonRetainedObjectHashCallBacks; FOUNDATION_EXPORT const NSHashTableCallBacks NSObjectHashCallBacks; FOUNDATION_EXPORT const NSHashTableCallBacks NSOwnedObjectIdentityHashCallBacks; FOUNDATION_EXPORT const NSHashTableCallBacks NSOwnedPointerHashCallBacks; FOUNDATION_EXPORT const NSHashTableCallBacks NSPointerToStructHashCallBacks; FOUNDATION_EXPORT const NSHashTableCallBacks NSIntHashCallBacks NS_DEPRECATED_MAC(10_0, 10_5); #else #if defined(__has_include) #if __has_include() #include #endif #endif #endif #endif /* NSIndexPath.h Copyright (c) 2003-2012, Apple Inc. All rights reserved. */ #import @interface NSIndexPath : NSObject { @private __strong NSUInteger *_indexes; NSUInteger _hash; NSUInteger _length; void *_reserved; } + (id)indexPathWithIndex:(NSUInteger)index; + (id)indexPathWithIndexes:(const NSUInteger [])indexes length:(NSUInteger)length; - (id)initWithIndex:(NSUInteger)index; - (id)initWithIndexes:(const NSUInteger [])indexes length:(NSUInteger)length; // designated initializer - (NSIndexPath *)indexPathByAddingIndex:(NSUInteger)index; - (NSIndexPath *)indexPathByRemovingLastIndex; - (NSUInteger)indexAtPosition:(NSUInteger)position; - (NSUInteger)length; - (void)getIndexes:(NSUInteger *)indexes; // comparison support - (NSComparisonResult)compare:(NSIndexPath *)otherObject; // sorting an array of indexPaths using this comparison results in an array representing nodes in depth-first traversal order @end /* NSIndexSet.h Copyright (c) 2002-2012, Apple Inc. All rights reserved. */ /* Class for managing set of indexes. The set of valid indexes are 0 .. NSNotFound - 1; trying to use indexes outside this range is an error. NSIndexSet uses NSNotFound as a return value in cases where the queried index doesn't exist in the set; for instance, when you ask firstIndex and there are no indexes; or when you ask for indexGreaterThanIndex: on the last index, and so on. The following code snippets can be used to enumerate over the indexes in an NSIndexSet: // Forward NSUInteger currentIndex = [set firstIndex]; while (currentIndex != NSNotFound) { ... currentIndex = [set indexGreaterThanIndex:currentIndex]; } // Backward NSUInteger currentIndex = [set lastIndex]; while (currentIndex != NSNotFound) { ... currentIndex = [set indexLessThanIndex:currentIndex]; } To enumerate without doing a call per index, you can use the method getIndexes:maxCount:inIndexRange:. */ #import #import @interface NSIndexSet : NSObject { @protected // all instance variables are private struct { NSUInteger _isEmpty:1; NSUInteger _hasSingleRange:1; NSUInteger _cacheValid:1; NSUInteger _reservedArrayBinderController:29; } _indexSetFlags; union { struct { NSRange _range; } _singleRange; struct { void * __strong _data; void *_reserved; } _multipleRanges; } _internal; } + (id)indexSet; + (id)indexSetWithIndex:(NSUInteger)value; + (id)indexSetWithIndexesInRange:(NSRange)range; - (id)init; - (id)initWithIndex:(NSUInteger)value; - (id)initWithIndexesInRange:(NSRange)range; // designated initializer - (id)initWithIndexSet:(NSIndexSet *)indexSet; // designated initializer - (BOOL)isEqualToIndexSet:(NSIndexSet *)indexSet; - (NSUInteger)count; /* The following six methods will return NSNotFound if there is no index in the set satisfying the query. */ - (NSUInteger)firstIndex; - (NSUInteger)lastIndex; - (NSUInteger)indexGreaterThanIndex:(NSUInteger)value; - (NSUInteger)indexLessThanIndex:(NSUInteger)value; - (NSUInteger)indexGreaterThanOrEqualToIndex:(NSUInteger)value; - (NSUInteger)indexLessThanOrEqualToIndex:(NSUInteger)value; /* Fills up to bufferSize indexes in the specified range into the buffer and returns the number of indexes actually placed in the buffer; also modifies the optional range passed in by pointer to be "positioned" after the last index filled into the buffer.Example: if the index set contains the indexes 0, 2, 4, ..., 98, 100, for a buffer of size 10 and the range (20, 80) the buffer would contain 20, 22, ..., 38 and the range would be modified to (40, 60). */ - (NSUInteger)getIndexes:(NSUInteger *)indexBuffer maxCount:(NSUInteger)bufferSize inIndexRange:(NSRangePointer)range; - (NSUInteger)countOfIndexesInRange:(NSRange)range NS_AVAILABLE(10_5, 2_0); - (BOOL)containsIndex:(NSUInteger)value; - (BOOL)containsIndexesInRange:(NSRange)range; - (BOOL)containsIndexes:(NSIndexSet *)indexSet; - (BOOL)intersectsIndexesInRange:(NSRange)range; #if NS_BLOCKS_AVAILABLE - (void)enumerateIndexesUsingBlock:(void (^)(NSUInteger idx, BOOL *stop))block NS_AVAILABLE(10_6, 4_0); - (void)enumerateIndexesWithOptions:(NSEnumerationOptions)opts usingBlock:(void (^)(NSUInteger idx, BOOL *stop))block NS_AVAILABLE(10_6, 4_0); - (void)enumerateIndexesInRange:(NSRange)range options:(NSEnumerationOptions)opts usingBlock:(void (^)(NSUInteger idx, BOOL *stop))block NS_AVAILABLE(10_6, 4_0); - (NSUInteger)indexPassingTest:(BOOL (^)(NSUInteger idx, BOOL *stop))predicate NS_AVAILABLE(10_6, 4_0); - (NSUInteger)indexWithOptions:(NSEnumerationOptions)opts passingTest:(BOOL (^)(NSUInteger idx, BOOL *stop))predicate NS_AVAILABLE(10_6, 4_0); - (NSUInteger)indexInRange:(NSRange)range options:(NSEnumerationOptions)opts passingTest:(BOOL (^)(NSUInteger idx, BOOL *stop))predicate NS_AVAILABLE(10_6, 4_0); - (NSIndexSet *)indexesPassingTest:(BOOL (^)(NSUInteger idx, BOOL *stop))predicate NS_AVAILABLE(10_6, 4_0); - (NSIndexSet *)indexesWithOptions:(NSEnumerationOptions)opts passingTest:(BOOL (^)(NSUInteger idx, BOOL *stop))predicate NS_AVAILABLE(10_6, 4_0); - (NSIndexSet *)indexesInRange:(NSRange)range options:(NSEnumerationOptions)opts passingTest:(BOOL (^)(NSUInteger idx, BOOL *stop))predicate NS_AVAILABLE(10_6, 4_0); /* The following three convenience methods allow you to enumerate the indexes in the receiver by ranges of contiguous indexes. The performance of these methods is not guaranteed to be any better than if they were implemented with enumerateIndexesInRange:options:usingBlock:. However, depending on the receiver's implementation, they may perform better than that. If the specified range for enumeration intersects a range of contiguous indexes in the receiver, then the block will be invoked with the intersection of those two ranges. */ - (void)enumerateRangesUsingBlock:(void (^)(NSRange range, BOOL *stop))block NS_AVAILABLE(10_7, 5_0); - (void)enumerateRangesWithOptions:(NSEnumerationOptions)opts usingBlock:(void (^)(NSRange range, BOOL *stop))block NS_AVAILABLE(10_7, 5_0); - (void)enumerateRangesInRange:(NSRange)range options:(NSEnumerationOptions)opts usingBlock:(void (^)(NSRange range, BOOL *stop))block NS_AVAILABLE(10_7, 5_0); #endif @end @interface NSMutableIndexSet : NSIndexSet { @protected void *_reserved; } - (void)addIndexes:(NSIndexSet *)indexSet; - (void)removeIndexes:(NSIndexSet *)indexSet; - (void)removeAllIndexes; - (void)addIndex:(NSUInteger)value; - (void)removeIndex:(NSUInteger)value; - (void)addIndexesInRange:(NSRange)range; - (void)removeIndexesInRange:(NSRange)range; /* For a positive delta, shifts the indexes in [index, INT_MAX] to the right, thereby inserting an "empty space" [index, delta], for a negative delta, shifts the indexes in [index, INT_MAX] to the left, thereby deleting the indexes in the range [index - delta, delta]. */ - (void)shiftIndexesStartingAtIndex:(NSUInteger)index by:(NSInteger)delta; @end /* NSInvocation.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import #include @class NSMethodSignature; @interface NSInvocation : NSObject { @private __strong void *_frame; __strong void *_retdata; id _signature; id _container; uint8_t _retainedArgs; uint8_t _reserved[15]; } + (NSInvocation *)invocationWithMethodSignature:(NSMethodSignature *)sig; - (NSMethodSignature *)methodSignature; - (void)retainArguments; - (BOOL)argumentsRetained; - (id)target; - (void)setTarget:(id)target; - (SEL)selector; - (void)setSelector:(SEL)selector; - (void)getReturnValue:(void *)retLoc; - (void)setReturnValue:(void *)retLoc; - (void)getArgument:(void *)argumentLocation atIndex:(NSInteger)idx; - (void)setArgument:(void *)argumentLocation atIndex:(NSInteger)idx; - (void)invoke; - (void)invokeWithTarget:(id)target; @end #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_5 enum _NSObjCValueType { NSObjCNoType = 0, NSObjCVoidType = 'v', NSObjCCharType = 'c', NSObjCShortType = 's', NSObjCLongType = 'l', NSObjCLonglongType = 'q', NSObjCFloatType = 'f', NSObjCDoubleType = 'd', NSObjCBoolType = 'B', NSObjCSelectorType = ':', NSObjCObjectType = '@', NSObjCStructType = '{', NSObjCPointerType = '^', NSObjCStringType = '*', NSObjCArrayType = '[', NSObjCUnionType = '(', NSObjCBitfield = 'b' } NS_DEPRECATED(10_0, 10_5, 2_0, 2_0); typedef struct { NSInteger type NS_DEPRECATED(10_0, 10_5, 2_0, 2_0); union { char charValue; short shortValue; long longValue; long long longlongValue; float floatValue; double doubleValue; bool boolValue; SEL selectorValue; id objectValue; void *pointerValue; void *structLocation; char *cStringLocation; } value NS_DEPRECATED(10_0, 10_5, 2_0, 2_0); } NSObjCValue NS_DEPRECATED(10_0, 10_5, 2_0, 2_0); #endif #endif /* NSJSONSerialization.h Copyright (c) 2009-2012, Apple Inc. All rights reserved. */ #import @class NSError, NSOutputStream, NSInputStream, NSData; typedef NS_OPTIONS(NSUInteger, NSJSONReadingOptions) { NSJSONReadingMutableContainers = (1UL << 0), NSJSONReadingMutableLeaves = (1UL << 1), NSJSONReadingAllowFragments = (1UL << 2) }; typedef NS_OPTIONS(NSUInteger, NSJSONWritingOptions) { NSJSONWritingPrettyPrinted = (1UL << 0) }; /* A class for converting JSON to Foundation objects and converting Foundation objects to JSON. An object that may be converted to JSON must have the following properties: - Top level object is an NSArray or NSDictionary - All objects are NSString, NSNumber, NSArray, NSDictionary, or NSNull - All dictionary keys are NSStrings - NSNumbers are not NaN or infinity */ NS_CLASS_AVAILABLE(10_7, 5_0) @interface NSJSONSerialization : NSObject { @private void *reserved[6]; } /* Returns YES if the given object can be converted to JSON data, NO otherwise. The object must have the following properties: - Top level object is an NSArray or NSDictionary - All objects are NSString, NSNumber, NSArray, NSDictionary, or NSNull - All dictionary keys are NSStrings - NSNumbers are not NaN or infinity Other rules may apply. Calling this method or attempting a conversion are the definitive ways to tell if a given object can be converted to JSON data. */ + (BOOL)isValidJSONObject:(id)obj; /* Generate JSON data from a Foundation object. If the object will not produce valid JSON then an exception will be thrown. Setting the NSJSONWritingPrettyPrinted option will generate JSON with whitespace designed to make the output more readable. If that option is not set, the most compact possible JSON will be generated. If an error occurs, the error parameter will be set and the return value will be nil. The resulting data is a encoded in UTF-8. */ + (NSData *)dataWithJSONObject:(id)obj options:(NSJSONWritingOptions)opt error:(NSError **)error; /* Create a Foundation object from JSON data. Set the NSJSONReadingAllowFragments option if the parser should allow top-level objects that are not an NSArray or NSDictionary. Setting the NSJSONReadingMutableContainers option will make the parser generate mutable NSArrays and NSDictionaries. Setting the NSJSONReadingMutableLeaves option will make the parser generate mutable NSString objects. If an error occurs during the parse, then the error parameter will be set and the result will be nil. The data must be in one of the 5 supported encodings listed in the JSON specification: UTF-8, UTF-16LE, UTF-16BE, UTF-32LE, UTF-32BE. The data may or may not have a BOM. The most efficient encoding to use for parsing is UTF-8, so if you have a choice in encoding the data passed to this method, use UTF-8. */ + (id)JSONObjectWithData:(NSData *)data options:(NSJSONReadingOptions)opt error:(NSError **)error; /* Write JSON data into a stream. The stream should be opened and configured. The return value is the number of bytes written to the stream, or 0 on error. All other behavior of this method is the same as the dataWithJSONObject:options:error: method. */ + (NSInteger)writeJSONObject:(id)obj toStream:(NSOutputStream *)stream options:(NSJSONWritingOptions)opt error:(NSError **)error; /* Create a JSON object from JSON data stream. The stream should be opened and configured. All other behavior of this method is the same as the JSONObjectWithData:options:error: method. */ + (id)JSONObjectWithStream:(NSInputStream *)stream options:(NSJSONReadingOptions)opt error:(NSError **)error; @end /* NSKeyValueCoding.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import #import #import #import @class NSError, NSString; /* The exception that is thrown when a key value coding operation fails. The exception's user info dictionary will contain at least two entries: - @"NSTargetObjectUserInfoKey": the receiver of the failed KVC message. - @"NSUnknownUserInfoKey": the key that was used in the failed KVC message. The actual value of this constant string is "NSUnknownKeyException," to match the exceptions that are thrown by KVC methods that were deprecated in Mac OS 10.3. */ FOUNDATION_EXPORT NSString *const NSUndefinedKeyException; /* Strings for the names of array operators supported by key-value coding. Only these string declarations are new in Mac OS 10.4. The actual support for array operators appeared in Mac OS 10.3. The values of these do not include "@" prefixes. */ FOUNDATION_EXPORT NSString *const NSAverageKeyValueOperator; FOUNDATION_EXPORT NSString *const NSCountKeyValueOperator; FOUNDATION_EXPORT NSString *const NSDistinctUnionOfArraysKeyValueOperator; FOUNDATION_EXPORT NSString *const NSDistinctUnionOfObjectsKeyValueOperator; FOUNDATION_EXPORT NSString *const NSDistinctUnionOfSetsKeyValueOperator; FOUNDATION_EXPORT NSString *const NSMaximumKeyValueOperator; FOUNDATION_EXPORT NSString *const NSMinimumKeyValueOperator; FOUNDATION_EXPORT NSString *const NSSumKeyValueOperator; FOUNDATION_EXPORT NSString *const NSUnionOfArraysKeyValueOperator; FOUNDATION_EXPORT NSString *const NSUnionOfObjectsKeyValueOperator; FOUNDATION_EXPORT NSString *const NSUnionOfSetsKeyValueOperator; @interface NSObject(NSKeyValueCoding) /* Return YES if -valueForKey:, -setValue:forKey:, -mutableArrayValueForKey:, -storedValueForKey:, -takeStoredValue:forKey:, and -takeValue:forKey: may directly manipulate instance variables when sent to instances of the receiving class, NO otherwise. The default implementation of this method returns YES. */ + (BOOL)accessInstanceVariablesDirectly; /* Given a key that identifies an attribute or to-one relationship, return the attribute value or the related object. Given a key that identifies a to-many relationship, return an immutable array or an immutable set that contains all of the related objects. The default implementation of this method does the following: 1. Searches the class of the receiver for an accessor method whose name matches the pattern -get, -, or -is, in that order. If such a method is found it is invoked. If the type of the method's result is an object pointer type the result is simply returned. If the type of the result is one of the scalar types supported by NSNumber conversion is done and an NSNumber is returned. Otherwise, conversion is done and an NSValue is returned (new in Mac OS 10.5: results of arbitrary type are converted to NSValues, not just NSPoint, NRange, NSRect, and NSSize). 2 (introduced in Mac OS 10.7). Otherwise (no simple accessor method is found), searches the class of the receiver for methods whose names match the patterns -countOf and -indexInOfObject: and -objectInAtIndex: (corresponding to the primitive methods defined by the NSOrderedSet class) and also -AtIndexes: (corresponding to -[NSOrderedSet objectsAtIndexes:]). If a count method and an indexOf method and at least one of the other two possible methods are found, a collection proxy object that responds to all NSOrderedSet methods is returned. Each NSOrderedSet message sent to the collection proxy object will result in some combination of -countOf, -indexInOfObject:, -objectInAtIndex:, and -AtIndexes: messages being sent to the original receiver of -valueForKey:. If the class of the receiver also implements an optional method whose name matches the pattern -get:range: that method will be used when appropriate for best performance. 3. Otherwise (no simple accessor method or set of ordered set access methods is found), searches the class of the receiver for methods whose names match the patterns -countOf and -objectInAtIndex: (corresponding to the primitive methods defined by the NSArray class) and (introduced in Mac OS 10.4) also -AtIndexes: (corresponding to -[NSArray objectsAtIndexes:]). If a count method and at least one of the other two possible methods are found, a collection proxy object that responds to all NSArray methods is returned. Each NSArray message sent to the collection proxy object will result in some combination of -countOf, -objectInAtIndex:, and -AtIndexes: messages being sent to the original receiver of -valueForKey:. If the class of the receiver also implements an optional method whose name matches the pattern -get:range: that method will be used when appropriate for best performance. 4 (introduced in Mac OS 10.4). Otherwise (no simple accessor method or set of ordered set or array access methods is found), searches the class of the receiver for a threesome of methods whose names match the patterns -countOf, -enumeratorOf, and -memberOf: (corresponding to the primitive methods defined by the NSSet class). If all three such methods are found a collection proxy object that responds to all NSSet methods is returned. Each NSSet message sent to the collection proxy object will result in some combination of -countOf, -enumeratorOf, and -memberOf: messages being sent to the original receiver of -valueForKey:. 5. Otherwise (no simple accessor method or set of collection access methods is found), if the receiver's class' +accessInstanceVariablesDirectly method returns YES, searches the class of the receiver for an instance variable whose name matches the pattern _, _is, , or is, in that order. If such an instance variable is found, the value of the instance variable in the receiver is returned, with the same sort of conversion to NSNumber or NSValue as in step 1. 6. Otherwise (no simple accessor method, set of collection access methods, or instance variable is found), invokes -valueForUndefinedKey: and returns the result. The default implementation of -valueForUndefinedKey: raises an NSUndefinedKeyException, but you can override it in your application. Compatibility notes: - For backward binary compatibility, an accessor method whose name matches the pattern -_get, or -_ is searched for between steps 1 and 3. If such a method is found it is invoked, with the same sort of conversion to NSNumber or NSValue as in step 1. KVC accessor methods whose names start with underscores were deprecated as of Mac OS 10.3 though. - The behavior described in step 5 is a change from Mac OS 10.2, in which the instance variable search order was , _. - For backward binary compatibility, -handleQueryWithUnboundKey: will be invoked instead of -valueForUndefinedKey: in step 6, if the implementation of -handleQueryWithUnboundKey: in the receiver's class is not NSObject's. */ - (id)valueForKey:(NSString *)key; /* Given a value and a key that identifies an attribute, set the value of the attribute. Given an object and a key that identifies a to-one relationship, relate the object to the receiver, unrelating the previously related object if there was one. Given a collection object and a key that identifies a to-many relationship, relate the objects contained in the collection to the receiver, unrelating previously related objects if there were any. The default implementation of this method does the following: 1. Searches the class of the receiver for an accessor method whose name matches the pattern -set:. If such a method is found the type of its parameter is checked. If the parameter type is not an object pointer type but the value is nil -setNilValueForKey: is invoked. The default implementation of -setNilValueForKey: raises an NSInvalidArgumentException, but you can override it in your application. Otherwise, if the type of the method's parameter is an object pointer type the method is simply invoked with the value as the argument. If the type of the method's parameter is some other type the inverse of the NSNumber/NSValue conversion done by -valueForKey: is performed before the method is invoked. 2. Otherwise (no accessor method is found), if the receiver's class' +accessInstanceVariablesDirectly method returns YES, searches the class of the receiver for an instance variable whose name matches the pattern _, _is, , or is, in that order. If such an instance variable is found and its type is an object pointer type the value is retained and the result is set in the instance variable, after the instance variable's old value is first released. If the instance variable's type is some other type its value is set after the same sort of conversion from NSNumber or NSValue as in step 1. 3. Otherwise (no accessor method or instance variable is found), invokes -setValue:forUndefinedKey:. The default implementation of -setValue:forUndefinedKey: raises an NSUndefinedKeyException, but you can override it in your application. Compatibility notes: - For backward binary compatibility with -takeValue:forKey:'s behavior, a method whose name matches the pattern -_set: is also recognized in step 1. KVC accessor methods whose names start with underscores were deprecated as of Mac OS 10.3 though. - For backward binary compatibility, -unableToSetNilForKey: will be invoked instead of -setNilValueForKey: in step 1, if the implementation of -unableToSetNilForKey: in the receiver's class is not NSObject's. - The behavior described in step 2 is different from -takeValue:forKey:'s, in which the instance variable search order is , _. - For backward binary compatibility with -takeValue:forKey:'s behavior, -handleTakeValue:forUnboundKey: will be invoked instead of -setValue:forUndefinedKey: in step 3, if the implementation of -handleTakeValue:forUnboundKey: in the receiver's class is not NSObject's. */ - (void)setValue:(id)value forKey:(NSString *)key; /* Given a pointer to a value pointer, a key that identifies an attribute or to-one relationship, and a pointer to an NSError pointer, return a value that is suitable for use in subsequent -setValue:forKey: messages sent to the same receiver. If no validation is necessary, return YES without altering *ioValue or *outError. If validation is necessary and possible, return YES after setting *ioValue to an object that is the validated version of the original value, but without altering *outError. If validation is necessary but not possible, return NO after setting *outError to an NSError that encapsulates the reason that validation was not possible, but without altering *ioValue. The sender of the message is never given responsibility for releasing ioValue or outError. The default implementation of this method searches the class of the receiver for a validator method whose name matches the pattern -validate:error:. If such a method is found it is invoked and the result is returned. If no such method is found, YES is returned. */ - (BOOL)validateValue:(inout id *)ioValue forKey:(NSString *)inKey error:(out NSError **)outError; /* Given a key that identifies an _ordered_ to-many relationship, return a mutable array that provides read-write access to the related objects. Objects added to the mutable array will become related to the receiver, and objects removed from the mutable array will become unrelated. The default implementation of this method recognizes the same simple accessor methods and array accessor methods as -valueForKey:'s, and follows the same direct instance variable access policies, but always returns a mutable collection proxy object instead of the immutable collection that -valueForKey: would return. It also: 1. Searches the class of the receiver for methods whose names match the patterns -insertObject:inAtIndex: and -removeObjectFromAtIndex: (corresponding to the two most primitive methods defined by the NSMutableArray class), and (introduced in Mac OS 10.4) also -insert:atIndexes: and -removeAtIndexes: (corresponding to -[NSMutableArray insertObjects:atIndexes:] and -[NSMutableArray removeObjectsAtIndexes:). If at least one insertion method and at least one removal method are found each NSMutableArray message sent to the collection proxy object will result in some combination of -insertObject:inAtIndex:, -removeObjectFromAtIndex:, -insert:atIndexes:, and -removeAtIndexes: messages being sent to the original receiver of -mutableArrayValueForKey:. If the class of the receiver also implements an optional method whose name matches the pattern -replaceObjectInAtIndex:withObject: or (introduced in Mac OS 10.4) -replaceAtIndexes:with: that method will be used when appropriate for best performance. 2. Otherwise (no set of array mutation methods is found), searches the class of the receiver for an accessor method whose name matches the pattern -set:. If such a method is found each NSMutableArray message sent to the collection proxy object will result in a -set: message being sent to the original receiver of -mutableArrayValueForKey:. 3. Otherwise (no set of array mutation methods or simple accessor method is found), if the receiver's class' +accessInstanceVariablesDirectly method returns YES, searches the class of the receiver for an instance variable whose name matches the pattern _ or , in that order. If such an instance variable is found, each NSMutableArray message sent to the collection proxy object will be forwarded to the instance variable's value, which therefore must typically be an instance of NSMutableArray or a subclass of NSMutableArray. 4. Otherwise (no set of array mutation methods, simple accessor method, or instance variable is found), returns a mutable collection proxy object anyway. Each NSMutableArray message sent to the collection proxy object will result in a -setValue:forUndefinedKey: message being sent to the original receiver of -mutableArrayValueForKey:. The default implementation of -setValue:forUndefinedKey: raises an NSUndefinedKeyException, but you can override it in your application. Performance note: the repetitive -set: messages implied by step 2's description are a potential performance problem. For better performance implement insertion and removal methods that fulfill the requirements for step 1 in your KVC-compliant class. For best performance implement a replacement method too. */ - (NSMutableArray *)mutableArrayValueForKey:(NSString *)key; /* Given a key that identifies an _ordered_ and uniquing to-many relationship, return a mutable ordered set that provides read-write access to the related objects. Objects added to the mutable ordered set will become related to the receiver, and objects removed from the mutable ordered set will become unrelated. The default implementation of this method recognizes the same simple accessor methods and ordered set accessor methods as -valueForKey:'s, and follows the same direct instance variable access policies, but always returns a mutable collection proxy object instead of the immutable collection that -valueForKey: would return. It also: 1. Searches the class of the receiver for methods whose names match the patterns -insertObject:inAtIndex: and -removeObjectFromAtIndex: (corresponding to the two most primitive methods defined by the NSMutableOrderedSet class), and also -insert:atIndexes: and -removeAtIndexes: (corresponding to -[NSMutableOrderedSet insertObjects:atIndexes:] and -[NSMutableOrderedSet removeObjectsAtIndexes:). If at least one insertion method and at least one removal method are found each NSMutableOrderedSet message sent to the collection proxy object will result in some combination of -insertObject:inAtIndex:, -removeObjectFromAtIndex:, -insert:atIndexes:, and -removeAtIndexes: messages being sent to the original receiver of -mutableOrderedSetValueForKey:. If the class of the receiver also implements an optional method whose name matches the pattern -replaceObjectInAtIndex:withObject: or -replaceAtIndexes:with: that method will be used when appropriate for best performance. 2. Otherwise (no set of ordered set mutation methods is found), searches the class of the receiver for an accessor method whose name matches the pattern -set:. If such a method is found each NSMutableOrderedSet message sent to the collection proxy object will result in a -set: message being sent to the original receiver of -mutableOrderedSetValueForKey:. 3. Otherwise (no set of ordered set mutation methods or simple accessor method is found), if the receiver's class' +accessInstanceVariablesDirectly method returns YES, searches the class of the receiver for an instance variable whose name matches the pattern _ or , in that order. If such an instance variable is found, each NSMutableOrderedSet message sent to the collection proxy object will be forwarded to the instance variable's value, which therefore must typically be an instance of NSMutableOrderedSet or a subclass of NSMutableOrderedSet. 4. Otherwise (no set of ordered set mutation methods, simple accessor method, or instance variable is found), returns a mutable collection proxy object anyway. Each NSMutableOrderedSet message sent to the collection proxy object will result in a -setValue:forUndefinedKey: message being sent to the original receiver of -mutableOrderedSetValueForKey:. The default implementation of -setValue:forUndefinedKey: raises an NSUndefinedKeyException, but you can override it in your application. Performance note: the repetitive -set: messages implied by step 2's description are a potential performance problem. For better performance implement insertion and removal methods that fulfill the requirements for step 1 in your KVC-compliant class. For best performance implement a replacement method too. */ - (NSMutableOrderedSet *)mutableOrderedSetValueForKey:(NSString *)key NS_AVAILABLE(10_7, 5_0); /* Given a key that identifies an _unordered_ and uniquing to-many relationship, return a mutable set that provides read-write access to the related objects. Objects added to the mutable set will become related to the receiver, and objects removed from the mutable set will become unrelated. The default implementation of this method recognizes the same simple accessor methods and set accessor methods as -valueForKey:'s, and follows the same direct instance variable access policies, but always returns a mutable collection proxy object instead of the immutable collection that -valueForKey: would return. It also: 1. Searches the class of the receiver for methods whose names match the patterns -addObject: and -removeObject: (corresponding to the two primitive methods defined by the NSMutableSet class) and also -add: and -remove: (corresponding to -[NSMutableSet unionSet:] and -[NSMutableSet minusSet:]). If at least one addition method and at least one removal method are found each NSMutableSet message sent to the collection proxy object will result in some combination of -addObject:, -removeObject:, -add:, and -remove: messages being sent to the original receiver of -mutableSetValueForKey:. If the class of the receiver also implements an optional method whose name matches the pattern -intersect: or -set: that method will be used when appropriate for best performance. 2. Otherwise (no set of set mutation methods is found), searches the class of the receiver for an accessor method whose name matches the pattern -set:. If such a method is found each NSMutableSet message sent to the collection proxy object will result in a -set: message being sent to the original receiver of -mutableSetValueForKey:. 3. Otherwise (no set of set mutation methods or simple accessor method is found), if the receiver's class' +accessInstanceVariablesDirectly method returns YES, searches the class of the receiver for an instance variable whose name matches the pattern _ or , in that order. If such an instance variable is found, each NSMutableSet message sent to the collection proxy object will be forwarded to the instance variable's value, which therefore must typically be an instance of NSMutableSet or a subclass of NSMutableSet. 4. Otherwise (no set of set mutation methods, simple accessor method, or instance variable is found), returns a mutable collection proxy object anyway. Each NSMutableSet message sent to the collection proxy object will result in a -setValue:forUndefinedKey: message being sent to the original receiver of -mutableSetValueForKey:. The default implementation of -setValue:forUndefinedKey: raises an NSUndefinedKeyException, but you can override it in your application. Performance note: the repetitive -set: messages implied by step 2's description are a potential performance problem. For better performance implement methods that fulfill the requirements for step 1 in your KVC-compliant class. */ - (NSMutableSet *)mutableSetValueForKey:(NSString *)key; /* Key-path-taking variants of like-named methods. The default implementation of each parses the key path enough to determine whether or not it has more than one component (key path components are separated by periods). If so, -valueForKey: is invoked with the first key path component as the argument, and the method being invoked is invoked recursively on the result, with the remainder of the key path passed as an argument. If not, the like-named non-key-path-taking method is invoked. */ - (id)valueForKeyPath:(NSString *)keyPath; - (void)setValue:(id)value forKeyPath:(NSString *)keyPath; - (BOOL)validateValue:(inout id *)ioValue forKeyPath:(NSString *)inKeyPath error:(out NSError **)outError; - (NSMutableArray *)mutableArrayValueForKeyPath:(NSString *)keyPath; - (NSMutableOrderedSet *)mutableOrderedSetValueForKeyPath:(NSString *)keyPath NS_AVAILABLE(10_7, 5_0); - (NSMutableSet *)mutableSetValueForKeyPath:(NSString *)keyPath; /* Given that an invocation of -valueForKey: would be unable to get a keyed value using its default access mechanism, return the keyed value using some other mechanism. The default implementation of this method raises an NSUndefinedKeyException. You can override it to handle properties that are dynamically defined at run-time. */ - (id)valueForUndefinedKey:(NSString *)key; /* Given that an invocation of -setValue:forKey: would be unable to set the keyed value using its default mechanism, set the keyed value using some other mechanism. The default implementation of this method raises an NSUndefinedKeyException. You can override it to handle properties that are dynamically defined at run-time. */ - (void)setValue:(id)value forUndefinedKey:(NSString *)key; /* Given that an invocation of -setValue:forKey: would be unable to set the keyed value because the type of the parameter of the corresponding accessor method is an NSNumber scalar type or NSValue structure type but the value is nil, set the keyed value using some other mechanism. The default implementation of this method raises an NSInvalidArgumentException. You can override it to map nil values to something meaningful in the context of your application. */ - (void)setNilValueForKey:(NSString *)key; /* Given an array of keys, return a dictionary containing the keyed attribute values, to-one-related objects, and/or collections of to-many-related objects. Entries for which -valueForKey: returns nil have NSNull as their value in the returned dictionary. */ - (NSDictionary *)dictionaryWithValuesForKeys:(NSArray *)keys; /* Given a dictionary containing keyed attribute values, to-one-related objects, and/or collections of to-many-related objects, set the keyed values. Dictionary entries whose values are NSNull result in -setValue:nil forKey:key messages being sent to the receiver. */ - (void)setValuesForKeysWithDictionary:(NSDictionary *)keyedValues; @end @interface NSArray(NSKeyValueCoding) /* Return an array containing the results of invoking -valueForKey: on each of the receiver's elements. The returned array will contain NSNull elements for each instance of -valueForKey: returning nil. */ - (id)valueForKey:(NSString *)key; /* Invoke -setValue:forKey: on each of the receiver's elements. */ - (void)setValue:(id)value forKey:(NSString *)key; @end @interface NSDictionary(NSKeyValueCoding) /* Return the result of sending -objectForKey: to the receiver. */ - (id)valueForKey:(NSString *)key; @end @interface NSMutableDictionary(NSKeyValueCoding) /* Send -setObject:forKey: to the receiver, unless the value is nil, in which case send -removeObject:forKey:. */ - (void)setValue:(id)value forKey:(NSString *)key; @end @interface NSOrderedSet(NSKeyValueCoding) /* Return an ordered set containing the results of invoking -valueForKey: on each of the receiver's members. The returned ordered set might not have the same number of members as the receiver. The returned ordered set will not contain any elements corresponding to instances of -valueForKey: returning nil, nor will it contain duplicates. */ - (id)valueForKey:(NSString *)key NS_AVAILABLE(10_7, 5_0); /* Invoke -setValue:forKey: on each of the receiver's members. */ - (void)setValue:(id)value forKey:(NSString *)key NS_AVAILABLE(10_7, 5_0); @end @interface NSSet(NSKeyValueCoding) /* Return a set containing the results of invoking -valueForKey: on each of the receiver's members. The returned set might not have the same number of members as the receiver. The returned set will not contain any elements corresponding to instances of -valueForKey: returning nil (in contrast with -[NSArray(NSKeyValueCoding) valueForKey:], which may put NSNulls in the arrays it returns). */ - (id)valueForKey:(NSString *)key; /* Invoke -setValue:forKey: on each of the receiver's members. */ - (void)setValue:(id)value forKey:(NSString *)key; @end #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) @interface NSObject(NSDeprecatedKeyValueCoding) /* Methods that were deprecated in Mac OS 10.4. */ + (BOOL)useStoredAccessor NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); - (id)storedValueForKey:(NSString *)key NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); - (void)takeStoredValue:(id)value forKey:(NSString *)key NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); /* Methods that were deprecated in Mac OS 10.3. Use the new, more consistently named, methods declared above instead. */ - (void)takeValue:(id)value forKey:(NSString *)key NS_DEPRECATED(10_0, 10_3, 2_0, 2_0); - (void)takeValue:(id)value forKeyPath:(NSString *)keyPath NS_DEPRECATED(10_0, 10_3, 2_0, 2_0); - (id)handleQueryWithUnboundKey:(NSString *)key NS_DEPRECATED(10_0, 10_3, 2_0, 2_0); - (void)handleTakeValue:(id)value forUnboundKey:(NSString *)key NS_DEPRECATED(10_0, 10_3, 2_0, 2_0); - (void)unableToSetNilForKey:(NSString *)key NS_DEPRECATED(10_0, 10_3, 2_0, 2_0); - (NSDictionary *)valuesForKeys:(NSArray *)keys NS_DEPRECATED(10_0, 10_3, 2_0, 2_0); - (void)takeValuesFromDictionary:(NSDictionary *)properties NS_DEPRECATED(10_0, 10_3, 2_0, 2_0); @end #endif /* NSKeyValueObserving.h Copyright (c) 2003-2012, Apple Inc. All rights reserved. */ #import #import #import @class NSIndexSet, NSString; /* Options for use with -addObserver:forKeyPath:options:context: and -addObserver:toObjectsAtIndexes:forKeyPath:options:context:. */ typedef NS_OPTIONS(NSUInteger, NSKeyValueObservingOptions) { /* Whether the change dictionaries sent in notifications should contain NSKeyValueChangeNewKey and NSKeyValueChangeOldKey entries, respectively. */ NSKeyValueObservingOptionNew = 0x01, NSKeyValueObservingOptionOld = 0x02, /* Whether a notification should be sent to the observer immediately, before the observer registration method even returns. The change dictionary in the notification will always contain an NSKeyValueChangeNewKey entry if NSKeyValueObservingOptionNew is also specified but will never contain an NSKeyValueChangeOldKey entry. (In an initial notification the current value of the observed property may be old, but it's new to the observer.) You can use this option instead of explicitly invoking, at the same time, code that is also invoked by the observer's -observeValueForKeyPath:ofObject:change:context: method. When this option is used with -addObserver:toObjectsAtIndexes:forKeyPath:options:context: a notification will be sent for each indexed object to which the observer is being added. */ NSKeyValueObservingOptionInitial NS_ENUM_AVAILABLE(10_5, 2_0) = 0x04, /* Whether separate notifications should be sent to the observer before and after each change, instead of a single notification after the change. The change dictionary in a notification sent before a change always contains an NSKeyValueChangeNotificationIsPriorKey entry whose value is [NSNumber numberWithBool:YES], but never contains an NSKeyValueChangeNewKey entry. You can use this option when the observer's own KVO-compliance requires it to invoke one of the -willChange... methods for one of its own properties, and the value of that property depends on the value of the observed object's property. (In that situation it's too late to easily invoke -willChange... properly in response to receiving an -observeValueForKeyPath:ofObject:change:context: message after the change.) When this option is specified, the change dictionary in a notification sent after a change contains the same entries that it would contain if this option were not specified, except for ordered unique to-many relationships represented by NSOrderedSets. For those, for NSKeyValueChangeInsertion and NSKeyValueChangeReplacement changes, the change dictionary for a will-change notification contains an NSKeyValueChangeIndexesKey (and NSKeyValueChangeOldKey in the case of Replacement where the NSKeyValueObservingOptionOld option was specified at registration time) which give the indexes (and objects) which *may* be changed by the operation. The second notification, after the change, contains entries reporting what did actually change. For NSKeyValueChangeRemoval changes, removals by index are precise. */ NSKeyValueObservingOptionPrior NS_ENUM_AVAILABLE(10_5, 2_0) = 0x08 }; /* Possible values in the NSKeyValueChangeKindKey entry in change dictionaries. See the comments for -observeValueForKeyPath:ofObject:change:context: for more information. */ typedef NS_OPTIONS(NSUInteger, NSKeyValueChange) { NSKeyValueChangeSetting = 1, NSKeyValueChangeInsertion = 2, NSKeyValueChangeRemoval = 3, NSKeyValueChangeReplacement = 4 }; /* Possible kinds of set mutation for use with -willChangeValueForKey:withSetMutation:usingObjects: and -didChangeValueForKey:withSetMutation:usingObjects:. Their semantics correspond exactly to NSMutableSet's -unionSet:, -minusSet:, -intersectSet:, and -setSet: method, respectively. */ typedef NS_OPTIONS(NSUInteger, NSKeyValueSetMutationKind) { NSKeyValueUnionSetMutation = 1, NSKeyValueMinusSetMutation = 2, NSKeyValueIntersectSetMutation = 3, NSKeyValueSetSetMutation = 4 }; /* Keys for entries in change dictionaries. See the comments for -observeValueForKeyPath:ofObject:change:context: for more information. */ FOUNDATION_EXPORT NSString *const NSKeyValueChangeKindKey; FOUNDATION_EXPORT NSString *const NSKeyValueChangeNewKey; FOUNDATION_EXPORT NSString *const NSKeyValueChangeOldKey; FOUNDATION_EXPORT NSString *const NSKeyValueChangeIndexesKey; FOUNDATION_EXPORT NSString *const NSKeyValueChangeNotificationIsPriorKey NS_AVAILABLE(10_5, 2_0); @interface NSObject(NSKeyValueObserving) /* Given that the receiver has been registered as an observer of the value at a key path relative to an object, be notified of a change to that value. The change dictionary always contains an NSKeyValueChangeKindKey entry whose value is an NSNumber wrapping an NSKeyValueChange (use -[NSNumber unsignedIntegerValue]). The meaning of NSKeyValueChange depends on what sort of property is identified by the key path: - For any sort of property (attribute, to-one relationship, or ordered or unordered to-many relationship) NSKeyValueChangeSetting indicates that the observed object has received a -setValue:forKey: message, or that the key-value coding-compliant set method for the key has been invoked, or that a -willChangeValueForKey:/-didChangeValueForKey: pair has otherwise been invoked. - For an _ordered_ to-many relationship, NSKeyValueChangeInsertion, NSKeyValueChangeRemoval, and NSKeyValueChangeReplacement indicate that a mutating message has been sent to the array returned by a -mutableArrayValueForKey: message sent to the object, or sent to the ordered set returned by a -mutableOrderedSetValueForKey: message sent to the object, or that one of the key-value coding-compliant array or ordered set mutation methods for the key has been invoked, or that a -willChange:valuesAtIndexes:forKey:/-didChange:valuesAtIndexes:forKey: pair has otherwise been invoked. - For an _unordered_ to-many relationship (introduced in Mac OS 10.4), NSKeyValueChangeInsertion, NSKeyValueChangeRemoval, and NSKeyValueChangeReplacement indicate that a mutating message has been sent to the set returned by a -mutableSetValueForKey: message sent to the object, or that one of the key-value coding-compliant set mutation methods for the key has been invoked, or that a -willChangeValueForKey:withSetMutation:usingObjects:/-didChangeValueForKey:withSetMutation:usingObjects: pair has otherwise been invoked. For any sort of property, the change dictionary contains an NSKeyValueChangeNewKey entry if NSKeyValueObservingOptionNew was specified at observer registration time, it's the right kind of change, and this isn't a prior notification. The change dictionary contains an NSKeyValueChangeOldKey if NSKeyValueObservingOptionOld was specified and it's the right kind of change. See the comments for the NSKeyValueObserverNotification informal protocol methods for what the values of those entries can be. For an _ordered_ to-many relationship, the change dictionary always contains an NSKeyValueChangeIndexesKey entry whose value is an NSIndexSet containing the indexes of the inserted, removed, or replaced objects, unless the change is an NSKeyValueChangeSetting. If NSKeyValueObservingOptionPrior (introduced in Mac OS 10.5) was specified at observer registration time, and this notification is one being sent prior to a change as a result, the change dictionary contains an NSKeyValueChangeNotificationIsPriorKey entry whose value is an NSNumber wrapping YES (use -[NSNumber boolValue]). context is always the same pointer that was passed in at observer registration time. */ - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context; @end @interface NSObject(NSKeyValueObserverRegistration) /* Register or deregister as an observer of the value at a key path relative to the receiver. The options determine what is included in observer notifications and when they're sent, as described above, and the context is passed in observer notifications as described above. You should use -removeObserver:forKeyPath:context: instead of -removeObserver:forKeyPath: whenever possible because it allows you to more precisely specify your intent. When the same observer is registered for the same key path multiple times, but with different context pointers each time, -removeObserver:forKeyPath: has to guess at the context pointer when deciding what exactly to remove, and it can guess wrong. */ - (void)addObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options context:(void *)context; - (void)removeObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath context:(void *)context NS_AVAILABLE(10_7, 5_0); - (void)removeObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath; @end @interface NSArray(NSKeyValueObserverRegistration) /* Register or deregister as an observer of the values at a key path relative to each indexed element of the array. The options determine what is included in observer notifications and when they're sent, as described above, and the context is passed in observer notifications as described above. These are not merely convenience methods; invoking them is potentially much faster than repeatedly invoking NSObject(NSKeyValueObserverRegistration) methods. You should use -removeObserver:fromObjectsAtIndexes:forKeyPath:context: instead of -removeObserver:fromObjectsAtIndexes:forKeyPath: whenever possible for the same reason described in the NSObject(NSKeyValueObserverRegistration) comment. */ - (void)addObserver:(NSObject *)observer toObjectsAtIndexes:(NSIndexSet *)indexes forKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options context:(void *)context; - (void)removeObserver:(NSObject *)observer fromObjectsAtIndexes:(NSIndexSet *)indexes forKeyPath:(NSString *)keyPath context:(void *)context NS_AVAILABLE(10_7, 5_0); - (void)removeObserver:(NSObject *)observer fromObjectsAtIndexes:(NSIndexSet *)indexes forKeyPath:(NSString *)keyPath; /* NSArrays are not observable, so these methods raise exceptions when invoked on NSArrays. Instead of observing an array, observe the ordered to-many relationship for which the array is the collection of related objects. */ - (void)addObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options context:(void *)context; - (void)removeObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath context:(void *)context NS_AVAILABLE(10_7, 5_0); - (void)removeObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath; @end @interface NSOrderedSet(NSKeyValueObserverRegistration) /* NSOrderedSets are not observable, so these methods raise exceptions when invoked on NSOrderedSets. Instead of observing an ordered set, observe the ordered to-many relationship for which the ordered set is the collection of related objects. */ - (void)addObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options context:(void *)context; - (void)removeObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath context:(void *)context NS_AVAILABLE(10_7, 5_0); - (void)removeObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath; @end @interface NSSet(NSKeyValueObserverRegistration) /* NSSets are not observable, so these methods raise exceptions when invoked on NSSets. Instead of observing a set, observe the unordered to-many relationship for which the set is the collection of related objects. */ - (void)addObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath options:(NSKeyValueObservingOptions)options context:(void *)context; - (void)removeObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath context:(void *)context NS_AVAILABLE(10_7, 5_0); - (void)removeObserver:(NSObject *)observer forKeyPath:(NSString *)keyPath; @end @interface NSObject(NSKeyValueObserverNotification) /* Given a key that identifies a property (attribute, to-one relationship, or ordered or unordered to-many relationship), send -observeValueForKeyPath:ofObject:change:context: notification messages of kind NSKeyValueChangeSetting to each observer registered for the key, including those that are registered with other objects using key paths that locate the keyed value in this object. Invocations of these methods must always be paired. The change dictionaries in notifications resulting from use of these methods contain optional entries if requested at observer registration time: - The NSKeyValueChangeOldKey entry, if present, contains the value returned by -valueForKey: at the instant that -willChangeValueForKey: is invoked (or an NSNull if -valueForKey: returns nil). - The NSKeyValueChangeNewKey entry, if present, contains the value returned by -valueForKey: at the instant that -didChangeValueForKey: is invoked (or an NSNull if -valueForKey: returns nil). */ - (void)willChangeValueForKey:(NSString *)key; - (void)didChangeValueForKey:(NSString *)key; /* Given a key that identifies an _ordered_ to-many relationship, send -observeValueForKeyPath:ofObject:change:context: notification messages of the passed-in change kind to each observer registered for the key, including those that are registered with other objects using key paths that locate the keyed value in this object. The passed-in kind must be NSKeyValueChangeInsertion, NSKeyValueChangeRemoval, or NSKeyValueChangeReplacement. The passed-in index set must be the indexes of the objects being inserted, removed, or replaced. Invocations of these methods must always be paired, with identical arguments. The change dictionaries in notifications resulting from use of these methods contain optional entries if requested at observer registration time: - The NSKeyValueChangeOldKey entry, if present (only for NSKeyValueChangeRemoval and NSKeyValueChangeReplacement), contains an array of the indexed objects from the array returned by -valueForKey: at the instant that -willChangeValueForKey:valuesAtIndexes:forKey: is invoked. - The NSKeyValueChangeNewKey entry, if present (only for NSKeyValueChangeInsertion and NSKeyValueChangeReplacement), contains an array of the indexed objects from the array returned by -valueForKey: at the instant that -didChangeValueForKey:valuesAtIndexes:forKey: is invoked. */ - (void)willChange:(NSKeyValueChange)changeKind valuesAtIndexes:(NSIndexSet *)indexes forKey:(NSString *)key; - (void)didChange:(NSKeyValueChange)changeKind valuesAtIndexes:(NSIndexSet *)indexes forKey:(NSString *)key; /* Given a key that identifies an _unordered_ to-many relationship, send -observeValueForKeyPath:ofObject:change:context: notification messages to each observer registered for the key, including those that are registered with other objects using key paths that locate the keyed value in this object. The passed-in mutation kind corresponds to an NSMutableSet method. The passed-in set must contain the set that would be passed to the corresponding NSMutableSet method. Invocations of these methods must always be paired, with identical arguments. The value of the NSKeyValueChangeKindKey entry in change dictionaries in notifications resulting from use of these methods depends on the passed-in mutationKind value: - NSKeyValueUnionSetMutation -> NSKeyValueChangeInsertion - NSKeyValueMinusSetMutation -> NSKeyValueChangeRemoval - NSKeyValueIntersectSetMutation -> NSKeyValueChangeRemoval - NSKeyValueSetSetMutation -> NSKeyValueChangeReplacement The change dictionaries may also contain optional entries: - The NSKeyValueChangeOldKey entry, if present (only for for NSKeyValueChangeRemoval and NSKeyValueChangeReplacement), contains the set of objects that were removed. - The NSKeyValueChangeNewKey entry, if present (only for NSKeyValueChangeInsertion and NSKeyValueChangeReplacement), contains the set of objects that were added. */ - (void)willChangeValueForKey:(NSString *)key withSetMutation:(NSKeyValueSetMutationKind)mutationKind usingObjects:(NSSet *)objects; - (void)didChangeValueForKey:(NSString *)key withSetMutation:(NSKeyValueSetMutationKind)mutationKind usingObjects:(NSSet *)objects; @end @interface NSObject(NSKeyValueObservingCustomization) /* Return a set of key paths for properties whose values affect the value of the keyed property. When an observer for the key is registered with an instance of the receiving class, KVO itself automatically observes all of the key paths for the same instance, and sends change notifications for the key to the observer when the value for any of those key paths changes. The default implementation of this method searches the receiving class for a method whose name matches the pattern +keyPathsForValuesAffecting, and returns the result of invoking that method if it is found. So, any such method must return an NSSet too. If no such method is found, an NSSet that is computed from information provided by previous invocations of the now-deprecated +setKeys:triggerChangeNotificationsForDependentKey: method is returned, for backward binary compatibility. This method and KVO's automatic use of it comprise a dependency mechanism that you can use instead of sending -willChangeValueForKey:/-didChangeValueForKey: messages for dependent, computed, properties. You can override this method when the getter method of one of your properties computes a value to return using the values of other properties, including those that are located by key paths. Your override should typically invoke super and return a set that includes any members in the set that result from doing that (so as not to interfere with overrides of this method in superclasses). You can't really override this method when you add a computed property to an existing class using a category, because you're not supposed to override methods in categories. In that case, implement a matching +keyPathsForValuesAffecting to take advantage of this mechanism. */ + (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key NS_AVAILABLE(10_5, 2_0); /* Return YES if the key-value observing machinery should automatically invoke -willChangeValueForKey:/-didChangeValueForKey:, -willChange:valuesAtIndexes:forKey:/-didChange:valuesAtIndexes:forKey:, or -willChangeValueForKey:withSetMutation:usingObjects:/-didChangeValueForKey:withSetMutation:usingObjects: whenever instances of the class receive key-value coding messages for the key, or mutating key-value coding-compliant methods for the key are invoked. Return NO otherwise. Starting in Mac OS 10.5, the default implementation of this method searches the receiving class for a method whose name matches the pattern +automaticallyNotifiesObserversOf, and returns the result of invoking that method if it is found. So, any such method must return BOOL too. If no such method is found YES is returned. */ + (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key; /* Take or return a pointer that identifies information about all of the observers that are registered with the receiver, the options that were used at registration-time, etc. The default implementation of these methods store observation info in a global dictionary keyed by the receivers' pointers. For improved performance, you can override these methods to store the opaque data pointer in an instance variable. Overrides of these methods must not attempt to send Objective-C messages to the passed-in observation info, including -retain and -release. */ - (void)setObservationInfo:(void *)observationInfo; - (void *)observationInfo NS_RETURNS_INNER_POINTER; @end #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) @interface NSObject(NSDeprecatedKeyValueObservingCustomization) /* A method that was deprecated in Mac OS 10.5, in favor of using +keyPathsForValuesAffectingValueForKey:. Registers the fact that invocations of -willChangeValueForKey:/-didChangeValueForKey:, -willChange:valuesAtIndexes:forKey:/-didChange:valuesAtIndexes:forKey:, and -willChangeValueForKey:withSetMutation:usingObjects:/-didChangeValueForKey:withSetMutation:usingObjects: for any key in the passed-in array should also send notifications for the dependent key. */ + (void)setKeys:(NSArray *)keys triggerChangeNotificationsForDependentKey:(NSString *)dependentKey NS_DEPRECATED(10_0, 10_5, 2_0, 2_0); @end #endif /* NSKeyedArchiver.h Copyright (c) 2001-2012, Apple Inc. All rights reserved. */ #import #import #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) #import #endif @class NSArray, NSMutableData, NSData; @protocol NSKeyedArchiverDelegate, NSKeyedUnarchiverDelegate; FOUNDATION_EXPORT NSString * const NSInvalidArchiveOperationException; FOUNDATION_EXPORT NSString * const NSInvalidUnarchiveOperationException; @interface NSKeyedArchiver : NSCoder { @private void *_stream; NSUInteger _flags; id _delegate; id _containers; id _objects; id _objRefMap; id _replacementMap; id _classNameMap; id _conditionals; id _classes; NSUInteger _genericKey; void *_cache; NSUInteger _cacheSize; NSUInteger _estimatedCount; void *_reserved2; id _visited; void * __strong _reserved0; } + (NSData *)archivedDataWithRootObject:(id)rootObject; + (BOOL)archiveRootObject:(id)rootObject toFile:(NSString *)path; - (id)initForWritingWithMutableData:(NSMutableData *)data; - (void)setDelegate:(id )delegate; - (id )delegate; - (void)setOutputFormat:(NSPropertyListFormat)format; - (NSPropertyListFormat)outputFormat; - (void)finishEncoding; + (void)setClassName:(NSString *)codedName forClass:(Class)cls; - (void)setClassName:(NSString *)codedName forClass:(Class)cls; // During encoding, the coder first checks with the coder's // own table, then if there was no mapping there, the class's. + (NSString *)classNameForClass:(Class)cls; - (NSString *)classNameForClass:(Class)cls; - (void)encodeObject:(id)objv forKey:(NSString *)key; - (void)encodeConditionalObject:(id)objv forKey:(NSString *)key; - (void)encodeBool:(BOOL)boolv forKey:(NSString *)key; - (void)encodeInt:(int)intv forKey:(NSString *)key; // native int - (void)encodeInt32:(int32_t)intv forKey:(NSString *)key; - (void)encodeInt64:(int64_t)intv forKey:(NSString *)key; - (void)encodeFloat:(float)realv forKey:(NSString *)key; - (void)encodeDouble:(double)realv forKey:(NSString *)key; - (void)encodeBytes:(const uint8_t *)bytesp length:(NSUInteger)lenv forKey:(NSString *)key; @end @interface NSKeyedUnarchiver : NSCoder { @private id _delegate; uint32_t _flags; id _objRefMap; id _replacementMap; id _nameClassMap; id _tmpRefObjMap; id _refObjMap; int32_t _genericKey; id _data; void *_offsetData; id _containers; id _objects; const uint8_t *_bytes; uint64_t _len; id _helper; void * __strong _reserved0; } + (id)unarchiveObjectWithData:(NSData *)data; + (id)unarchiveObjectWithFile:(NSString *)path; - (id)initForReadingWithData:(NSData *)data; - (void)setDelegate:(id )delegate; - (id )delegate; - (void)finishDecoding; + (void)setClass:(Class)cls forClassName:(NSString *)codedName; - (void)setClass:(Class)cls forClassName:(NSString *)codedName; // During decoding, the coder first checks with the coder's // own table, then if there was no mapping there, the class's. + (Class)classForClassName:(NSString *)codedName; - (Class)classForClassName:(NSString *)codedName; - (BOOL)containsValueForKey:(NSString *)key; - (id)decodeObjectForKey:(NSString *)key; - (BOOL)decodeBoolForKey:(NSString *)key; - (int)decodeIntForKey:(NSString *)key; // may raise a range exception - (int32_t)decodeInt32ForKey:(NSString *)key; - (int64_t)decodeInt64ForKey:(NSString *)key; - (float)decodeFloatForKey:(NSString *)key; - (double)decodeDoubleForKey:(NSString *)key; - (const uint8_t *)decodeBytesForKey:(NSString *)key returnedLength:(NSUInteger *)lengthp NS_RETURNS_INNER_POINTER; // returned bytes immutable, and they go away with the unarchiver, not the containing autorlease pool @end @protocol NSKeyedArchiverDelegate @optional // substitution - (id)archiver:(NSKeyedArchiver *)archiver willEncodeObject:(id)object; // Informs the delegate that the object is about to be encoded. The delegate // either returns this object or can return a different object to be encoded // instead. The delegate can also fiddle with the coder state. If the delegate // returns nil, nil is encoded. This method is called after the original object // may have replaced itself with replacementObjectForKeyedArchiver:. // This method is not called for an object once a replacement mapping has been // setup for that object (either explicitly, or because the object has previously // been encoded). This is also not called when nil is about to be encoded. // This method is called whether or not the object is being encoded conditionally. - (void)archiver:(NSKeyedArchiver *)archiver didEncodeObject:(id)object; // Informs the delegate that the given object has been encoded. The delegate // might restore some state it had fiddled previously, or use this to keep // track of the objects which are encoded. The object may be nil. Not called // for conditional objects until they are really encoded (if ever). // notification - (void)archiver:(NSKeyedArchiver *)archiver willReplaceObject:(id)object withObject:(id)newObject; // Informs the delegate that the newObject is being substituted for the // object. This is also called when the delegate itself is doing/has done // the substitution. The delegate may use this method if it is keeping track // of the encoded or decoded objects. - (void)archiverWillFinish:(NSKeyedArchiver *)archiver; // Notifies the delegate that encoding is about to finish. - (void)archiverDidFinish:(NSKeyedArchiver *)archiver; // Notifies the delegate that encoding has finished. @end @protocol NSKeyedUnarchiverDelegate @optional // error handling - (Class)unarchiver:(NSKeyedUnarchiver *)unarchiver cannotDecodeObjectOfClassName:(NSString *)name originalClasses:(NSArray *)classNames; // Informs the delegate that the named class is not available during decoding. // The delegate may, for example, load some code to introduce the class to the // runtime and return it, or substitute a different class object. If the // delegate returns nil, unarchiving aborts with an exception. The first class // name string in the array is the class of the encoded object, the second is // the immediate superclass, and so on. // substitution - (id)unarchiver:(NSKeyedUnarchiver *)unarchiver didDecodeObject:(id) NS_RELEASES_ARGUMENT object NS_RETURNS_RETAINED; // Informs the delegate that the object has been decoded. The delegate // either returns this object or can return a different object to replace // the decoded one. The object may be nil. If the delegate returns nil, // nil is the result of decoding the object. The delegate // may use this to keep track of the decoded objects. // notification - (void)unarchiver:(NSKeyedUnarchiver *)unarchiver willReplaceObject:(id)object withObject:(id)newObject; // Informs the delegate that the newObject is being substituted for the // object. This is also called when the delegate itself is doing/has done // the substitution. The delegate may use this method if it is keeping track // of the encoded or decoded objects. - (void)unarchiverWillFinish:(NSKeyedUnarchiver *)unarchiver; // Notifies the delegate that decoding is about to finish. - (void)unarchiverDidFinish:(NSKeyedUnarchiver *)unarchiver; // Notifies the delegate that decoding has finished. @end @interface NSObject (NSKeyedArchiverObjectSubstitution) - (Class)classForKeyedArchiver; // Implemented by classes to substitute a new class for instances during // encoding. The object will be encoded as if it were a member of the // returned class. The results of this method are overridden by the archiver // class and instance name<->class encoding tables. If nil is returned, // the result of this method is ignored. This method returns the result of // [self classForArchiver] by default, NOT -classForCoder as might be // expected. This is a concession to source compatibility. - (id)replacementObjectForKeyedArchiver:(NSKeyedArchiver *)archiver; // Implemented by classes to substitute new instances for the receiving // instance during encoding. The returned object will be encoded instead // of the receiver (if different). This method is called only if no // replacement mapping for the object has been set up in the archiver yet // (for example, due to a previous call of replacementObjectForKeyedArchiver: // to that object). This method returns the result of // [self replacementObjectForArchiver:nil] by default, NOT // -replacementObjectForCoder: as might be expected. This is a concession // to source compatibility. + (NSArray *)classFallbacksForKeyedArchiver; @end @interface NSObject (NSKeyedUnarchiverObjectSubstitution) + (Class)classForKeyedUnarchiver; // Implemented by classes to substitute a new class during decoding. // Objects of the class will be decoded as members of the returned // class. This method overrides the results of the unarchiver's class and // instance name<->class encoding tables. Returns self by default. @end /* NSLinguisticTagger.h Copyright (c) 2009-2012, Apple Inc. All rights reserved. */ #import #import @class NSArray, NSOrthography; /* NSLinguisticTagger is a class used to automatically segment natural-language text and tag the tokens with information such as language, script, lemma, and part of speech. An instance of this class is assigned a string to tag, and clients can then obtain tags and ranges for tokens in that string appropriate to a given tag scheme. */ /* Tag schemes */ FOUNDATION_EXPORT NSString *const NSLinguisticTagSchemeTokenType NS_AVAILABLE(10_7, 5_0); /* This tag scheme classifies tokens according to their broad general type: word, punctuation, whitespace, etc. */ FOUNDATION_EXPORT NSString *const NSLinguisticTagSchemeLexicalClass NS_AVAILABLE(10_7, 5_0); /* This tag scheme classifies tokens according to class: part of speech for words, type of punctuation or whitespace, etc. */ FOUNDATION_EXPORT NSString *const NSLinguisticTagSchemeNameType NS_AVAILABLE(10_7, 5_0); /* This tag scheme classifies tokens as to whether they are part of named entities of various types or not. */ FOUNDATION_EXPORT NSString *const NSLinguisticTagSchemeNameTypeOrLexicalClass NS_AVAILABLE(10_7, 5_0); /* This tag scheme follows NSLinguisticTagSchemeNameType for names, NSLinguisticTagSchemeLexicalClass for all other tokens. */ FOUNDATION_EXPORT NSString *const NSLinguisticTagSchemeLemma NS_AVAILABLE(10_7, 5_0); /* This tag scheme supplies a stem form for each word token (if known). */ FOUNDATION_EXPORT NSString *const NSLinguisticTagSchemeLanguage NS_AVAILABLE(10_7, 5_0); /* This tag scheme tags tokens according to their most likely language (if known). */ FOUNDATION_EXPORT NSString *const NSLinguisticTagSchemeScript NS_AVAILABLE(10_7, 5_0); /* This tag scheme tags tokens according to their script. */ /* Tags for NSLinguisticTagSchemeTokenType */ FOUNDATION_EXPORT NSString *const NSLinguisticTagWord NS_AVAILABLE(10_7, 5_0); /* Tokens considered to be words or word-like linguistic items. */ FOUNDATION_EXPORT NSString *const NSLinguisticTagPunctuation NS_AVAILABLE(10_7, 5_0); /* Tokens made up of punctuation. */ FOUNDATION_EXPORT NSString *const NSLinguisticTagWhitespace NS_AVAILABLE(10_7, 5_0); /* Tokens made up of whitespace of all sorts. */ FOUNDATION_EXPORT NSString *const NSLinguisticTagOther NS_AVAILABLE(10_7, 5_0); /* Other tokens, including non-linguistic items such as symbols. */ /* Tags for NSLinguisticTagSchemeLexicalClass */ FOUNDATION_EXPORT NSString *const NSLinguisticTagNoun NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString *const NSLinguisticTagVerb NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString *const NSLinguisticTagAdjective NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString *const NSLinguisticTagAdverb NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString *const NSLinguisticTagPronoun NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString *const NSLinguisticTagDeterminer NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString *const NSLinguisticTagParticle NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString *const NSLinguisticTagPreposition NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString *const NSLinguisticTagNumber NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString *const NSLinguisticTagConjunction NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString *const NSLinguisticTagInterjection NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString *const NSLinguisticTagClassifier NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString *const NSLinguisticTagIdiom NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString *const NSLinguisticTagOtherWord NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString *const NSLinguisticTagSentenceTerminator NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString *const NSLinguisticTagOpenQuote NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString *const NSLinguisticTagCloseQuote NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString *const NSLinguisticTagOpenParenthesis NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString *const NSLinguisticTagCloseParenthesis NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString *const NSLinguisticTagWordJoiner NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString *const NSLinguisticTagDash NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString *const NSLinguisticTagOtherPunctuation NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString *const NSLinguisticTagParagraphBreak NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString *const NSLinguisticTagOtherWhitespace NS_AVAILABLE(10_7, 5_0); /* Tags for NSLinguisticTagSchemeNameType */ FOUNDATION_EXPORT NSString *const NSLinguisticTagPersonalName NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString *const NSLinguisticTagPlaceName NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString *const NSLinguisticTagOrganizationName NS_AVAILABLE(10_7, 5_0); /* For NSLinguisticTagSchemeTokenType, NSLinguisticTagSchemeLexicalClass, NSLinguisticTagSchemeNameType, and NSLinguisticTagSchemeNameTypeOrLexicalClass, tags will be taken from the lists above (clients may use == comparison). Tags for NSLinguisticTagSchemeLemma are lemmas from the language. Tags for NSLinguisticTagSchemeLanguage are standard language abbreviations. Tags for NSLinguisticTagSchemeScript are standard script abbreviations. */ /* Options arguments of type NSLinguisticTaggerOptions may include the following flags, which allow clients interested only in certain general types of tokens to specify that tokens of other types should be omitted from the returned results. */ typedef NS_OPTIONS(NSUInteger, NSLinguisticTaggerOptions) { /* Any combination of options from the enumeration. */ NSLinguisticTaggerOmitWords = 1 << 0, /* Omit tokens of type NSLinguisticTagWord. */ NSLinguisticTaggerOmitPunctuation = 1 << 1, /* Omit tokens of type NSLinguisticTagPunctuation. */ NSLinguisticTaggerOmitWhitespace = 1 << 2, /* Omit tokens of type NSLinguisticTagWhitespace. */ NSLinguisticTaggerOmitOther = 1 << 3, /* Omit tokens of type NSLinguisticTagOther. */ NSLinguisticTaggerJoinNames = 1 << 4 /* Join tokens of tag scheme NSLinguisticTagSchemeNameType. */ }; NS_CLASS_AVAILABLE(10_7, 5_0) @interface NSLinguisticTagger : NSObject { @private NSArray *_schemes; NSUInteger _options; NSString *_string; id _orthographyArray; id _tokenArray; id _reserved; } /* An instance of NSLinguisticTagger is created with an array of tag schemes. The tagger will be able to supply tags corresponding to any of the schemes in this array. */ - (id)initWithTagSchemes:(NSArray *)tagSchemes options:(NSUInteger)opts NS_AVAILABLE(10_7, 5_0); - (NSArray *)tagSchemes NS_AVAILABLE(10_7, 5_0); - (void)setString:(NSString *)string NS_AVAILABLE(10_7, 5_0); - (NSString *)string NS_AVAILABLE(10_7, 5_0); /* Clients wishing to know the tag schemes supported in NSLinguisticTagger for a particular language may query them with this method. The language should be specified using a standard abbreviation as with NSOrthography. */ + (NSArray *)availableTagSchemesForLanguage:(NSString *)language NS_AVAILABLE(10_7, 5_0); /* If clients know the orthography for a given portion of the string, they may supply it to the tagger. Otherwise, the tagger will infer the language from the contents of the text. In each case, the charIndex or range passed in must not extend beyond the end of the tagger's string, or the methods will raise an exception. */ - (void)setOrthography:(NSOrthography *)orthography range:(NSRange)range NS_AVAILABLE(10_7, 5_0); - (NSOrthography *)orthographyAtIndex:(NSUInteger)charIndex effectiveRange:(NSRangePointer)effectiveRange NS_AVAILABLE(10_7, 5_0); /* If the string attached to the tagger is mutable, this method must be called to inform the tagger whenever the string changes. The newRange is the range in the final string which was explicitly edited, and delta is the change in length from the previous version to the current version of the string. Alternatively, the client may call setString: again to reset all information about the string, but this has the disadvantage of not preserving information about portions of the string that have not changed. */ - (void)stringEditedInRange:(NSRange)newRange changeInLength:(NSInteger)delta NS_AVAILABLE(10_7, 5_0); /* The tagger will segment the string as needed into sentences and tokens, and return those ranges along with a tag for any scheme in its array of tag schemes. The fundamental tagging method on NSLinguisticTagger is a block iterator, that iterates over all tokens intersecting a given range, supplying tags and ranges. There are several additional convenience methods, for obtaining a sentence range, information about a single token, or for obtaining information about all tokens intersecting a given range at once, in arrays. In each case, the charIndex or range passed in must not extend beyond the end of the tagger's string, or the methods will raise an exception. Note that a given instance of NSLinguisticTagger should not be used from more than one thread simultaneously. */ #if NS_BLOCKS_AVAILABLE - (void)enumerateTagsInRange:(NSRange)range scheme:(NSString *)tagScheme options:(NSLinguisticTaggerOptions)opts usingBlock:(void (^)(NSString *tag, NSRange tokenRange, NSRange sentenceRange, BOOL *stop))block NS_AVAILABLE(10_7, 5_0); #endif /* NS_BLOCKS_AVAILABLE */ - (NSRange)sentenceRangeForRange:(NSRange)range NS_AVAILABLE(10_7, 5_0); - (NSString *)tagAtIndex:(NSUInteger)charIndex scheme:(NSString *)tagScheme tokenRange:(NSRangePointer)tokenRange sentenceRange:(NSRangePointer)sentenceRange NS_AVAILABLE(10_7, 5_0); - (NSArray *)tagsInRange:(NSRange)range scheme:(NSString *)tagScheme options:(NSLinguisticTaggerOptions)opts tokenRanges:(NSArray **)tokenRanges NS_AVAILABLE(10_7, 5_0); - (NSArray *)possibleTagsAtIndex:(NSUInteger)charIndex scheme:(NSString *)tagScheme tokenRange:(NSRangePointer)tokenRange sentenceRange:(NSRangePointer)sentenceRange scores:(NSArray **)scores NS_AVAILABLE(10_7, 5_0); @end @interface NSString (NSLinguisticAnalysis) /* Clients wishing to analyze a given string once may use these NSString APIs without having to create an instance of NSLinguisticTagger. If more than one tagging operation is needed on a given string, it is more efficient to use an explicit NSLinguisticTagger instance. */ - (NSArray *)linguisticTagsInRange:(NSRange)range scheme:(NSString *)tagScheme options:(NSLinguisticTaggerOptions)opts orthography:(NSOrthography *)orthography tokenRanges:(NSArray **)tokenRanges NS_AVAILABLE(10_7, 5_0); #if NS_BLOCKS_AVAILABLE - (void)enumerateLinguisticTagsInRange:(NSRange)range scheme:(NSString *)tagScheme options:(NSLinguisticTaggerOptions)opts orthography:(NSOrthography *)orthography usingBlock:(void (^)(NSString *tag, NSRange tokenRange, NSRange sentenceRange, BOOL *stop))block NS_AVAILABLE(10_7, 5_0); #endif /* NS_BLOCKS_AVAILABLE */ @end /* NSLocale.h Copyright (c) 2003-2012, Apple Inc. All rights reserved. */ #import #import @class NSArray, NSDictionary, NSString; // Toll-free bridged with CFLocaleRef @interface NSLocale : NSObject - (id)objectForKey:(id)key; - (NSString *)displayNameForKey:(id)key value:(id)value; @end @interface NSLocale (NSExtendedLocale) - (NSString *)localeIdentifier; // same as NSLocaleIdentifier @end @interface NSLocale (NSLocaleCreation) + (id)systemLocale; + (id)currentLocale; + (id)autoupdatingCurrentLocale NS_AVAILABLE(10_5, 2_0); - (id)initWithLocaleIdentifier:(NSString *)string; @end @interface NSLocale (NSLocaleGeneralInfo) + (NSArray *)availableLocaleIdentifiers; + (NSArray *)ISOLanguageCodes; + (NSArray *)ISOCountryCodes; + (NSArray *)ISOCurrencyCodes; + (NSArray *)commonISOCurrencyCodes NS_AVAILABLE(10_5, 2_0); + (NSArray *)preferredLanguages NS_AVAILABLE(10_5, 2_0); + (NSDictionary *)componentsFromLocaleIdentifier:(NSString *)string; + (NSString *)localeIdentifierFromComponents:(NSDictionary *)dict; + (NSString *)canonicalLocaleIdentifierFromString:(NSString *)string; + (NSString *)canonicalLanguageIdentifierFromString:(NSString *)string; + (NSString *)localeIdentifierFromWindowsLocaleCode:(uint32_t)lcid NS_AVAILABLE(10_6, 4_0); + (uint32_t)windowsLocaleCodeFromLocaleIdentifier:(NSString *)localeIdentifier NS_AVAILABLE(10_6, 4_0); typedef NS_ENUM(NSUInteger, NSLocaleLanguageDirection) { NSLocaleLanguageDirectionUnknown = kCFLocaleLanguageDirectionUnknown, NSLocaleLanguageDirectionLeftToRight = kCFLocaleLanguageDirectionLeftToRight, NSLocaleLanguageDirectionRightToLeft = kCFLocaleLanguageDirectionRightToLeft, NSLocaleLanguageDirectionTopToBottom = kCFLocaleLanguageDirectionTopToBottom, NSLocaleLanguageDirectionBottomToTop = kCFLocaleLanguageDirectionBottomToTop }; + (NSLocaleLanguageDirection)characterDirectionForLanguage:(NSString *)isoLangCode NS_AVAILABLE(10_6, 4_0); + (NSLocaleLanguageDirection)lineDirectionForLanguage:(NSString *)isoLangCode NS_AVAILABLE(10_6, 4_0); @end FOUNDATION_EXPORT NSString * const NSCurrentLocaleDidChangeNotification NS_AVAILABLE(10_5, 2_0); FOUNDATION_EXPORT NSString * const NSLocaleIdentifier; // NSString FOUNDATION_EXPORT NSString * const NSLocaleLanguageCode; // NSString FOUNDATION_EXPORT NSString * const NSLocaleCountryCode; // NSString FOUNDATION_EXPORT NSString * const NSLocaleScriptCode; // NSString FOUNDATION_EXPORT NSString * const NSLocaleVariantCode; // NSString FOUNDATION_EXPORT NSString * const NSLocaleExemplarCharacterSet;// NSCharacterSet FOUNDATION_EXPORT NSString * const NSLocaleCalendar; // NSCalendar FOUNDATION_EXPORT NSString * const NSLocaleCollationIdentifier; // NSString FOUNDATION_EXPORT NSString * const NSLocaleUsesMetricSystem; // NSNumber boolean FOUNDATION_EXPORT NSString * const NSLocaleMeasurementSystem; // NSString FOUNDATION_EXPORT NSString * const NSLocaleDecimalSeparator; // NSString FOUNDATION_EXPORT NSString * const NSLocaleGroupingSeparator; // NSString FOUNDATION_EXPORT NSString * const NSLocaleCurrencySymbol; // NSString FOUNDATION_EXPORT NSString * const NSLocaleCurrencyCode; // NSString FOUNDATION_EXPORT NSString * const NSLocaleCollatorIdentifier NS_AVAILABLE(10_6, 4_0); // NSString FOUNDATION_EXPORT NSString * const NSLocaleQuotationBeginDelimiterKey NS_AVAILABLE(10_6, 4_0); // NSString FOUNDATION_EXPORT NSString * const NSLocaleQuotationEndDelimiterKey NS_AVAILABLE(10_6, 4_0); // NSString FOUNDATION_EXPORT NSString * const NSLocaleAlternateQuotationBeginDelimiterKey NS_AVAILABLE(10_6, 4_0); // NSString FOUNDATION_EXPORT NSString * const NSLocaleAlternateQuotationEndDelimiterKey NS_AVAILABLE(10_6, 4_0); // NSString // Values for NSCalendar identifiers (not the NSLocaleCalendar property key) FOUNDATION_EXPORT NSString * const NSGregorianCalendar; FOUNDATION_EXPORT NSString * const NSBuddhistCalendar; FOUNDATION_EXPORT NSString * const NSChineseCalendar; FOUNDATION_EXPORT NSString * const NSHebrewCalendar; FOUNDATION_EXPORT NSString * const NSIslamicCalendar; FOUNDATION_EXPORT NSString * const NSIslamicCivilCalendar; FOUNDATION_EXPORT NSString * const NSJapaneseCalendar; FOUNDATION_EXPORT NSString * const NSRepublicOfChinaCalendar NS_AVAILABLE(10_6, 4_0); FOUNDATION_EXPORT NSString * const NSPersianCalendar NS_AVAILABLE(10_6, 4_0); FOUNDATION_EXPORT NSString * const NSIndianCalendar NS_AVAILABLE(10_6, 4_0); FOUNDATION_EXPORT NSString * const NSISO8601Calendar NS_AVAILABLE(10_6, 4_0); /* NSLock.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import @class NSDate; @protocol NSLocking - (void)lock; - (void)unlock; @end @interface NSLock : NSObject { @private void *_priv; } - (BOOL)tryLock; - (BOOL)lockBeforeDate:(NSDate *)limit; - (void)setName:(NSString *)n NS_AVAILABLE(10_5, 2_0); - (NSString *)name NS_AVAILABLE(10_5, 2_0); @end @interface NSConditionLock : NSObject { @private void *_priv; } - (id)initWithCondition:(NSInteger)condition; - (NSInteger)condition; - (void)lockWhenCondition:(NSInteger)condition; - (BOOL)tryLock; - (BOOL)tryLockWhenCondition:(NSInteger)condition; - (void)unlockWithCondition:(NSInteger)condition; - (BOOL)lockBeforeDate:(NSDate *)limit; - (BOOL)lockWhenCondition:(NSInteger)condition beforeDate:(NSDate *)limit; - (void)setName:(NSString *)n NS_AVAILABLE(10_5, 2_0); - (NSString *)name NS_AVAILABLE(10_5, 2_0); @end @interface NSRecursiveLock : NSObject { @private void *_priv; } - (BOOL)tryLock; - (BOOL)lockBeforeDate:(NSDate *)limit; - (void)setName:(NSString *)n NS_AVAILABLE(10_5, 2_0); - (NSString *)name NS_AVAILABLE(10_5, 2_0); @end NS_CLASS_AVAILABLE(10_5, 2_0) @interface NSCondition : NSObject { @private void *_priv; } - (void)wait; - (BOOL)waitUntilDate:(NSDate *)limit; - (void)signal; - (void)broadcast; - (void)setName:(NSString *)n; - (NSString *)name; @end /* NSMapTable.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import #import #import #if !defined(__FOUNDATION_NSMAPTABLE__) #define __FOUNDATION_NSMAPTABLE__ 1 @class NSArray, NSDictionary, NSMapTable; /**************** Class ****************/ /* An NSMapTable is modeled after a dictionary, although, because of its options, is not a dictionary because it will behave differently. The major option is to have keys and/or values held "weakly" in a manner that entries are removed when one of the objects is reclaimed. In addition to being held weakly, keys or values may be copied on input or may use pointer identity for equality and hashing. An NSMapTable can also be configured to operate on arbitrary pointers and not just objects. We recommend the C function API for "void *" access. To configure for pointer use, consult and choose the appropriate NSPointerFunction options or configure and use NSPointerFunctions objects directly for initialization. */ enum { NSMapTableStrongMemory NS_ENUM_AVAILABLE(10_5, 6_0) = 0, // NSPointerFunctionsStrongMemory #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || TARGET_OS_WIN32 NSMapTableZeroingWeakMemory NS_ENUM_DEPRECATED_MAC(10_5, 10_8) = NSPointerFunctionsZeroingWeakMemory, #endif NSMapTableCopyIn NS_ENUM_AVAILABLE(10_5, 6_0) = NSPointerFunctionsCopyIn, NSMapTableObjectPointerPersonality NS_ENUM_AVAILABLE(10_5, 6_0) = NSPointerFunctionsObjectPointerPersonality, NSMapTableWeakMemory NS_ENUM_AVAILABLE(10_8, 6_0) = NSPointerFunctionsWeakMemory }; typedef NSUInteger NSMapTableOptions; NS_CLASS_AVAILABLE(10_5, 6_0) @interface NSMapTable : NSObject - (id)initWithKeyOptions:(NSPointerFunctionsOptions)keyOptions valueOptions:(NSPointerFunctionsOptions)valueOptions capacity:(NSUInteger)initialCapacity; - (id)initWithKeyPointerFunctions:(NSPointerFunctions *)keyFunctions valuePointerFunctions:(NSPointerFunctions *)valueFunctions capacity:(NSUInteger)initialCapacity; + (id)mapTableWithKeyOptions:(NSPointerFunctionsOptions)keyOptions valueOptions:(NSPointerFunctionsOptions)valueOptions; #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || TARGET_OS_WIN32 + (id)mapTableWithStrongToStrongObjects NS_DEPRECATED_MAC(10_5, 10_8); + (id)mapTableWithWeakToStrongObjects NS_DEPRECATED_MAC(10_5, 10_8); + (id)mapTableWithStrongToWeakObjects NS_DEPRECATED_MAC(10_5, 10_8); + (id)mapTableWithWeakToWeakObjects NS_DEPRECATED_MAC(10_5, 10_8); #endif + (id)strongToStrongObjectsMapTable NS_AVAILABLE(10_8, 6_0); + (id)weakToStrongObjectsMapTable NS_AVAILABLE(10_8, 6_0); + (id)strongToWeakObjectsMapTable NS_AVAILABLE(10_8, 6_0); + (id)weakToWeakObjectsMapTable NS_AVAILABLE(10_8, 6_0); /* return an NSPointerFunctions object reflecting the functions in use. This is a new autoreleased object that can be subsequently modified and/or used directly in the creation of other pointer "collections". */ - (NSPointerFunctions *)keyPointerFunctions; - (NSPointerFunctions *)valuePointerFunctions; - (id)objectForKey:(id)aKey; - (void)removeObjectForKey:(id)aKey; - (void)setObject:(id)anObject forKey:(id)aKey; // add/replace value (CFDictionarySetValue, NSMapInsert) - (NSUInteger)count; - (NSEnumerator *)keyEnumerator; - (NSEnumerator *)objectEnumerator; - (void)removeAllObjects; - (NSDictionary *)dictionaryRepresentation; // create a dictionary of contents @end #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || TARGET_OS_WIN32 /**************** void * Map table operations ****************/ typedef struct {NSUInteger _pi; NSUInteger _si; void *_bs;} NSMapEnumerator; FOUNDATION_EXPORT void NSFreeMapTable(NSMapTable *table); FOUNDATION_EXPORT void NSResetMapTable(NSMapTable *table); FOUNDATION_EXPORT BOOL NSCompareMapTables(NSMapTable *table1, NSMapTable *table2); FOUNDATION_EXPORT NSMapTable *NSCopyMapTableWithZone(NSMapTable *table, NSZone *zone); FOUNDATION_EXPORT BOOL NSMapMember(NSMapTable *table, const void *key, void **originalKey, void **value); FOUNDATION_EXPORT void *NSMapGet(NSMapTable *table, const void *key); FOUNDATION_EXPORT void NSMapInsert(NSMapTable *table, const void *key, const void *value); FOUNDATION_EXPORT void NSMapInsertKnownAbsent(NSMapTable *table, const void *key, const void *value); FOUNDATION_EXPORT void *NSMapInsertIfAbsent(NSMapTable *table, const void *key, const void *value); FOUNDATION_EXPORT void NSMapRemove(NSMapTable *table, const void *key); FOUNDATION_EXPORT NSMapEnumerator NSEnumerateMapTable(NSMapTable *table); FOUNDATION_EXPORT BOOL NSNextMapEnumeratorPair(NSMapEnumerator *enumerator, void **key, void **value); FOUNDATION_EXPORT void NSEndMapTableEnumeration(NSMapEnumerator *enumerator); FOUNDATION_EXPORT NSUInteger NSCountMapTable(NSMapTable *table); FOUNDATION_EXPORT NSString *NSStringFromMapTable(NSMapTable *table); FOUNDATION_EXPORT NSArray *NSAllMapTableKeys(NSMapTable *table); FOUNDATION_EXPORT NSArray *NSAllMapTableValues(NSMapTable *table); /**************** Legacy ***************************************/ typedef struct { NSUInteger (*hash)(NSMapTable *table, const void *); BOOL (*isEqual)(NSMapTable *table, const void *, const void *); void (*retain)(NSMapTable *table, const void *); void (*release)(NSMapTable *table, void *); NSString *(*describe)(NSMapTable *table, const void *); const void *notAKeyMarker; } NSMapTableKeyCallBacks; #define NSNotAnIntMapKey ((const void *)NSIntegerMin) #define NSNotAnIntegerMapKey ((const void *)NSIntegerMin) #define NSNotAPointerMapKey ((const void *)UINTPTR_MAX) typedef struct { void (*retain)(NSMapTable *table, const void *); void (*release)(NSMapTable *table, void *); NSString *(*describe)(NSMapTable *table, const void *); } NSMapTableValueCallBacks; FOUNDATION_EXPORT NSMapTable *NSCreateMapTableWithZone(NSMapTableKeyCallBacks keyCallBacks, NSMapTableValueCallBacks valueCallBacks, NSUInteger capacity, NSZone *zone); FOUNDATION_EXPORT NSMapTable *NSCreateMapTable(NSMapTableKeyCallBacks keyCallBacks, NSMapTableValueCallBacks valueCallBacks, NSUInteger capacity); /**************** Common map table key callbacks ****************/ FOUNDATION_EXPORT const NSMapTableKeyCallBacks NSIntegerMapKeyCallBacks NS_AVAILABLE_MAC(10_5); FOUNDATION_EXPORT const NSMapTableKeyCallBacks NSNonOwnedPointerMapKeyCallBacks; FOUNDATION_EXPORT const NSMapTableKeyCallBacks NSNonOwnedPointerOrNullMapKeyCallBacks; FOUNDATION_EXPORT const NSMapTableKeyCallBacks NSNonRetainedObjectMapKeyCallBacks; FOUNDATION_EXPORT const NSMapTableKeyCallBacks NSObjectMapKeyCallBacks; FOUNDATION_EXPORT const NSMapTableKeyCallBacks NSOwnedPointerMapKeyCallBacks; FOUNDATION_EXPORT const NSMapTableKeyCallBacks NSIntMapKeyCallBacks NS_DEPRECATED_MAC(10_0, 10_5); /**************** Common map table value callbacks ****************/ FOUNDATION_EXPORT const NSMapTableValueCallBacks NSIntegerMapValueCallBacks NS_AVAILABLE_MAC(10_5); FOUNDATION_EXPORT const NSMapTableValueCallBacks NSNonOwnedPointerMapValueCallBacks; FOUNDATION_EXPORT const NSMapTableValueCallBacks NSObjectMapValueCallBacks; FOUNDATION_EXPORT const NSMapTableValueCallBacks NSNonRetainedObjectMapValueCallBacks; FOUNDATION_EXPORT const NSMapTableValueCallBacks NSOwnedPointerMapValueCallBacks; FOUNDATION_EXPORT const NSMapTableValueCallBacks NSIntMapValueCallBacks NS_DEPRECATED_MAC(10_0, 10_5); #else #if defined(__has_include) #if __has_include() #include #endif #endif #endif #endif /* NSMetadata.h Copyright (c) 2004-2012, Apple Inc. All rights reserved. */ #import #import @class NSString, NSArray, NSDictionary, NSPredicate; @class NSMetadataItem, NSMetadataQueryAttributeValueTuple, NSMetadataQueryResultGroup; @protocol NSMetadataQueryDelegate; NS_CLASS_AVAILABLE(10_4, 5_0) @interface NSMetadataQuery : NSObject { @private NSUInteger _flags; NSTimeInterval _interval; id _private[11]; __strong void *_reserved; } - (id)init; - (id )delegate; - (void)setDelegate:(id )delegate; - (NSPredicate *)predicate; - (void)setPredicate:(NSPredicate *)predicate; - (NSArray *)sortDescriptors; - (void)setSortDescriptors:(NSArray *)descriptors; - (NSArray *)valueListAttributes; - (void)setValueListAttributes:(NSArray *)attrs; - (NSArray *)groupingAttributes; - (void)setGroupingAttributes:(NSArray *)attrs; - (NSTimeInterval)notificationBatchingInterval; - (void)setNotificationBatchingInterval:(NSTimeInterval)ti; - (NSArray *)searchScopes; - (void)setSearchScopes:(NSArray *)scopes; // scopes is an NSArray of NSURL objects (file URLs only) and/or string // paths and/or the special string constants below, which specifies the // locations to which the search is limited; an empty array means no // limits, which is the default state. - (BOOL)startQuery; - (void)stopQuery; - (BOOL)isStarted; - (BOOL)isGathering; - (BOOL)isStopped; - (void)disableUpdates; // these nest - (void)enableUpdates; // Results are NSMetadataItems, or whatever the delegate replaces that with - (NSUInteger)resultCount; - (id)resultAtIndex:(NSUInteger)idx; - (NSArray *)results; // this is for K-V Bindings, and causes side-effects on the query - (NSUInteger)indexOfResult:(id)result; - (NSDictionary *)valueLists; // values are arrays of NSMetadataQueryAttributeValueTuple - (NSArray *)groupedResults; // array of NSMetadataQueryResultGroups, for first grouping attribute - (id)valueOfAttribute:(NSString *)attrName forResultAtIndex:(NSUInteger)idx; @end @protocol NSMetadataQueryDelegate @optional - (id)metadataQuery:(NSMetadataQuery *)query replacementObjectForResultObject:(NSMetadataItem *)result; - (id)metadataQuery:(NSMetadataQuery *)query replacementValueForAttribute:(NSString *)attrName value:(id)attrValue; @end // There is no info associated with these notifications FOUNDATION_EXPORT NSString * const NSMetadataQueryDidStartGatheringNotification NS_AVAILABLE(10_4, 5_0); FOUNDATION_EXPORT NSString * const NSMetadataQueryGatheringProgressNotification NS_AVAILABLE(10_4, 5_0); FOUNDATION_EXPORT NSString * const NSMetadataQueryDidFinishGatheringNotification NS_AVAILABLE(10_4, 5_0); FOUNDATION_EXPORT NSString * const NSMetadataQueryDidUpdateNotification NS_AVAILABLE(10_4, 5_0); FOUNDATION_EXPORT NSString * const NSMetadataQueryResultContentRelevanceAttribute NS_AVAILABLE(10_4, 5_0); // Scope constants for defined search locations FOUNDATION_EXPORT NSString * const NSMetadataQueryUserHomeScope NS_AVAILABLE_MAC(10_4); // user home directory FOUNDATION_EXPORT NSString * const NSMetadataQueryLocalComputerScope NS_AVAILABLE_MAC(10_4); // all local mounted volumes + user home (even if remote) FOUNDATION_EXPORT NSString * const NSMetadataQueryNetworkScope NS_AVAILABLE_MAC(10_4); // all user-mounted remote volumes // -setSearchScopes: will throw an exception if the given array contains a mix of the scope constants below with constants above. FOUNDATION_EXPORT NSString * const NSMetadataQueryUbiquitousDocumentsScope NS_AVAILABLE(10_7, 5_0); // "Documents" subdirectory in the application's Ubiquity container FOUNDATION_EXPORT NSString * const NSMetadataQueryUbiquitousDataScope NS_AVAILABLE(10_7, 5_0); // application's Ubiquity container, excluding the "Documents" subdirectory NS_CLASS_AVAILABLE(10_4, 5_0) @interface NSMetadataItem : NSObject { @private id _item; __strong void *_reserved; } - (id)valueForAttribute:(NSString *)key; - (NSDictionary *)valuesForAttributes:(NSArray *)keys; - (NSArray *)attributes; @end NS_CLASS_AVAILABLE(10_4, 5_0) @interface NSMetadataQueryAttributeValueTuple : NSObject { @private id _attr; id _value; NSUInteger _count; void *_reserved; } - (NSString *)attribute; - (id)value; - (NSUInteger)count; @end NS_CLASS_AVAILABLE(10_4, 5_0) @interface NSMetadataQueryResultGroup : NSObject { @private id _private[9]; NSUInteger _private2[1]; void *_reserved; } - (NSString *)attribute; - (id)value; - (NSArray *)subgroups; // nil if this is a leaf - (NSUInteger)resultCount; - (id)resultAtIndex:(NSUInteger)idx; // uncertain whether this will do anything useful for non-leaf groups - (NSArray *)results; // this is for K-V Bindings, and causes side-effects on the query @end // The following NSMetadataItem attributes are available on Mac OS and iOS. See for more attribute names on Mac OS. FOUNDATION_EXPORT NSString * const NSMetadataItemFSNameKey NS_AVAILABLE(10_7, 5_0); // NSString FOUNDATION_EXPORT NSString * const NSMetadataItemDisplayNameKey NS_AVAILABLE(10_7, 5_0); // NSString FOUNDATION_EXPORT NSString * const NSMetadataItemURLKey NS_AVAILABLE(10_7, 5_0); // NSURL FOUNDATION_EXPORT NSString * const NSMetadataItemPathKey NS_AVAILABLE(10_7, 5_0); // NSString FOUNDATION_EXPORT NSString * const NSMetadataItemFSSizeKey NS_AVAILABLE(10_7, 5_0); // file size in bytes; unsigned long long NSNumber FOUNDATION_EXPORT NSString * const NSMetadataItemFSCreationDateKey NS_AVAILABLE(10_7, 5_0); // NSDate FOUNDATION_EXPORT NSString * const NSMetadataItemFSContentChangeDateKey NS_AVAILABLE(10_7, 5_0); // NSDate FOUNDATION_EXPORT NSString * const NSMetadataItemIsUbiquitousKey NS_AVAILABLE(10_7, 5_0); // boolean NSNumber FOUNDATION_EXPORT NSString * const NSMetadataUbiquitousItemHasUnresolvedConflictsKey NS_AVAILABLE(10_7, 5_0); // boolean NSNumber FOUNDATION_EXPORT NSString * const NSMetadataUbiquitousItemIsDownloadedKey NS_AVAILABLE(10_7, 5_0); // boolean NSNumber FOUNDATION_EXPORT NSString * const NSMetadataUbiquitousItemIsDownloadingKey NS_AVAILABLE(10_7, 5_0); // boolean NSNumber FOUNDATION_EXPORT NSString * const NSMetadataUbiquitousItemIsUploadedKey NS_AVAILABLE(10_7, 5_0); // boolean NSNumber FOUNDATION_EXPORT NSString * const NSMetadataUbiquitousItemIsUploadingKey NS_AVAILABLE(10_7, 5_0); // boolean NSNumber FOUNDATION_EXPORT NSString * const NSMetadataUbiquitousItemPercentDownloadedKey NS_AVAILABLE(10_7, 5_0); // double NSNumber; range [0..100] FOUNDATION_EXPORT NSString * const NSMetadataUbiquitousItemPercentUploadedKey NS_AVAILABLE(10_7, 5_0); // double NSNumber; range [0..100] /* NSMethodSignature.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import @interface NSMethodSignature : NSObject { @private void *_private; void *_reserved[6]; } + (NSMethodSignature *)signatureWithObjCTypes:(const char *)types; - (NSUInteger)numberOfArguments; - (const char *)getArgumentTypeAtIndex:(NSUInteger)idx NS_RETURNS_INNER_POINTER; - (NSUInteger)frameLength; - (BOOL)isOneway; - (const char *)methodReturnType NS_RETURNS_INNER_POINTER; - (NSUInteger)methodReturnLength; @end /* NSNetServices.h Copyright (c) 2002-2012, Apple Inc. All rights reserved. */ #import #import @class NSArray, NSData, NSDictionary, NSInputStream, NSOutputStream, NSRunLoop, NSString; @protocol NSNetServiceDelegate, NSNetServiceBrowserDelegate; #pragma mark Error constants FOUNDATION_EXPORT NSString * const NSNetServicesErrorCode; FOUNDATION_EXPORT NSString * const NSNetServicesErrorDomain; typedef NS_ENUM(NSInteger, NSNetServicesError) { /* An unknown error occured during resolution or publication. */ NSNetServicesUnknownError = -72000L, /* An NSNetService with the same domain, type and name was already present when the publication request was made. */ NSNetServicesCollisionError = -72001L, /* The NSNetService was not found when a resolution request was made. */ NSNetServicesNotFoundError = -72002L, /* A publication or resolution request was sent to an NSNetService instance which was already published or a search request was made of an NSNetServiceBrowser instance which was already searching. */ NSNetServicesActivityInProgress = -72003L, /* An required argument was not provided when initializing the NSNetService instance. */ NSNetServicesBadArgumentError = -72004L, /* The operation being performed by the NSNetService or NSNetServiceBrowser instance was cancelled. */ NSNetServicesCancelledError = -72005L, /* An invalid argument was provided when initializing the NSNetService instance or starting a search with an NSNetServiceBrowser instance. */ NSNetServicesInvalidError = -72006L, /* Resolution of an NSNetService instance failed because the timeout was reached. */ NSNetServicesTimeoutError = -72007L, }; typedef NS_OPTIONS(NSUInteger, NSNetServiceOptions) { /* When passed to -publishWithOptions, this suppresses the auto-renaming of an NSNetService in the event of a name collision. The collision is reported to the instance's delegate on the netService:didNotPublish: method. */ NSNetServiceNoAutoRename = 1UL << 0 }; #pragma mark - @interface NSNetService : NSObject { @private id _netService; id _delegate; id _reserved; } /* This is the initializer for publishing. You should use this initializer if you are going to announce the availability of a service on the network. To publish a service in all available domains, pass the empty string as the domain. */ - (id)initWithDomain:(NSString *)domain type:(NSString *)type name:(NSString *)name port:(int)port; /* This is the initializer for resolution. If you know the domain, type and name of the service for which you wish to discover addresses, you should initialize an NSNetService instance using this method and call resolve: on the result. If you wish to connect to this service immediately, you should call getInputStream:getOutputStream: on the result and forego the resolution step entirely. If publish: is called on an NSNetService instance initialized with this method, an NSNetServicesBadArgumentError will be sent in the error dictionary to the delegate's netService:didNotPublish: method. */ - (id)initWithDomain:(NSString *)domain type:(NSString *)type name:(NSString *)name; - (id )delegate; - (void)setDelegate:(id )delegate; /* NSNetService instances may be scheduled on NSRunLoops to operate in different modes, or in other threads. It is generally not necessary to schedule NSNetServices in other threads. NSNetServices are scheduled in the current thread's NSRunLoop in the NSDefaultRunLoopMode when they are created. */ - (void)scheduleInRunLoop:(NSRunLoop *)aRunLoop forMode:(NSString *)mode; - (void)removeFromRunLoop:(NSRunLoop *)aRunLoop forMode:(NSString *)mode; /* Returns the domain of the discovered or published service. */ - (NSString *)domain; /* Returns the type of the discovered or published service. */ - (NSString *)type; /* Returns the name of the discovered or published service. */ - (NSString *)name; /* The addresses of the service. This is an NSArray of NSData instances, each of which contains a single struct sockaddr suitable for use with connect(2). In the event that no addresses are resolved for the service or the service has not yet been resolved, an empty NSArray is returned. */ - (NSArray *)addresses; /* The port of a resolved service. This returns -1 if the service has not been resolved. */ - (NSInteger)port NS_AVAILABLE(10_5, 2_0); /* Advertises a given service on the network. This method returns immediately. Success or failure is indicated by callbacks to the NSNetService instance's delegate. If the name of the service is the default name (@""), then the service will be renamed automatically. If the name of the service has been specified, then the service will not be renamed automatically. If more control over renaming is required, then -[NSNetService publishWithOptions:] is available. */ - (void)publish; /* Advertises a given service on the network. This method returns immediately. Success or failure is indicated by callbacks to the NSNetService instance's delegate. See the notes above for NSNetServiceNoAutoRename for information about controlling the auto-renaming behavior using this method. */ - (void)publishWithOptions:(NSNetServiceOptions)options NS_AVAILABLE(10_5, 2_0); /* Attempts to determine at least one address for the NSNetService instance. For applications linked on or after Mac OS X 10.4 "Tiger", this method calls -resolveWithTimeout: with a value of 5.0. Applications linked prior to Mac OS X 10.4 "Tiger" must call -stop on the instance after an appropriate (short) amount of time to avoid causing unnecessary network traffic. */ - (void)resolve NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); /* Halts a service which is either publishing or resolving. */ - (void)stop; /* Returns an NSDictionary created from the provided NSData. The keys will be UTF8-encoded NSStrings. The values are NSDatas. The caller is responsible for interpreting these as types appropriate to the keys. If the NSData cannot be converted into an appropriate NSDictionary, this method will return nil. For applications linked on or after Mac OS X 10.5, this method will throw an NSInvalidException if it is passed nil as the argument. */ + (NSDictionary *)dictionaryFromTXTRecordData:(NSData *)txtData; /* Returns an NSData created from the provided dictionary. The keys in the provided dictionary must be NSStrings, and the values must be NSDatas. If the dictionary cannot be converted into an NSData suitable for a TXT record, this method will return nil. For applications linked on or after Mac OS X 10.5, this method will throw an NSInvalidArgumentException if it is passed nil as the argument. */ + (NSData *)dataFromTXTRecordDictionary:(NSDictionary *)txtDictionary; /* Returns the DNS host name of the computer hosting the discovered or published service. If a successful resolve has not yet occurred, this method will return nil. */ - (NSString *)hostName; /* Starts a resolve for the NSNetService instance of the specified duration. If the delegate's -netServiceDidResolveAddress: method is called before the timeout expires, the resolve is successful. If the timeout is reached, the delegate's -netService:didNotResolve: method will be called. The value of the NSNetServicesErrorCode key in the error dictionary will be NSNetServicesTimeoutError. */ - (void)resolveWithTimeout:(NSTimeInterval)timeout; /* Retrieves streams from the NSNetService instance. The instance's delegate methods are not called. Returns YES if the streams requested are created successfully. Returns NO if or any reason the stream could not be created. If only one stream is desired, pass NULL for the address of the other stream. The streams that are created are not open, and are not scheduled in any run loop for any mode. */ - (BOOL)getInputStream:(out __strong NSInputStream **)inputStream outputStream:(out __strong NSOutputStream **)outputStream; /* Sets the TXT record of the NSNetService instance that has been or will be published. Pass nil to remove the TXT record from the instance. */ - (BOOL)setTXTRecordData:(NSData *)recordData; /* Returns the raw TXT record of the NSNetService instance. If the instance has not been resolved, or the delegate's -netService:didUpdateTXTRecordData: has not been called, this will return nil. It is permitted to have a zero-length TXT record. */ - (NSData *)TXTRecordData; /* Starts monitoring the NSNetService instance for events. In Mac OS X 10.4 Tiger, monitored NSNetService instances inform their delegates of changes to the instance's TXT record by calling the delegate's -netService:didUpdateTXTRecordData: method. */ - (void)startMonitoring; /* Stops monitoring the NSNetService instance for events. */ - (void)stopMonitoring; @end #pragma mark - @interface NSNetServiceBrowser : NSObject { @private id _netServiceBrowser; id _delegate; void * _reserved; } - (id)init; - (id )delegate; - (void)setDelegate:(id )delegate; /* NSNetServiceBrowser instances may be scheduled on NSRunLoops to operate in different modes, or in other threads. It is generally not necessary to schedule NSNetServiceBrowsers in other threads. NSNetServiceBrowsers are scheduled in the current thread's NSRunLoop in the NSDefaultRunLoopMode when they are created. */ - (void)scheduleInRunLoop:(NSRunLoop *)aRunLoop forMode:(NSString *)mode; - (void)removeFromRunLoop:(NSRunLoop *)aRunLoop forMode:(NSString *)mode; /* Starts a search for domains that are browsable via Bonjour and the computer's network configuration. Discovered domains are reported to the delegate's -netServiceBrowser:didFindDomain:moreComing: method. There may be more than one browsable domain. */ - (void)searchForBrowsableDomains; /* Starts a search for domains in which the network configuration allows registration (i.e. publishing). Most NSNetServiceBrowser clients do not need to use this API, as it is sufficient to publish an NSNetService instance with the empty string (see -[NSNetService initWithDomain:type:name:port:]). Discovered domains are reported to the delegate's -netServiceBrowser:didFindDomain:moreComing: method. There may be more than one registration domain. */ - (void)searchForRegistrationDomains; /* Starts a search for services of the specified type in the domain indicated by domainString. For each service discovered, a -netServiceBrowser:foundService:moreComing: message is sent to the NSNetServiceBrowser instance's delegate. */ - (void)searchForServicesOfType:(NSString *)type inDomain:(NSString *)domainString; /* Stops the currently running search. */ - (void)stop; @end #pragma mark - @protocol NSNetServiceDelegate @optional /* Sent to the NSNetService instance's delegate prior to advertising the service on the network. If for some reason the service cannot be published, the delegate will not receive this message, and an error will be delivered to the delegate via the delegate's -netService:didNotPublish: method. */ - (void)netServiceWillPublish:(NSNetService *)sender; /* Sent to the NSNetService instance's delegate when the publication of the instance is complete and successful. */ - (void)netServiceDidPublish:(NSNetService *)sender; /* Sent to the NSNetService instance's delegate when an error in publishing the instance occurs. The error dictionary will contain two key/value pairs representing the error domain and code (see the NSNetServicesError enumeration above for error code constants). It is possible for an error to occur after a successful publication. */ - (void)netService:(NSNetService *)sender didNotPublish:(NSDictionary *)errorDict; /* Sent to the NSNetService instance's delegate prior to resolving a service on the network. If for some reason the resolution cannot occur, the delegate will not receive this message, and an error will be delivered to the delegate via the delegate's -netService:didNotResolve: method. */ - (void)netServiceWillResolve:(NSNetService *)sender; /* Sent to the NSNetService instance's delegate when one or more addresses have been resolved for an NSNetService instance. Some NSNetService methods will return different results before and after a successful resolution. An NSNetService instance may get resolved more than once; truly robust clients may wish to resolve again after an error, or to resolve more than once. */ - (void)netServiceDidResolveAddress:(NSNetService *)sender; /* Sent to the NSNetService instance's delegate when an error in resolving the instance occurs. The error dictionary will contain two key/value pairs representing the error domain and code (see the NSNetServicesError enumeration above for error code constants). */ - (void)netService:(NSNetService *)sender didNotResolve:(NSDictionary *)errorDict; /* Sent to the NSNetService instance's delegate when the instance's previously running publication or resolution request has stopped. */ - (void)netServiceDidStop:(NSNetService *)sender; /* Sent to the NSNetService instance's delegate when the instance is being monitored and the instance's TXT record has been updated. The new record is contained in the data parameter. */ - (void)netService:(NSNetService *)sender didUpdateTXTRecordData:(NSData *)data; @end #pragma mark - @protocol NSNetServiceBrowserDelegate @optional /* Sent to the NSNetServiceBrowser instance's delegate before the instance begins a search. The delegate will not receive this message if the instance is unable to begin a search. Instead, the delegate will receive the -netServiceBrowser:didNotSearch: message. */ - (void)netServiceBrowserWillSearch:(NSNetServiceBrowser *)aNetServiceBrowser; /* Sent to the NSNetServiceBrowser instance's delegate when the instance's previous running search request has stopped. */ - (void)netServiceBrowserDidStopSearch:(NSNetServiceBrowser *)aNetServiceBrowser; /* Sent to the NSNetServiceBrowser instance's delegate when an error in searching for domains or services has occurred. The error dictionary will contain two key/value pairs representing the error domain and code (see the NSNetServicesError enumeration above for error code constants). It is possible for an error to occur after a search has been started successfully. */ - (void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser didNotSearch:(NSDictionary *)errorDict; /* Sent to the NSNetServiceBrowser instance's delegate for each domain discovered. If there are more domains, moreComing will be YES. If for some reason handling discovered domains requires significant processing, accumulating domains until moreComing is NO and then doing the processing in bulk fashion may be desirable. */ - (void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser didFindDomain:(NSString *)domainString moreComing:(BOOL)moreComing; /* Sent to the NSNetServiceBrowser instance's delegate for each service discovered. If there are more services, moreComing will be YES. If for some reason handling discovered services requires significant processing, accumulating services until moreComing is NO and then doing the processing in bulk fashion may be desirable. */ - (void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser didFindService:(NSNetService *)aNetService moreComing:(BOOL)moreComing; /* Sent to the NSNetServiceBrowser instance's delegate when a previously discovered domain is no longer available. */ - (void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser didRemoveDomain:(NSString *)domainString moreComing:(BOOL)moreComing; /* Sent to the NSNetServiceBrowser instance's delegate when a previously discovered service is no longer published. */ - (void)netServiceBrowser:(NSNetServiceBrowser *)aNetServiceBrowser didRemoveService:(NSNetService *)aNetService moreComing:(BOOL)moreComing; @end #pragma mark - #pragma mark Deprecated API #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) /* Methods in these categories are provided for binary compatibility only. */ @interface NSNetService (NSDeprecated) /* Returns an NSString representing the TXT record or nil if there is none. This string may or may not be the full TXT record. This method is deprecated on Mac OS X 10.4 "Tiger" and later; use -TXTRecordData instead. */ - (NSString *)protocolSpecificInformation NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); /* Sets the TXT record of the NSNetService instance to be the provided string. It is the caller's responsibility to ensure the string is of the appropriate format with the correct encoding. This method is deprecated on Mac OS X 10.4 "Tiger" and later; use -setTXTRecordData: instead. */ - (void)setProtocolSpecificInformation:(NSString *)specificInformation NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); @end @interface NSNetServiceBrowser (NSDeprecated) /* Starts a search for any domain visible to the host based on network configuration. Discovered domains are reported to the delegate's -netServiceBrowser:didFindDomain:moreComing: method. These may be domains in which it is not possible to register. This method is deprecated on Mac OS X 10.4 "Tiger" and later; use -searchForBrowsableDomains or -searchForRegistrationDomains instead. */ - (void)searchForAllDomains NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); @end #endif /* NSNotification.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import @class NSString, NSDictionary, NSOperationQueue; /**************** Notifications ****************/ @interface NSNotification : NSObject - (NSString *)name; - (id)object; - (NSDictionary *)userInfo; @end @interface NSNotification (NSNotificationCreation) + (id)notificationWithName:(NSString *)aName object:(id)anObject; + (id)notificationWithName:(NSString *)aName object:(id)anObject userInfo:(NSDictionary *)aUserInfo; @end /**************** Notification Center ****************/ @interface NSNotificationCenter : NSObject { @package void * __strong _impl; void * __strong _callback; void *_pad[11]; } + (id)defaultCenter; - (void)addObserver:(id)observer selector:(SEL)aSelector name:(NSString *)aName object:(id)anObject; - (void)postNotification:(NSNotification *)notification; - (void)postNotificationName:(NSString *)aName object:(id)anObject; - (void)postNotificationName:(NSString *)aName object:(id)anObject userInfo:(NSDictionary *)aUserInfo; - (void)removeObserver:(id)observer; - (void)removeObserver:(id)observer name:(NSString *)aName object:(id)anObject; #if NS_BLOCKS_AVAILABLE - (id)addObserverForName:(NSString *)name object:(id)obj queue:(NSOperationQueue *)queue usingBlock:(void (^)(NSNotification *note))block NS_AVAILABLE(10_6, 4_0); // The return value is retained by the system, and should be held onto by the caller in // order to remove the observer with removeObserver: later, to stop observation. #endif @end /* NSNotificationQueue.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import @class NSNotification, NSNotificationCenter, NSArray; typedef NS_ENUM(NSUInteger, NSPostingStyle) { NSPostWhenIdle = 1, NSPostASAP = 2, NSPostNow = 3 }; typedef NS_ENUM(NSUInteger, NSNotificationCoalescing) { NSNotificationNoCoalescing = 0, NSNotificationCoalescingOnName = 1, NSNotificationCoalescingOnSender = 2 }; @interface NSNotificationQueue : NSObject { @private id _notificationCenter; id _asapQueue; id _asapObs; id _idleQueue; id _idleObs; } + (id)defaultQueue; - (id)initWithNotificationCenter:(NSNotificationCenter *)notificationCenter; - (void)enqueueNotification:(NSNotification *)notification postingStyle:(NSPostingStyle)postingStyle; - (void)enqueueNotification:(NSNotification *)notification postingStyle:(NSPostingStyle)postingStyle coalesceMask:(NSUInteger)coalesceMask forModes:(NSArray *)modes; - (void)dequeueNotificationsMatching:(NSNotification *)notification coalesceMask:(NSUInteger)coalesceMask; @end /* NSNull.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import @interface NSNull : NSObject + (NSNull *)null; @end /* NSNumberFormatter.h Copyright (c) 1996-2012, Apple Inc. All rights reserved. */ #import #include @class NSLocale, NSError, NSMutableDictionary; @interface NSNumberFormatter : NSFormatter { @private NSMutableDictionary *_attributes; __strong CFNumberFormatterRef _formatter; NSUInteger _counter; void *_reserved[12]; } // - (id)init; // designated initializer // Report the used range of the string and an NSError, in addition to the usual stuff from NSFormatter - (BOOL)getObjectValue:(out id *)obj forString:(NSString *)string range:(inout NSRange *)rangep error:(out NSError **)error; // Even though NSNumberFormatter responds to the usual NSFormatter methods, // here are some convenience methods which are a little more obvious. - (NSString *)stringFromNumber:(NSNumber *)number; - (NSNumber *)numberFromString:(NSString *)string; typedef NS_ENUM(NSUInteger, NSNumberFormatterStyle) { NSNumberFormatterNoStyle = kCFNumberFormatterNoStyle, NSNumberFormatterDecimalStyle = kCFNumberFormatterDecimalStyle, NSNumberFormatterCurrencyStyle = kCFNumberFormatterCurrencyStyle, NSNumberFormatterPercentStyle = kCFNumberFormatterPercentStyle, NSNumberFormatterScientificStyle = kCFNumberFormatterScientificStyle, NSNumberFormatterSpellOutStyle = kCFNumberFormatterSpellOutStyle }; typedef NS_ENUM(NSUInteger, NSNumberFormatterBehavior) { NSNumberFormatterBehaviorDefault = 0, #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) NSNumberFormatterBehavior10_0 = 1000, #endif NSNumberFormatterBehavior10_4 = 1040, }; + (NSString *)localizedStringFromNumber:(NSNumber *)num numberStyle:(NSNumberFormatterStyle)nstyle NS_AVAILABLE(10_6, 4_0); // Attributes of an NSNumberFormatter - (NSNumberFormatterStyle)numberStyle; - (void)setNumberStyle:(NSNumberFormatterStyle)style; - (NSLocale *)locale; - (void)setLocale:(NSLocale *)locale; - (BOOL)generatesDecimalNumbers; - (void)setGeneratesDecimalNumbers:(BOOL)b; - (NSNumberFormatterBehavior)formatterBehavior; - (void)setFormatterBehavior:(NSNumberFormatterBehavior)behavior; + (NSNumberFormatterBehavior)defaultFormatterBehavior; + (void)setDefaultFormatterBehavior:(NSNumberFormatterBehavior)behavior; - (NSString *)negativeFormat; - (void)setNegativeFormat:(NSString *)format; - (NSDictionary *)textAttributesForNegativeValues; - (void)setTextAttributesForNegativeValues:(NSDictionary *)newAttributes; - (NSString *)positiveFormat; - (void)setPositiveFormat:(NSString *)format; - (NSDictionary *)textAttributesForPositiveValues; - (void)setTextAttributesForPositiveValues:(NSDictionary *)newAttributes; - (BOOL)allowsFloats; - (void)setAllowsFloats:(BOOL)flag; - (NSString *)decimalSeparator; - (void)setDecimalSeparator:(NSString *)string; - (BOOL)alwaysShowsDecimalSeparator; - (void)setAlwaysShowsDecimalSeparator:(BOOL)b; - (NSString *)currencyDecimalSeparator; - (void)setCurrencyDecimalSeparator:(NSString *)string; - (BOOL)usesGroupingSeparator; - (void)setUsesGroupingSeparator:(BOOL)b; - (NSString *)groupingSeparator; - (void)setGroupingSeparator:(NSString *)string; - (NSString *)zeroSymbol; - (void)setZeroSymbol:(NSString *)string; - (NSDictionary *)textAttributesForZero; - (void)setTextAttributesForZero:(NSDictionary *)newAttributes; - (NSString *)nilSymbol; - (void)setNilSymbol:(NSString *)string; - (NSDictionary *)textAttributesForNil; - (void)setTextAttributesForNil:(NSDictionary *)newAttributes; - (NSString *)notANumberSymbol; - (void)setNotANumberSymbol:(NSString *)string; - (NSDictionary *)textAttributesForNotANumber; - (void)setTextAttributesForNotANumber:(NSDictionary *)newAttributes; - (NSString *)positiveInfinitySymbol; - (void)setPositiveInfinitySymbol:(NSString *)string; - (NSDictionary *)textAttributesForPositiveInfinity; - (void)setTextAttributesForPositiveInfinity:(NSDictionary *)newAttributes; - (NSString *)negativeInfinitySymbol; - (void)setNegativeInfinitySymbol:(NSString *)string; - (NSDictionary *)textAttributesForNegativeInfinity; - (void)setTextAttributesForNegativeInfinity:(NSDictionary *)newAttributes; - (NSString *)positivePrefix; - (void)setPositivePrefix:(NSString *)string; - (NSString *)positiveSuffix; - (void)setPositiveSuffix:(NSString *)string; - (NSString *)negativePrefix; - (void)setNegativePrefix:(NSString *)string; - (NSString *)negativeSuffix; - (void)setNegativeSuffix:(NSString *)string; - (NSString *)currencyCode; - (void)setCurrencyCode:(NSString *)string; - (NSString *)currencySymbol; - (void)setCurrencySymbol:(NSString *)string; - (NSString *)internationalCurrencySymbol; - (void)setInternationalCurrencySymbol:(NSString *)string; - (NSString *)percentSymbol; - (void)setPercentSymbol:(NSString *)string; - (NSString *)perMillSymbol; - (void)setPerMillSymbol:(NSString *)string; - (NSString *)minusSign; - (void)setMinusSign:(NSString *)string; - (NSString *)plusSign; - (void)setPlusSign:(NSString *)string; - (NSString *)exponentSymbol; - (void)setExponentSymbol:(NSString *)string; - (NSUInteger)groupingSize; - (void)setGroupingSize:(NSUInteger)number; - (NSUInteger)secondaryGroupingSize; - (void)setSecondaryGroupingSize:(NSUInteger)number; - (NSNumber *)multiplier; - (void)setMultiplier:(NSNumber *)number; - (NSUInteger)formatWidth; - (void)setFormatWidth:(NSUInteger)number; - (NSString *)paddingCharacter; - (void)setPaddingCharacter:(NSString *)string; typedef NS_ENUM(NSUInteger, NSNumberFormatterPadPosition) { NSNumberFormatterPadBeforePrefix = kCFNumberFormatterPadBeforePrefix, NSNumberFormatterPadAfterPrefix = kCFNumberFormatterPadAfterPrefix, NSNumberFormatterPadBeforeSuffix = kCFNumberFormatterPadBeforeSuffix, NSNumberFormatterPadAfterSuffix = kCFNumberFormatterPadAfterSuffix }; typedef NS_ENUM(NSUInteger, NSNumberFormatterRoundingMode) { NSNumberFormatterRoundCeiling = kCFNumberFormatterRoundCeiling, NSNumberFormatterRoundFloor = kCFNumberFormatterRoundFloor, NSNumberFormatterRoundDown = kCFNumberFormatterRoundDown, NSNumberFormatterRoundUp = kCFNumberFormatterRoundUp, NSNumberFormatterRoundHalfEven = kCFNumberFormatterRoundHalfEven, NSNumberFormatterRoundHalfDown = kCFNumberFormatterRoundHalfDown, NSNumberFormatterRoundHalfUp = kCFNumberFormatterRoundHalfUp }; - (NSNumberFormatterPadPosition)paddingPosition; - (void)setPaddingPosition:(NSNumberFormatterPadPosition)position; - (NSNumberFormatterRoundingMode)roundingMode; - (void)setRoundingMode:(NSNumberFormatterRoundingMode)mode; - (NSNumber *)roundingIncrement; - (void)setRoundingIncrement:(NSNumber *)number; - (NSUInteger)minimumIntegerDigits; - (void)setMinimumIntegerDigits:(NSUInteger)number; - (NSUInteger)maximumIntegerDigits; - (void)setMaximumIntegerDigits:(NSUInteger)number; - (NSUInteger)minimumFractionDigits; - (void)setMinimumFractionDigits:(NSUInteger)number; - (NSUInteger)maximumFractionDigits; - (void)setMaximumFractionDigits:(NSUInteger)number; - (NSNumber *)minimum; - (void)setMinimum:(NSNumber *)number; - (NSNumber *)maximum; - (void)setMaximum:(NSNumber *)number; - (NSString *)currencyGroupingSeparator NS_AVAILABLE(10_5, 2_0); - (void)setCurrencyGroupingSeparator:(NSString *)string NS_AVAILABLE(10_5, 2_0); - (BOOL)isLenient NS_AVAILABLE(10_5, 2_0); - (void)setLenient:(BOOL)b NS_AVAILABLE(10_5, 2_0); - (BOOL)usesSignificantDigits NS_AVAILABLE(10_5, 2_0); - (void)setUsesSignificantDigits:(BOOL)b NS_AVAILABLE(10_5, 2_0); - (NSUInteger)minimumSignificantDigits NS_AVAILABLE(10_5, 2_0); - (void)setMinimumSignificantDigits:(NSUInteger)number NS_AVAILABLE(10_5, 2_0); - (NSUInteger)maximumSignificantDigits NS_AVAILABLE(10_5, 2_0); - (void)setMaximumSignificantDigits:(NSUInteger)number NS_AVAILABLE(10_5, 2_0); - (BOOL)isPartialStringValidationEnabled NS_AVAILABLE(10_5, 2_0); - (void)setPartialStringValidationEnabled:(BOOL)b NS_AVAILABLE(10_5, 2_0); @end @class NSDecimalNumberHandler; #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) @interface NSNumberFormatter (NSNumberFormatterCompatibility) - (BOOL)hasThousandSeparators; - (void)setHasThousandSeparators:(BOOL)flag; - (NSString *)thousandSeparator; - (void)setThousandSeparator:(NSString *)newSeparator; - (BOOL)localizesFormat; - (void)setLocalizesFormat:(BOOL)flag; - (NSString *)format; - (void)setFormat:(NSString *)string; - (NSAttributedString *)attributedStringForZero; - (void)setAttributedStringForZero:(NSAttributedString *)newAttributedString; - (NSAttributedString *)attributedStringForNil; - (void)setAttributedStringForNil:(NSAttributedString *)newAttributedString; - (NSAttributedString *)attributedStringForNotANumber; - (void)setAttributedStringForNotANumber:(NSAttributedString *)newAttributedString; - (NSDecimalNumberHandler *)roundingBehavior; - (void)setRoundingBehavior:(NSDecimalNumberHandler *)newRoundingBehavior; @end #endif /* NSObjCRuntime.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #include #if defined(__cplusplus) #define FOUNDATION_EXTERN extern "C" #else #define FOUNDATION_EXTERN extern #endif #if TARGET_OS_WIN32 #if defined(NSBUILDINGFOUNDATION) #define FOUNDATION_EXPORT FOUNDATION_EXTERN __declspec(dllexport) #else #define FOUNDATION_EXPORT FOUNDATION_EXTERN __declspec(dllimport) #endif #define FOUNDATION_IMPORT FOUNDATION_EXTERN __declspec(dllimport) #else #define FOUNDATION_EXPORT FOUNDATION_EXTERN #define FOUNDATION_IMPORT FOUNDATION_EXTERN #endif #if !defined(NS_INLINE) #if defined(__GNUC__) #define NS_INLINE static __inline__ __attribute__((always_inline)) #elif defined(__MWERKS__) || defined(__cplusplus) #define NS_INLINE static inline #elif defined(_MSC_VER) #define NS_INLINE static __inline #elif TARGET_OS_WIN32 #define NS_INLINE static __inline__ #endif #endif #if !defined(FOUNDATION_STATIC_INLINE) #define FOUNDATION_STATIC_INLINE static __inline__ #endif #if !defined(FOUNDATION_EXTERN_INLINE) #define FOUNDATION_EXTERN_INLINE extern __inline__ #endif #if !defined(NS_REQUIRES_NIL_TERMINATION) #if TARGET_OS_WIN32 #define NS_REQUIRES_NIL_TERMINATION #else #if defined(__APPLE_CC__) && (__APPLE_CC__ >= 5549) #define NS_REQUIRES_NIL_TERMINATION __attribute__((sentinel(0,1))) #else #define NS_REQUIRES_NIL_TERMINATION __attribute__((sentinel)) #endif #endif #endif #if !defined(NS_BLOCKS_AVAILABLE) #if __BLOCKS__ && (MAC_OS_X_VERSION_10_6 <= MAC_OS_X_VERSION_MAX_ALLOWED || __IPHONE_4_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED) #define NS_BLOCKS_AVAILABLE 1 #else #define NS_BLOCKS_AVAILABLE 0 #endif #endif // Marks APIs whose iOS versions are nonatomic, that is cannot be set/get from multiple threads safely without additional synchronization #if !defined(NS_NONATOMIC_IOSONLY) #if TARGET_OS_IPHONE #define NS_NONATOMIC_IOSONLY nonatomic #else #define NS_NONATOMIC_IOSONLY #endif #endif // Use NS_NONATOMIC_IOSONLY instead of this older macro #if !defined(NS_NONATOMIC_IPHONEONLY) #define NS_NONATOMIC_IPHONEONLY NS_NONATOMIC_IOSONLY #endif // Marks APIs which format strings by taking a format string and optional varargs as arguments #if !defined(NS_FORMAT_FUNCTION) #if (__GNUC__*10+__GNUC_MINOR__ >= 42) && (TARGET_OS_MAC || TARGET_OS_EMBEDDED) #define NS_FORMAT_FUNCTION(F,A) __attribute__((format(__NSString__, F, A))) #else #define NS_FORMAT_FUNCTION(F,A) #endif #endif // Marks APIs which are often used to process (take and return) format strings, so they can be used in place of a constant format string parameter in APIs #if !defined(NS_FORMAT_ARGUMENT) #if defined(__clang__) #define NS_FORMAT_ARGUMENT(A) __attribute__ ((format_arg(A))) #else #define NS_FORMAT_ARGUMENT(A) #endif #endif // Some compilers provide the capability to test if certain features are available. This macro provides a compatibility path for other compilers. #ifndef __has_feature #define __has_feature(x) 0 #endif #ifndef __has_extension #define __has_extension(x) 0 #endif // Some compilers provide the capability to test if certain attributes are available. This macro provides a compatibility path for other compilers. #ifndef __has_attribute #define __has_attribute(x) 0 #endif // Marks methods and functions which return an object that needs to be released by the caller but whose names are not consistent with Cocoa naming rules. The recommended fix to this is to rename the methods or functions, but this macro can be used to let the clang static analyzer know of any exceptions that cannot be fixed. // This macro is ONLY to be used in exceptional circumstances, not to annotate functions which conform to the Cocoa naming rules. #if __has_feature(attribute_ns_returns_retained) #define NS_RETURNS_RETAINED __attribute__((ns_returns_retained)) #else #define NS_RETURNS_RETAINED #endif // Marks methods and functions which return an object that may need to be retained by the caller but whose names are not consistent with Cocoa naming rules. The recommended fix to this is to rename the methods or functions, but this macro can be used to let the clang static analyzer know of any exceptions that cannot be fixed. // This macro is ONLY to be used in exceptional circumstances, not to annotate functions which conform to the Cocoa naming rules. #if __has_feature(attribute_ns_returns_not_retained) #define NS_RETURNS_NOT_RETAINED __attribute__((ns_returns_not_retained)) #else #define NS_RETURNS_NOT_RETAINED #endif #ifndef NS_RETURNS_INNER_POINTER #if __has_attribute(objc_returns_inner_pointer) #define NS_RETURNS_INNER_POINTER __attribute__((objc_returns_inner_pointer)) #else #define NS_RETURNS_INNER_POINTER #endif #endif // Marks methods and functions which cannot be used when compiling in automatic reference counting mode. #if __has_feature(objc_arc) #define NS_AUTOMATED_REFCOUNT_UNAVAILABLE __attribute__((unavailable("not available in automatic reference counting mode"))) #else #define NS_AUTOMATED_REFCOUNT_UNAVAILABLE #endif // Marks classes which cannot participate in the ARC weak reference feature. #if __has_attribute(objc_arc_weak_reference_unavailable) #define NS_AUTOMATED_REFCOUNT_WEAK_UNAVAILABLE __attribute__((objc_arc_weak_reference_unavailable)) #else #define NS_AUTOMATED_REFCOUNT_WEAK_UNAVAILABLE #endif // Marks classes that must specify @dynamic or @synthesize for properties in their @implementation (property getters & setters will not be synthesized unless the @synthesize directive is used) #if __has_attribute(objc_requires_property_definitions) #define NS_REQUIRES_PROPERTY_DEFINITIONS __attribute__((objc_requires_property_definitions)) #else #define NS_REQUIRES_PROPERTY_DEFINITIONS #endif // Decorates methods in which the receiver may be replaced with the result of the method. #if __has_feature(attribute_ns_consumes_self) #define NS_REPLACES_RECEIVER __attribute__((ns_consumes_self)) NS_RETURNS_RETAINED #else #define NS_REPLACES_RECEIVER #endif #if __has_feature(attribute_ns_consumed) #define NS_RELEASES_ARGUMENT __attribute__((ns_consumed)) #else #define NS_RELEASES_ARGUMENT #endif // Mark local variables of type 'id' or pointer-to-ObjC-object-type so that values stored into that local variable are not aggressively released by the compiler during optimization, but are held until either the variable is assigned to again, or the end of the scope (such as a compound statement, or method definition) of the local variable. #ifndef NS_VALID_UNTIL_END_OF_SCOPE #if __has_attribute(objc_precise_lifetime) #define NS_VALID_UNTIL_END_OF_SCOPE __attribute__((objc_precise_lifetime)) #else #define NS_VALID_UNTIL_END_OF_SCOPE #endif #endif // Annotate classes which are root classes as really being root classes #ifndef NS_ROOT_CLASS #if __has_attribute(objc_root_class) #define NS_ROOT_CLASS __attribute__((objc_root_class)) #else #define NS_ROOT_CLASS #endif #endif #if !defined(NS_UNAVAILABLE) #define NS_UNAVAILABLE UNAVAILABLE_ATTRIBUTE #endif #if !defined(__unsafe_unretained) #define __unsafe_unretained #endif #import #include #include #include #include #include // The arguments to these availability macros is a version number, e.g. 10_6, 3_0 or 'NA' #if TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) // These cover cases where NS_DEPRECATED indicates something is available and not deprecated on Mac OS but deprecated on iOS #define AVAILABLE_MAC_OS_X_VERSION_NA_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_NA UNAVAILABLE_ATTRIBUTE #define AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_NA AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER #define AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_NA AVAILABLE_MAC_OS_X_VERSION_10_1_AND_LATER #define AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_NA AVAILABLE_MAC_OS_X_VERSION_10_2_AND_LATER #define AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_NA AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER #define AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_NA AVAILABLE_MAC_OS_X_VERSION_10_4_AND_LATER #define AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_NA AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER #define AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_NA AVAILABLE_MAC_OS_X_VERSION_10_6_AND_LATER #define AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_NA AVAILABLE_MAC_OS_X_VERSION_10_7_AND_LATER #define AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_NA AVAILABLE_MAC_OS_X_VERSION_10_8_AND_LATER // Available on MacOS and iOS #define NS_AVAILABLE(_mac, _ios) AVAILABLE_MAC_OS_X_VERSION_##_mac##_AND_LATER // Available on MacOS only #define NS_AVAILABLE_MAC(_mac) AVAILABLE_MAC_OS_X_VERSION_##_mac##_AND_LATER // Available on iOS only #define NS_AVAILABLE_IOS(_ios) UNAVAILABLE_ATTRIBUTE // Deprecated on either MacOS or iOS, or deprecated on both (check version numbers for details) #define NS_DEPRECATED(_macIntro, _macDep, _iosIntro, _iosDep) AVAILABLE_MAC_OS_X_VERSION_##_macIntro##_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_##_macDep // Deprecated on MacOS, unavailable on iOS #define NS_DEPRECATED_MAC(_macIntro, _macDep) AVAILABLE_MAC_OS_X_VERSION_##_macIntro##_AND_LATER_BUT_DEPRECATED_IN_MAC_OS_X_VERSION_##_macDep // Unavailable on MacOS, deprecated on iOS #define NS_DEPRECATED_IOS(_iosIntro, _iosDep) UNAVAILABLE_ATTRIBUTE #ifndef __IPHONE_5_0 #define __IPHONE_5_0 50000 #endif #ifndef __IPHONE_6_0 #define __IPHONE_6_0 60000 #endif #elif (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) #define NS_AVAILABLE(_mac, _ios) __OSX_AVAILABLE_STARTING(__MAC_##_mac, __IPHONE_##_ios) #define NS_AVAILABLE_MAC(_mac) __OSX_AVAILABLE_STARTING(__MAC_##_mac, __IPHONE_NA) #define NS_AVAILABLE_IOS(_ios) __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_##_ios) #define NS_DEPRECATED(_macIntro, _macDep, _iosIntro, _iosDep) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_##_macIntro, __MAC_##_macDep, __IPHONE_##_iosIntro, __IPHONE_##_iosDep) #define NS_DEPRECATED_MAC(_macIntro, _macDep) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_##_macIntro, __MAC_##_macDep, __IPHONE_NA, __IPHONE_NA) #define NS_DEPRECATED_IOS(_iosIntro, _iosDep) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA, __MAC_NA, __IPHONE_##_iosIntro, __IPHONE_##_iosDep) #else #define NS_AVAILABLE(_mac, _ios) #define NS_AVAILABLE_MAC(_mac) #define NS_AVAILABLE_IOS(_ios) #define NS_DEPRECATED(_macIntro, _macDep, _iosIntro, _iosDep) #define NS_DEPRECATED_MAC(_macIntro, _macDep) #define NS_DEPRECATED_IOS(_iosIntro, _iosDep) #endif // Older versions of these macro; use IOS versions instead #define NS_AVAILABLE_IPHONE(_ios) NS_AVAILABLE_IOS(_ios) #define NS_DEPRECATED_IPHONE(_iosIntro, _iosDep) NS_DEPRECATED_IOS(_iosIntro, _iosDep) // This macro is to be used by system frameworks to support the weak linking of classes. Weak linking is supported on iOS 3.1 and Mac OS X 10.6.8 or later. #if (__MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_10_6 || __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_3_1) && \ ((__has_feature(objc_weak_class) || \ (defined(__llvm__) && defined(__APPLE_CC__) && (__APPLE_CC__ >= 5658)) || \ (defined(__APPLE_CC__) && (__APPLE_CC__ >= 5666)))) #define NS_CLASS_AVAILABLE(_mac, _ios) __attribute__((visibility("default"))) __OSX_AVAILABLE_STARTING(__MAC_##_mac, __IPHONE_##_ios) #else // class weak import is not supported #define NS_CLASS_AVAILABLE(_mac, _ios) #endif #define NS_CLASS_AVAILABLE_IOS(_ios) NS_CLASS_AVAILABLE(NA, _ios) #define NS_CLASS_AVAILABLE_MAC(_mac) NS_CLASS_AVAILABLE(_mac, NA) #if __has_feature(enumerator_attributes) && __has_attribute(availability) #define NS_ENUM_AVAILABLE(_mac, _ios) __OSX_AVAILABLE_STARTING(__MAC_##_mac, __IPHONE_##_ios) #define NS_ENUM_AVAILABLE_MAC(_mac) __OSX_AVAILABLE_STARTING(__MAC_##_mac, __IPHONE_NA) #define NS_ENUM_AVAILABLE_IOS(_ios) __OSX_AVAILABLE_STARTING(__MAC_NA, __IPHONE_##_ios) #define NS_ENUM_DEPRECATED(_macIntro, _macDep, _iosIntro, _iosDep) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_##_macIntro, __MAC_##_macDep, __IPHONE_##_iosIntro, __IPHONE_##_iosDep) #define NS_ENUM_DEPRECATED_MAC(_macIntro, _macDep) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_##_macIntro, __MAC_##_macDep, __IPHONE_NA, __IPHONE_NA) #define NS_ENUM_DEPRECATED_IOS(_iosIntro, _iosDep) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_NA, __MAC_NA, __IPHONE_##_iosIntro, __IPHONE_##_iosDep) #else #define NS_ENUM_AVAILABLE(_mac, _ios) #define NS_ENUM_AVAILABLE_MAC(_mac) #define NS_ENUM_AVAILABLE_IOS(_ios) #define NS_ENUM_DEPRECATED(_macIntro, _macDep, _iosIntro, _iosDep) #define NS_ENUM_DEPRECATED_MAC(_macIntro, _macDep) #define NS_ENUM_DEPRECATED_IOS(_iosIntro, _iosDep) #endif #if (__cplusplus && __cplusplus >= 201103L && (__has_extension(cxx_strong_enums) || __has_feature(objc_fixed_enum))) || (!__cplusplus && __has_feature(objc_fixed_enum)) #define NS_ENUM(_type, _name) enum _name : _type _name; enum _name : _type #if (__cplusplus) #define NS_OPTIONS(_type, _name) _type _name; enum : _type #else #define NS_OPTIONS(_type, _name) enum _name : _type _name; enum _name : _type #endif #else #define NS_ENUM(_type, _name) _type _name; enum #define NS_OPTIONS(_type, _name) _type _name; enum #endif FOUNDATION_EXPORT double NSFoundationVersionNumber; #if TARGET_OS_MAC #define NSFoundationVersionNumber10_0 397.40 #define NSFoundationVersionNumber10_1 425.00 #define NSFoundationVersionNumber10_1_1 425.00 #define NSFoundationVersionNumber10_1_2 425.00 #define NSFoundationVersionNumber10_1_3 425.00 #define NSFoundationVersionNumber10_1_4 425.00 #define NSFoundationVersionNumber10_2 462.00 #define NSFoundationVersionNumber10_2_1 462.00 #define NSFoundationVersionNumber10_2_2 462.00 #define NSFoundationVersionNumber10_2_3 462.00 #define NSFoundationVersionNumber10_2_4 462.00 #define NSFoundationVersionNumber10_2_5 462.00 #define NSFoundationVersionNumber10_2_6 462.00 #define NSFoundationVersionNumber10_2_7 462.70 #define NSFoundationVersionNumber10_2_8 462.70 #define NSFoundationVersionNumber10_3 500.00 #define NSFoundationVersionNumber10_3_1 500.00 #define NSFoundationVersionNumber10_3_2 500.30 #define NSFoundationVersionNumber10_3_3 500.54 #define NSFoundationVersionNumber10_3_4 500.56 #define NSFoundationVersionNumber10_3_5 500.56 #define NSFoundationVersionNumber10_3_6 500.56 #define NSFoundationVersionNumber10_3_7 500.56 #define NSFoundationVersionNumber10_3_8 500.56 #define NSFoundationVersionNumber10_3_9 500.58 #define NSFoundationVersionNumber10_4 567.00 #define NSFoundationVersionNumber10_4_1 567.00 #define NSFoundationVersionNumber10_4_2 567.12 #define NSFoundationVersionNumber10_4_3 567.21 #define NSFoundationVersionNumber10_4_4_Intel 567.23 #define NSFoundationVersionNumber10_4_4_PowerPC 567.21 #define NSFoundationVersionNumber10_4_5 567.25 #define NSFoundationVersionNumber10_4_6 567.26 #define NSFoundationVersionNumber10_4_7 567.27 #define NSFoundationVersionNumber10_4_8 567.28 #define NSFoundationVersionNumber10_4_9 567.29 #define NSFoundationVersionNumber10_4_10 567.29 #define NSFoundationVersionNumber10_4_11 567.36 #define NSFoundationVersionNumber10_5 677.00 #define NSFoundationVersionNumber10_5_1 677.10 #define NSFoundationVersionNumber10_5_2 677.15 #define NSFoundationVersionNumber10_5_3 677.19 #define NSFoundationVersionNumber10_5_4 677.19 #define NSFoundationVersionNumber10_5_5 677.21 #define NSFoundationVersionNumber10_5_6 677.22 #define NSFoundationVersionNumber10_5_7 677.24 #define NSFoundationVersionNumber10_5_8 677.26 #define NSFoundationVersionNumber10_6 751.00 #define NSFoundationVersionNumber10_6_1 751.00 #define NSFoundationVersionNumber10_6_2 751.14 #define NSFoundationVersionNumber10_6_3 751.21 #define NSFoundationVersionNumber10_6_4 751.29 #define NSFoundationVersionNumber10_6_5 751.42 #define NSFoundationVersionNumber10_6_6 751.53 #define NSFoundationVersionNumber10_6_7 751.53 #define NSFoundationVersionNumber10_6_8 751.62 #define NSFoundationVersionNumber10_7 833.10 #define NSFoundationVersionNumber10_7_1 833.10 #define NSFoundationVersionNumber10_7_2 833.20 #define NSFoundationVersionNumber10_7_3 833.24 #define NSFoundationVersionNumber10_7_4 833.25 #endif #if TARGET_OS_IPHONE #define NSFoundationVersionNumber_iPhoneOS_2_0 678.24 #define NSFoundationVersionNumber_iPhoneOS_2_1 678.26 #define NSFoundationVersionNumber_iPhoneOS_2_2 678.29 #define NSFoundationVersionNumber_iPhoneOS_3_0 678.47 #define NSFoundationVersionNumber_iPhoneOS_3_1 678.51 #define NSFoundationVersionNumber_iPhoneOS_3_2 678.60 #define NSFoundationVersionNumber_iOS_4_0 751.32 #define NSFoundationVersionNumber_iOS_4_1 751.37 #define NSFoundationVersionNumber_iOS_4_2 751.49 #define NSFoundationVersionNumber_iOS_4_3 751.49 #define NSFoundationVersionNumber_iOS_5_0 881 #define NSFoundationVersionNumber_iOS_5_1 890.1 #endif #if __LP64__ || (TARGET_OS_EMBEDDED && !TARGET_OS_IPHONE) || TARGET_OS_WIN32 || NS_BUILD_32_LIKE_64 typedef long NSInteger; typedef unsigned long NSUInteger; #else typedef int NSInteger; typedef unsigned int NSUInteger; #endif #define NSIntegerMax LONG_MAX #define NSIntegerMin LONG_MIN #define NSUIntegerMax ULONG_MAX #define NSINTEGER_DEFINED 1 @class NSString, Protocol; FOUNDATION_EXPORT NSString *NSStringFromSelector(SEL aSelector); FOUNDATION_EXPORT SEL NSSelectorFromString(NSString *aSelectorName); FOUNDATION_EXPORT NSString *NSStringFromClass(Class aClass); FOUNDATION_EXPORT Class NSClassFromString(NSString *aClassName); FOUNDATION_EXPORT NSString *NSStringFromProtocol(Protocol *proto) NS_AVAILABLE(10_5, 2_0); FOUNDATION_EXPORT Protocol *NSProtocolFromString(NSString *namestr) NS_AVAILABLE(10_5, 2_0); FOUNDATION_EXPORT const char *NSGetSizeAndAlignment(const char *typePtr, NSUInteger *sizep, NSUInteger *alignp); FOUNDATION_EXPORT void NSLog(NSString *format, ...) NS_FORMAT_FUNCTION(1,2); FOUNDATION_EXPORT void NSLogv(NSString *format, va_list args) NS_FORMAT_FUNCTION(1,0); typedef NS_ENUM(NSInteger, NSComparisonResult) {NSOrderedAscending = -1L, NSOrderedSame, NSOrderedDescending}; #if NS_BLOCKS_AVAILABLE typedef NSComparisonResult (^NSComparator)(id obj1, id obj2); #endif enum { NSEnumerationConcurrent = (1UL << 0), NSEnumerationReverse = (1UL << 1), }; typedef NSUInteger NSEnumerationOptions; enum { NSSortConcurrent = (1UL << 0), NSSortStable = (1UL << 4), }; typedef NSUInteger NSSortOptions; enum {NSNotFound = NSIntegerMax}; #if !defined(YES) #define YES (BOOL)1 #endif #if !defined(NO) #define NO (BOOL)0 #endif #if defined(__GNUC__) && !defined(__STRICT_ANSI__) #if !defined(MIN) #define MIN(A,B) ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __a : __b; }) #endif #if !defined(MAX) #define MAX(A,B) ({ __typeof__(A) __a = (A); __typeof__(B) __b = (B); __a < __b ? __b : __a; }) #endif #if !defined(ABS) #define ABS(A) ({ __typeof__(A) __a = (A); __a < 0 ? -__a : __a; }) #endif #else #if !defined(MIN) #define MIN(A,B) ((A) < (B) ? (A) : (B)) #endif #if !defined(MAX) #define MAX(A,B) ((A) > (B) ? (A) : (B)) #endif #if !defined(ABS) #define ABS(A) ((A) < 0 ? (-(A)) : (A)) #endif #endif /* __GNUC__ */ /* NSObject.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import #import @class NSInvocation, NSMethodSignature, NSCoder, NSString, NSEnumerator; @class Protocol; /*************** Basic protocols ***************/ @protocol NSObject - (BOOL)isEqual:(id)object; - (NSUInteger)hash; - (Class)superclass; - (Class)class; - (id)self; - (NSZone *)zone NS_AUTOMATED_REFCOUNT_UNAVAILABLE; - (id)performSelector:(SEL)aSelector; - (id)performSelector:(SEL)aSelector withObject:(id)object; - (id)performSelector:(SEL)aSelector withObject:(id)object1 withObject:(id)object2; - (BOOL)isProxy; - (BOOL)isKindOfClass:(Class)aClass; - (BOOL)isMemberOfClass:(Class)aClass; - (BOOL)conformsToProtocol:(Protocol *)aProtocol; - (BOOL)respondsToSelector:(SEL)aSelector; - (id)retain NS_AUTOMATED_REFCOUNT_UNAVAILABLE; - (oneway void)release NS_AUTOMATED_REFCOUNT_UNAVAILABLE; - (id)autorelease NS_AUTOMATED_REFCOUNT_UNAVAILABLE; - (NSUInteger)retainCount NS_AUTOMATED_REFCOUNT_UNAVAILABLE; - (NSString *)description; @optional - (NSString *)debugDescription; @end @protocol NSCopying - (id)copyWithZone:(NSZone *)zone; @end @protocol NSMutableCopying - (id)mutableCopyWithZone:(NSZone *)zone; @end @protocol NSCoding - (void)encodeWithCoder:(NSCoder *)aCoder; - (id)initWithCoder:(NSCoder *)aDecoder; @end // Objects which are safe to be encoded and decoded across privilege boundaries should adopt NSSecureCoding instead of NSCoding. Secure coders (those that respond YES to requiresSecureCoding) will only encode objects that adopt the NSSecureCoding protocol. @protocol NSSecureCoding @required // This method must be return YES on all classes that allow secure coding. Subclasses of classes that adopt NSSecureCoding and override initWithCoder: must also override this method and return YES. // The Secure Coding Guide should be consulted when writing methods that decode data. + (BOOL)supportsSecureCoding; @end /*********** Base class ***********/ NS_ROOT_CLASS @interface NSObject { Class isa; } + (void)load; + (void)initialize; - (id)init; + (id)new; + (id)allocWithZone:(NSZone *)zone; + (id)alloc; - (void)dealloc; - (void)finalize; - (id)copy; - (id)mutableCopy; + (id)copyWithZone:(NSZone *)zone NS_AUTOMATED_REFCOUNT_UNAVAILABLE; + (id)mutableCopyWithZone:(NSZone *)zone NS_AUTOMATED_REFCOUNT_UNAVAILABLE; + (Class)superclass; + (Class)class; + (BOOL)instancesRespondToSelector:(SEL)aSelector; + (BOOL)conformsToProtocol:(Protocol *)protocol; - (IMP)methodForSelector:(SEL)aSelector; + (IMP)instanceMethodForSelector:(SEL)aSelector; - (void)doesNotRecognizeSelector:(SEL)aSelector; - (id)forwardingTargetForSelector:(SEL)aSelector NS_AVAILABLE(10_5, 2_0); - (void)forwardInvocation:(NSInvocation *)anInvocation; - (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector; + (NSMethodSignature *)instanceMethodSignatureForSelector:(SEL)aSelector; - (BOOL)allowsWeakReference NS_UNAVAILABLE; - (BOOL)retainWeakReference NS_UNAVAILABLE; + (NSString *)description; + (BOOL)isSubclassOfClass:(Class)aClass; + (BOOL)resolveClassMethod:(SEL)sel NS_AVAILABLE(10_5, 2_0); + (BOOL)resolveInstanceMethod:(SEL)sel NS_AVAILABLE(10_5, 2_0); @end @interface NSObject (NSCoderMethods) + (NSInteger)version; + (void)setVersion:(NSInteger)aVersion; - (Class)classForCoder; - (id)replacementObjectForCoder:(NSCoder *)aCoder; - (id)awakeAfterUsingCoder:(NSCoder *)aDecoder NS_REPLACES_RECEIVER; @end #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) @interface NSObject (NSDeprecatedMethods) + (void)poseAsClass:(Class)aClass NS_DEPRECATED(10_0, 10_5, 2_0, 2_0) #if __OBJC2__ UNAVAILABLE_ATTRIBUTE #endif ; @end #endif /*********** Discardable Content ***********/ @protocol NSDiscardableContent @required - (BOOL)beginContentAccess; - (void)endContentAccess; - (void)discardContentIfPossible; - (BOOL)isContentDiscarded; @end @interface NSObject (NSDiscardableContentProxy) - (id)autoContentAccessingProxy NS_AVAILABLE(10_6, 4_0); @end /*********** Object Allocation / Deallocation *******/ FOUNDATION_EXPORT id NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone) NS_AUTOMATED_REFCOUNT_UNAVAILABLE; FOUNDATION_EXPORT void NSDeallocateObject(id object) NS_AUTOMATED_REFCOUNT_UNAVAILABLE; FOUNDATION_EXPORT id NSCopyObject(id object, NSUInteger extraBytes, NSZone *zone) NS_AUTOMATED_REFCOUNT_UNAVAILABLE NS_DEPRECATED(10_0, 10_8, 2_0, 6_0); FOUNDATION_EXPORT BOOL NSShouldRetainWithZone(id anObject, NSZone *requestedZone) NS_AUTOMATED_REFCOUNT_UNAVAILABLE; FOUNDATION_EXPORT void NSIncrementExtraRefCount(id object) NS_AUTOMATED_REFCOUNT_UNAVAILABLE; FOUNDATION_EXPORT BOOL NSDecrementExtraRefCountWasZero(id object) NS_AUTOMATED_REFCOUNT_UNAVAILABLE; FOUNDATION_EXPORT NSUInteger NSExtraRefCount(id object) NS_AUTOMATED_REFCOUNT_UNAVAILABLE; #if __has_feature(objc_arc) // After using a CFBridgingRetain on an NSObject, the caller must take responsibility for calling CFRelease at an appropriate time. NS_INLINE CF_RETURNS_RETAINED CFTypeRef CFBridgingRetain(id X) { return (__bridge_retained CFTypeRef)X; } NS_INLINE id CFBridgingRelease(CFTypeRef CF_CONSUMED X) { return (__bridge_transfer id)X; } #else // This function is intended for use while converting to ARC mode only. NS_INLINE CF_RETURNS_RETAINED CFTypeRef CFBridgingRetain(id X) { return X ? CFRetain((CFTypeRef)X) : NULL; } // This function is intended for use while converting to ARC mode only. NS_INLINE id CFBridgingRelease(CFTypeRef CF_CONSUMED X) { return [(id)CFMakeCollectable(X) autorelease]; } #endif /* NSOperation.h Copyright (c) 2006-2012, Apple Inc. All rights reserved. */ #import @class NSArray, NSSet; NS_CLASS_AVAILABLE(10_5, 2_0) @interface NSOperation : NSObject { @private id _private; int32_t _private1; #if __LP64__ int32_t _private1b; #endif } - (id)init; // designated initializer - (void)start; - (void)main; - (BOOL)isCancelled; - (void)cancel; - (BOOL)isExecuting; - (BOOL)isFinished; - (BOOL)isConcurrent; - (BOOL)isReady; - (void)addDependency:(NSOperation *)op; - (void)removeDependency:(NSOperation *)op; - (NSArray *)dependencies; typedef NS_ENUM(NSInteger, NSOperationQueuePriority) { NSOperationQueuePriorityVeryLow = -8L, NSOperationQueuePriorityLow = -4L, NSOperationQueuePriorityNormal = 0, NSOperationQueuePriorityHigh = 4, NSOperationQueuePriorityVeryHigh = 8 }; - (NSOperationQueuePriority)queuePriority; - (void)setQueuePriority:(NSOperationQueuePriority)p; #if NS_BLOCKS_AVAILABLE - (void (^)(void))completionBlock NS_AVAILABLE(10_6, 4_0); - (void)setCompletionBlock:(void (^)(void))block NS_AVAILABLE(10_6, 4_0); #endif - (void)waitUntilFinished NS_AVAILABLE(10_6, 4_0); - (double)threadPriority NS_AVAILABLE(10_6, 4_0); - (void)setThreadPriority:(double)p NS_AVAILABLE(10_6, 4_0); @end NS_CLASS_AVAILABLE(10_6, 4_0) @interface NSBlockOperation : NSOperation { @private id _private2; void *_reserved2; } #if NS_BLOCKS_AVAILABLE + (id)blockOperationWithBlock:(void (^)(void))block; - (void)addExecutionBlock:(void (^)(void))block; - (NSArray *)executionBlocks; #endif @end NS_CLASS_AVAILABLE(10_5, 2_0) @interface NSInvocationOperation : NSOperation { @private id _inv; id _exception; void *_reserved2; } - (id)initWithTarget:(id)target selector:(SEL)sel object:(id)arg; - (id)initWithInvocation:(NSInvocation *)inv; // designated initializer - (NSInvocation *)invocation; - (id)result; @end FOUNDATION_EXPORT NSString * const NSInvocationOperationVoidResultException NS_AVAILABLE(10_5, 2_0); FOUNDATION_EXPORT NSString * const NSInvocationOperationCancelledException NS_AVAILABLE(10_5, 2_0); NS_CLASS_AVAILABLE(10_5, 2_0) @interface NSOperationQueue : NSObject { @private id _private; void *_reserved; } - (void)addOperation:(NSOperation *)op; - (void)addOperations:(NSArray *)ops waitUntilFinished:(BOOL)wait NS_AVAILABLE(10_6, 4_0); #if NS_BLOCKS_AVAILABLE - (void)addOperationWithBlock:(void (^)(void))block NS_AVAILABLE(10_6, 4_0); #endif - (NSArray *)operations; - (NSUInteger)operationCount NS_AVAILABLE(10_6, 4_0); - (NSInteger)maxConcurrentOperationCount; - (void)setMaxConcurrentOperationCount:(NSInteger)cnt; enum { NSOperationQueueDefaultMaxConcurrentOperationCount = -1 }; - (void)setSuspended:(BOOL)b; - (BOOL)isSuspended; - (void)setName:(NSString *)n NS_AVAILABLE(10_6, 4_0); - (NSString *)name NS_AVAILABLE(10_6, 4_0); - (void)cancelAllOperations; - (void)waitUntilAllOperationsAreFinished; + (id)currentQueue NS_AVAILABLE(10_6, 4_0); + (id)mainQueue NS_AVAILABLE(10_6, 4_0); @end /* NSOrderedSet.h Copyright (c) 2007-2012, Apple Inc. All rights reserved. */ #import #import #import #import @class NSArray, NSIndexSet, NSSet, NSString; /**************** Immutable Ordered Set ****************/ NS_CLASS_AVAILABLE(10_7, 5_0) @interface NSOrderedSet : NSObject - (NSUInteger)count; - (id)objectAtIndex:(NSUInteger)idx; - (NSUInteger)indexOfObject:(id)object; @end @interface NSOrderedSet (NSExtendedOrderedSet) - (void)getObjects:(id __unsafe_unretained [])objects range:(NSRange)range; - (NSArray *)objectsAtIndexes:(NSIndexSet *)indexes; - (id)firstObject; - (id)lastObject; - (BOOL)isEqualToOrderedSet:(NSOrderedSet *)other; - (BOOL)containsObject:(id)object; - (BOOL)intersectsOrderedSet:(NSOrderedSet *)other; - (BOOL)intersectsSet:(NSSet *)set; - (BOOL)isSubsetOfOrderedSet:(NSOrderedSet *)other; - (BOOL)isSubsetOfSet:(NSSet *)set; - (id)objectAtIndexedSubscript:(NSUInteger)idx NS_AVAILABLE(10_8, 6_0); - (NSEnumerator *)objectEnumerator; - (NSEnumerator *)reverseObjectEnumerator; - (NSOrderedSet *)reversedOrderedSet; // These two methods return a facade object for the receiving ordered set, // which acts like an immutable array or set (respectively). Note that // while you cannot mutate the ordered set through these facades, mutations // to the original ordered set will "show through" the facade and it will // appear to change spontaneously, since a copy of the ordered set is not // being made. - (NSArray *)array; - (NSSet *)set; #if NS_BLOCKS_AVAILABLE - (void)enumerateObjectsUsingBlock:(void (^)(id obj, NSUInteger idx, BOOL *stop))block; - (void)enumerateObjectsWithOptions:(NSEnumerationOptions)opts usingBlock:(void (^)(id obj, NSUInteger idx, BOOL *stop))block; - (void)enumerateObjectsAtIndexes:(NSIndexSet *)s options:(NSEnumerationOptions)opts usingBlock:(void (^)(id obj, NSUInteger idx, BOOL *stop))block; - (NSUInteger)indexOfObjectPassingTest:(BOOL (^)(id obj, NSUInteger idx, BOOL *stop))predicate; - (NSUInteger)indexOfObjectWithOptions:(NSEnumerationOptions)opts passingTest:(BOOL (^)(id obj, NSUInteger idx, BOOL *stop))predicate; - (NSUInteger)indexOfObjectAtIndexes:(NSIndexSet *)s options:(NSEnumerationOptions)opts passingTest:(BOOL (^)(id obj, NSUInteger idx, BOOL *stop))predicate; - (NSIndexSet *)indexesOfObjectsPassingTest:(BOOL (^)(id obj, NSUInteger idx, BOOL *stop))predicate; - (NSIndexSet *)indexesOfObjectsWithOptions:(NSEnumerationOptions)opts passingTest:(BOOL (^)(id obj, NSUInteger idx, BOOL *stop))predicate; - (NSIndexSet *)indexesOfObjectsAtIndexes:(NSIndexSet *)s options:(NSEnumerationOptions)opts passingTest:(BOOL (^)(id obj, NSUInteger idx, BOOL *stop))predicate; - (NSUInteger)indexOfObject:(id)object inSortedRange:(NSRange)range options:(NSBinarySearchingOptions)opts usingComparator:(NSComparator)cmp; // binary search - (NSArray *)sortedArrayUsingComparator:(NSComparator)cmptr; - (NSArray *)sortedArrayWithOptions:(NSSortOptions)opts usingComparator:(NSComparator)cmptr; #endif - (NSString *)description; - (NSString *)descriptionWithLocale:(id)locale; - (NSString *)descriptionWithLocale:(id)locale indent:(NSUInteger)level; @end @interface NSOrderedSet (NSOrderedSetCreation) + (id)orderedSet; + (id)orderedSetWithObject:(id)object; + (id)orderedSetWithObjects:(const id [])objects count:(NSUInteger)cnt; + (id)orderedSetWithObjects:(id)firstObj, ... NS_REQUIRES_NIL_TERMINATION; + (id)orderedSetWithOrderedSet:(NSOrderedSet *)set; + (id)orderedSetWithOrderedSet:(NSOrderedSet *)set range:(NSRange)range copyItems:(BOOL)flag; + (id)orderedSetWithArray:(NSArray *)array; + (id)orderedSetWithArray:(NSArray *)array range:(NSRange)range copyItems:(BOOL)flag; + (id)orderedSetWithSet:(NSSet *)set; + (id)orderedSetWithSet:(NSSet *)set copyItems:(BOOL)flag; - (id)initWithObject:(id)object; - (id)initWithObjects:(const id [])objects count:(NSUInteger)cnt; - (id)initWithObjects:(id)firstObj, ... NS_REQUIRES_NIL_TERMINATION; - (id)initWithOrderedSet:(NSOrderedSet *)set; - (id)initWithOrderedSet:(NSOrderedSet *)set copyItems:(BOOL)flag; - (id)initWithOrderedSet:(NSOrderedSet *)set range:(NSRange)range copyItems:(BOOL)flag; - (id)initWithArray:(NSArray *)array; - (id)initWithArray:(NSArray *)set copyItems:(BOOL)flag; - (id)initWithArray:(NSArray *)set range:(NSRange)range copyItems:(BOOL)flag; - (id)initWithSet:(NSSet *)set; - (id)initWithSet:(NSSet *)set copyItems:(BOOL)flag; @end /**************** Mutable Ordered Set ****************/ NS_CLASS_AVAILABLE(10_7, 5_0) @interface NSMutableOrderedSet : NSOrderedSet - (void)insertObject:(id)object atIndex:(NSUInteger)idx; - (void)removeObjectAtIndex:(NSUInteger)idx; - (void)replaceObjectAtIndex:(NSUInteger)idx withObject:(id)object; @end @interface NSMutableOrderedSet (NSExtendedMutableOrderedSet) - (void)addObject:(id)object; - (void)addObjects:(const id [])objects count:(NSUInteger)count; - (void)addObjectsFromArray:(NSArray *)array; - (void)exchangeObjectAtIndex:(NSUInteger)idx1 withObjectAtIndex:(NSUInteger)idx2; - (void)moveObjectsAtIndexes:(NSIndexSet *)indexes toIndex:(NSUInteger)idx; - (void)insertObjects:(NSArray *)objects atIndexes:(NSIndexSet *)indexes; - (void)setObject:(id)obj atIndex:(NSUInteger)idx; - (void)setObject:(id)obj atIndexedSubscript:(NSUInteger)idx NS_AVAILABLE(10_8, 6_0); - (void)replaceObjectsInRange:(NSRange)range withObjects:(const id [])objects count:(NSUInteger)count; - (void)replaceObjectsAtIndexes:(NSIndexSet *)indexes withObjects:(NSArray *)objects; - (void)removeObjectsInRange:(NSRange)range; - (void)removeObjectsAtIndexes:(NSIndexSet *)indexes; - (void)removeAllObjects; - (void)removeObject:(id)object; - (void)removeObjectsInArray:(NSArray *)array; - (void)intersectOrderedSet:(NSOrderedSet *)other; - (void)minusOrderedSet:(NSOrderedSet *)other; - (void)unionOrderedSet:(NSOrderedSet *)other; - (void)intersectSet:(NSSet *)other; - (void)minusSet:(NSSet *)other; - (void)unionSet:(NSSet *)other; #if NS_BLOCKS_AVAILABLE - (void)sortUsingComparator:(NSComparator)cmptr; - (void)sortWithOptions:(NSSortOptions)opts usingComparator:(NSComparator)cmptr; - (void)sortRange:(NSRange)range options:(NSSortOptions)opts usingComparator:(NSComparator)cmptr; #endif @end @interface NSMutableOrderedSet (NSMutableOrderedSetCreation) + (id)orderedSetWithCapacity:(NSUInteger)numItems; - (id)initWithCapacity:(NSUInteger)numItems; @end /* NSOrthography.h Copyright (c) 2008-2012, Apple Inc. All rights reserved. */ #import @class NSString, NSArray, NSDictionary; /* NSOrthography is a class used to describe the linguistic content of a piece of text, especially for the purposes of spelling and grammar checking. It describes (a) which scripts the text contains, (b) a dominant language and possibly other languages for each of these scripts, and (c) a dominant script and language for the text as a whole. Scripts are uniformly described by standard four-letter tags (Latn, Grek, Cyrl, etc.) with the supertags Jpan and Kore typically used for Japanese and Korean text, Hans and Hant for Chinese text; the tag Zyyy is used if a specific script cannot be identified. Languages are uniformly described by BCP-47 tags, preferably in canonical form; the tag und is used if a specific language cannot be determined. */ NS_CLASS_AVAILABLE(10_6, 4_0) @interface NSOrthography : NSObject /* These are the primitive properties which a subclass must implement. The dominantScript should be a script tag (such as Latn, Cyrl, and so forth) and the languageMap should be a dictionary whose keys are script tags and whose values are arrays of language tags (such as en, fr, de, and so forth). */ @property (readonly) NSString *dominantScript; @property (readonly) NSDictionary *languageMap; @end @interface NSOrthography (NSOrthographyExtended) /* languagesForScript: returns the list of languages for the specified script, and dominantLanguageForScript: returns the first item on that list. */ - (NSArray *)languagesForScript:(NSString *)script; - (NSString *)dominantLanguageForScript:(NSString *)script; /* The dominantLanguage is the first in the list of languages for the dominant script, allScripts includes the dominant script and all others appearing as keys in the language map, and allLanguages includes all languages appearing in the values of the language map. */ @property (readonly) NSString *dominantLanguage; @property (readonly) NSArray *allScripts; @property (readonly) NSArray *allLanguages; @end @interface NSOrthography (NSOrthographyCreation) + (id)orthographyWithDominantScript:(NSString *)script languageMap:(NSDictionary *)map; - (id)initWithDominantScript:(NSString *)script languageMap:(NSDictionary *)map; @end /* NSPathUtilities.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import #import @interface NSString (NSStringPathExtensions) + (NSString *)pathWithComponents:(NSArray *)components; - (NSArray *)pathComponents; - (BOOL)isAbsolutePath; - (NSString *)lastPathComponent; - (NSString *)stringByDeletingLastPathComponent; - (NSString *)stringByAppendingPathComponent:(NSString *)str; - (NSString *)pathExtension; - (NSString *)stringByDeletingPathExtension; - (NSString *)stringByAppendingPathExtension:(NSString *)str; - (NSString *)stringByAbbreviatingWithTildeInPath; - (NSString *)stringByExpandingTildeInPath; - (NSString *)stringByStandardizingPath; - (NSString *)stringByResolvingSymlinksInPath; - (NSArray *)stringsByAppendingPaths:(NSArray *)paths; - (NSUInteger)completePathIntoString:(NSString **)outputName caseSensitive:(BOOL)flag matchesIntoArray:(NSArray **)outputArray filterTypes:(NSArray *)filterTypes; - (__strong const char *)fileSystemRepresentation NS_RETURNS_INNER_POINTER; - (BOOL)getFileSystemRepresentation:(char *)cname maxLength:(NSUInteger)max; @end @interface NSArray (NSArrayPathExtensions) - (NSArray *)pathsMatchingExtensions:(NSArray *)filterTypes; @end FOUNDATION_EXPORT NSString *NSUserName(void); FOUNDATION_EXPORT NSString *NSFullUserName(void); FOUNDATION_EXPORT NSString *NSHomeDirectory(void); FOUNDATION_EXPORT NSString *NSHomeDirectoryForUser(NSString *userName); FOUNDATION_EXPORT NSString *NSTemporaryDirectory(void); FOUNDATION_EXPORT NSString *NSOpenStepRootDirectory(void); typedef NS_ENUM(NSUInteger, NSSearchPathDirectory) { NSApplicationDirectory = 1, // supported applications (Applications) NSDemoApplicationDirectory, // unsupported applications, demonstration versions (Demos) NSDeveloperApplicationDirectory, // developer applications (Developer/Applications). DEPRECATED - there is no one single Developer directory. NSAdminApplicationDirectory, // system and network administration applications (Administration) NSLibraryDirectory, // various documentation, support, and configuration files, resources (Library) NSDeveloperDirectory, // developer resources (Developer) DEPRECATED - there is no one single Developer directory. NSUserDirectory, // user home directories (Users) NSDocumentationDirectory, // documentation (Documentation) NSDocumentDirectory, // documents (Documents) NSCoreServiceDirectory, // location of CoreServices directory (System/Library/CoreServices) NSAutosavedInformationDirectory NS_ENUM_AVAILABLE(10_6, 4_0) = 11, // location of autosaved documents (Documents/Autosaved) NSDesktopDirectory = 12, // location of user's desktop NSCachesDirectory = 13, // location of discardable cache files (Library/Caches) NSApplicationSupportDirectory = 14, // location of application support files (plug-ins, etc) (Library/Application Support) NSDownloadsDirectory NS_ENUM_AVAILABLE(10_5, 2_0) = 15, // location of the user's "Downloads" directory NSInputMethodsDirectory NS_ENUM_AVAILABLE(10_6, 4_0) = 16, // input methods (Library/Input Methods) NSMoviesDirectory NS_ENUM_AVAILABLE(10_6, 4_0) = 17, // location of user's Movies directory (~/Movies) NSMusicDirectory NS_ENUM_AVAILABLE(10_6, 4_0) = 18, // location of user's Music directory (~/Music) NSPicturesDirectory NS_ENUM_AVAILABLE(10_6, 4_0) = 19, // location of user's Pictures directory (~/Pictures) NSPrinterDescriptionDirectory NS_ENUM_AVAILABLE(10_6, 4_0) = 20, // location of system's PPDs directory (Library/Printers/PPDs) NSSharedPublicDirectory NS_ENUM_AVAILABLE(10_6, 4_0) = 21, // location of user's Public sharing directory (~/Public) NSPreferencePanesDirectory NS_ENUM_AVAILABLE(10_6, 4_0) = 22, // location of the PreferencePanes directory for use with System Preferences (Library/PreferencePanes) NSApplicationScriptsDirectory NS_ENUM_AVAILABLE(10_8, NA) = 23, // location of the user scripts folder for the calling application (~/Library/Application Scripts/code-signing-id) NSItemReplacementDirectory NS_ENUM_AVAILABLE(10_6, 4_0) = 99, // For use with NSFileManager's URLForDirectory:inDomain:appropriateForURL:create:error: NSAllApplicationsDirectory = 100, // all directories where applications can occur NSAllLibrariesDirectory = 101, // all directories where resources can occur NSTrashDirectory NS_ENUM_AVAILABLE(10_8, NA) = 102 // location of Trash directory }; typedef NS_OPTIONS(NSUInteger, NSSearchPathDomainMask) { NSUserDomainMask = 1, // user's home directory --- place to install user's personal items (~) NSLocalDomainMask = 2, // local to the current machine --- place to install items available to everyone on this machine (/Library) NSNetworkDomainMask = 4, // publically available location in the local area network --- place to install items available on the network (/Network) NSSystemDomainMask = 8, // provided by Apple, unmodifiable (/System) NSAllDomainsMask = 0x0ffff // all domains: all of the above and future items }; FOUNDATION_EXPORT NSArray *NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory directory, NSSearchPathDomainMask domainMask, BOOL expandTilde); /* * NSPointerArray.h * Copyright (c) 2005-2012, Apple Inc. All rights reserved. * */ #import #import #import /* NSPointerArray.h A PointerArray acts like a traditional array that slides elements on insertion or deletion. Unlike traditional arrays, it holds NULLs, which can be inserted or extracted (and contribute to count). Also unlike traditional arrays, the 'count' of the array may be set directly. Using NSPointerFunctionsWeakMemory object references will turn to NULL on last release (or when collected under GC). The copying and archiving protocols are applicable only when NSPointerArray is configured for Object uses. The fast enumeration protocol (supporting the for..in statement) will yield NULLs if present. It is defined for all types of pointers although the language syntax doesn't directly support this. */ NS_CLASS_AVAILABLE(10_5, 6_0) @interface NSPointerArray : NSObject // construction - initWithOptions:(NSPointerFunctionsOptions)options; - initWithPointerFunctions:(NSPointerFunctions *)functions; + pointerArrayWithOptions:(NSPointerFunctionsOptions)options; + pointerArrayWithPointerFunctions:(NSPointerFunctions *)functions; /* return an NSPointerFunctions object reflecting the functions in use. This is a new autoreleased object that can be subsequently modified and/or used directly in the creation of other pointer "collections". */ - (NSPointerFunctions *)pointerFunctions; - (void *)pointerAtIndex:(NSUInteger)index; // Array like operations that slide or grow contents, including NULLs - (void)addPointer:(void *)pointer; // add pointer at index 'count' - (void)removePointerAtIndex:(NSUInteger)index; // everything above index, including holes, slide lower - (void)insertPointer:(void *)item atIndex:(NSUInteger)index; // everything at & above index, including holes, slide higher - (void)replacePointerAtIndex:(NSUInteger)index withPointer:(void *)item; // O(1); NULL item is okay; index must be < count - (void)compact; // eliminate NULLs - (NSUInteger)count; // the number of elements in the array, including NULLs - (void)setCount:(NSUInteger)count; // set desired number of elements, adding NULLs or removing items as necessary. @end @interface NSPointerArray (NSPointerArrayConveniences) // construction #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) + pointerArrayWithStrongObjects NS_DEPRECATED_MAC(10_5, 10_8); // strong objects + pointerArrayWithWeakObjects NS_DEPRECATED_MAC(10_5, 10_8); // weak objects #endif + (id)strongObjectsPointerArray NS_AVAILABLE(10_8, 6_0); + (id)weakObjectsPointerArray NS_AVAILABLE(10_8, 6_0); - (NSArray *)allObjects; @end /* * NSPointerFunctions.h * * Copyright (c) 2005-2012, Apple Inc. All rights reserved. * */ #import #if !defined(__FOUNDATION_NSPOINTERFUNCTIONS__) #define __FOUNDATION_NSPOINTERFUNCTIONS__ 1 /* NSPointerFunctions This object defines callout functions appropriate for managing a pointer reference held somewhere else. Used by NSHashTable, NSMapTable, and NSPointerArray, this object defines the acquision and retention behavior for the pointers provided to these collection objects. The functions are separated into two clusters - those that define "personality", such as object or cString, and those that describe memory management issues such as a memory deallocation function. Common personalities and memory manager selections are provided as enumerations, and further customization is provided by methods such that the composition of the actual list of functions is done opaquely such that they can be extended in the future. The pointer collections copy NSPointerFunctions objects on input and output, and so NSPointerFunctions is not usefully subclassed. */ enum { // Memory options are mutually exclusive // default is strong NSPointerFunctionsStrongMemory NS_ENUM_AVAILABLE(10_5, 6_0) = (0UL << 0), // use strong write-barrier to backing store; use GC memory on copyIn #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || TARGET_OS_WIN32 NSPointerFunctionsZeroingWeakMemory NS_ENUM_DEPRECATED_MAC(10_5, 10_8) = (1UL << 0), // deprecated; uses GC weak read and write barriers, and dangling pointer behavior otherwise #endif NSPointerFunctionsOpaqueMemory NS_ENUM_AVAILABLE(10_5, 6_0) = (2UL << 0), NSPointerFunctionsMallocMemory NS_ENUM_AVAILABLE(10_5, 6_0) = (3UL << 0), // free() will be called on removal, calloc on copyIn NSPointerFunctionsMachVirtualMemory NS_ENUM_AVAILABLE(10_5, 6_0) = (4UL << 0), NSPointerFunctionsWeakMemory NS_ENUM_AVAILABLE(10_8, 6_0) = (5UL << 0), // uses weak read and write barriers appropriate for ARC or GC // Personalities are mutually exclusive // default is object. As a special case, 'strong' memory used for Objects will do retain/release under non-GC NSPointerFunctionsObjectPersonality NS_ENUM_AVAILABLE(10_5, 6_0) = (0UL << 8), // use -hash and -isEqual, object description NSPointerFunctionsOpaquePersonality NS_ENUM_AVAILABLE(10_5, 6_0) = (1UL << 8), // use shifted pointer hash and direct equality NSPointerFunctionsObjectPointerPersonality NS_ENUM_AVAILABLE(10_5, 6_0) = (2UL << 8), // use shifted pointer hash and direct equality, object description NSPointerFunctionsCStringPersonality NS_ENUM_AVAILABLE(10_5, 6_0) = (3UL << 8), // use a string hash and strcmp, description assumes UTF-8 contents; recommended for UTF-8 (or ASCII, which is a subset) only cstrings NSPointerFunctionsStructPersonality NS_ENUM_AVAILABLE(10_5, 6_0) = (4UL << 8), // use a memory hash and memcmp (using size function you must set) NSPointerFunctionsIntegerPersonality NS_ENUM_AVAILABLE(10_5, 6_0) = (5UL << 8), // use unshifted value as hash & equality NSPointerFunctionsCopyIn NS_ENUM_AVAILABLE(10_5, 6_0) = (1UL << 16), // the memory acquire function will be asked to allocate and copy items on input }; typedef NSUInteger NSPointerFunctionsOptions; NS_CLASS_AVAILABLE(10_5, 6_0) @interface NSPointerFunctions : NSObject // construction - (id)initWithOptions:(NSPointerFunctionsOptions)options; + (id)pointerFunctionsWithOptions:(NSPointerFunctionsOptions)options; // pointer personality functions @property NSUInteger (*hashFunction)(const void *item, NSUInteger (*size)(const void *item)); @property BOOL (*isEqualFunction)(const void *item1, const void*item2, NSUInteger (*size)(const void *item)); @property NSUInteger (*sizeFunction)(const void *item); @property NSString *(*descriptionFunction)(const void *item); // custom memory configuration @property void (*relinquishFunction)(const void *item, NSUInteger (*size)(const void *item)); @property void *(*acquireFunction)(const void *src, NSUInteger (*size)(const void *item), BOOL shouldCopy); // GC requires that read and write barrier functions be used when pointers are from GC memory @property BOOL usesStrongWriteBarrier; // pointers should (not) be assigned using the GC strong write barrier @property BOOL usesWeakReadAndWriteBarriers; // pointers should (not) use GC weak read and write barriers @end #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || TARGET_OS_WIN32 #else #if defined(__has_include) #if __has_include() #include #endif #endif #endif /* Cheat Sheet Long Integers (other than zero) (NSPointerFunctionsOpaqueMemory | NSPointerFunctionsIntegerPersonality) useful for, well, anything that can be jammed into a long int Strongly held objects (NSPointerFunctionsStrongMemory | NSPointerFunctionsObjectPersonality) used for retained objects under ARC and/or manual retain-release, or GC; uses isEqual: as necessary Zeroing weak object references (NSPointerFunctionsWeakMemory | NSPointerFunctionsObjectPersonality) used to hold references that won't keep the object alive. Note that objects implementing custom retain-release must also implement allowsWeakReference and retainWeakReference (or are using GC instead) Unsafe unretained objects (NSPointerFunctionsOpaqueMemory | NSPointerFunctionsObjectPersonality) used where zeroing weak is not possible and where, somehow, the objects are removed before being deallocated. C String where table keeps copy (NSPointerFunctionsStrongMemory | NSPointerFunctionsCStringPersonality | NSPointerFunctionsCopyIn) used to capture a null-terminated string from a source with unknown lifetime. Keeps string alive under GC. Under ARC/RR, table will deallocate its copy when removed. Generally, "C Strings" is a term for UTF8 strings as well. C String, owned elsewhere (NSPointerFunctionsOpaqueMemory | NSPointerFunctionsCStringPersonality) used to hold C string pointers to storage not at all managed by the table. The NSPointerFunctionsObjectPersonality dictates using isEqual: for the equality test. In some situations == should be used, such as when trying to build a cache of unique immutable "value" objects that implement isEqual:. In those cases use NSPointerFunctionsObjectPointerPersonality instead. Deprecated GC Zeroing - ARC/RR unsafe weak (NSPointerFunctionsZeroingWeakMemory | NSPointerFunctionsObjectPersonality) under GC these are zeroing weak but under manual retain-release (or ARC) these are unsafe unretained. Move to NSPointerFunctionsWeakMemory or NSPointerFunctionsOpaqueMemory instead. Example Lets say you have a source of C Strings that often repeat and you need to provide unique NSString counterparts. For this you likely want a NSMapTable with strong copy-in C Strings as the keys and weak NSString values. As long as the NSString counterparts are in use, they stay in the table and don't need to be created each time they show up. NSMapTable *mt = [[NSMapTable alloc] initWithKeyOptions: (NSPointerFunctionsStrongMemory | NSPointerFunctionsCStringPersonality | NSPointerFunctionsCopyIn) valueOptions:(NSPointerFunctionsWeakMemory | NSPointerFunctionsObjectPersonality) capacity:0]; ... // given a C string, look it up and, if not found, create and save the NSString version in the table const char *cString = ...; NSString *result = [mt objectForKey:(id)cString]; if (!result) { result = [NSString stringWithCString:cString]; [mt setObject:result forKey:(id)cString]; } return result; */ #endif /* NSPort.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import typedef int NSSocketNativeHandle; @class NSRunLoop, NSMutableArray, NSDate; @class NSConnection, NSPortMessage; @class NSData; @protocol NSPortDelegate, NSMachPortDelegate; FOUNDATION_EXPORT NSString * const NSPortDidBecomeInvalidNotification; @interface NSPort : NSObject // For backwards compatibility on Mach, +allocWithZone: returns // an instance of the NSMachPort class when sent to the NSPort // class. Otherwise, it returns an instance of a concrete // subclass which can be used for messaging between threads // or processes on the local machine. + (NSPort *)port; - (void)invalidate; - (BOOL)isValid; - (void)setDelegate:(id )anObject; - (id )delegate; // These two methods should be implemented by subclasses // to setup monitoring of the port when added to a run loop, // and stop monitoring if needed when removed; // These methods should not be called directly! - (void)scheduleInRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode; - (void)removeFromRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode; // DO Transport API; subclassers should implement these methods - (NSUInteger)reservedSpaceLength; // default is 0 - (BOOL)sendBeforeDate:(NSDate *)limitDate components:(NSMutableArray *)components from:(NSPort *) receivePort reserved:(NSUInteger)headerSpaceReserved; - (BOOL)sendBeforeDate:(NSDate *)limitDate msgid:(NSUInteger)msgID components:(NSMutableArray *)components from:(NSPort *)receivePort reserved:(NSUInteger)headerSpaceReserved; // The components array consists of a series of instances // of some subclass of NSData, and instances of some // subclass of NSPort; since one subclass of NSPort does // not necessarily know how to transport an instance of // another subclass of NSPort (or could do it even if it // knew about the other subclass), all of the instances // of NSPort in the components array and the 'receivePort' // argument MUST be of the same subclass of NSPort that // receives this message. If multiple DO transports are // being used in the same program, this requires some care. #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || (TARGET_OS_WIN32) - (void)addConnection:(NSConnection *)conn toRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode; - (void)removeConnection:(NSConnection *)conn fromRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode; // The default implementation of these two methods is to // simply add the receiving port to the run loop in the // given mode. Subclassers need not override these methods, // but can if they need to do extra work. #endif @end @protocol NSPortDelegate @optional - (void)handlePortMessage:(NSPortMessage *)message; // This is the delegate method that subclasses should send // to their delegates, unless the subclass has something // more specific that it wants to try to send first @end #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) NS_AUTOMATED_REFCOUNT_WEAK_UNAVAILABLE @interface NSMachPort : NSPort { @private id _delegate; NSUInteger _flags; uint32_t _machPort; NSUInteger _reserved; } + (NSPort *)portWithMachPort:(uint32_t)machPort; - (id)initWithMachPort:(uint32_t)machPort; // designated initializer - (void)setDelegate:(id )anObject; - (id )delegate; enum { NSMachPortDeallocateNone = 0, NSMachPortDeallocateSendRight = (1UL << 0), NSMachPortDeallocateReceiveRight = (1UL << 1) } NS_ENUM_AVAILABLE(10_5, 2_0); + (NSPort *)portWithMachPort:(uint32_t)machPort options:(NSUInteger)f NS_AVAILABLE(10_5, 2_0); - (id)initWithMachPort:(uint32_t)machPort options:(NSUInteger)f NS_AVAILABLE(10_5, 2_0); - (uint32_t)machPort; - (void)scheduleInRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode; - (void)removeFromRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode; // If you subclass NSMachPort, you have to override these 2 // methods from NSPort; since this is complicated, subclassing // NSMachPort is not recommended @end @protocol NSMachPortDelegate @optional // Delegates are sent this if they respond, otherwise they // are sent handlePortMessage:; argument is the raw Mach message - (void)handleMachMessage:(void *)msg; @end #endif // A subclass of NSPort which can be used for local // message sending on all platforms. NS_AUTOMATED_REFCOUNT_WEAK_UNAVAILABLE @interface NSMessagePort : NSPort { @private void * __strong _port; id _delegate; } @end #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || TARGET_OS_WIN32 || TARGET_IPHONE_SIMULATOR // A subclass of NSPort which can be used for remote // message sending on all platforms. @interface NSSocketPort : NSPort { @private void * __strong _receiver; id _connectors; void * __strong _loops; void * __strong _data; id _signature; id _delegate; id _lock; NSUInteger _maxSize; NSUInteger _useCount; NSUInteger _reserved; } - (id)init; - (id)initWithTCPPort:(unsigned short)port; - (id)initWithProtocolFamily:(int)family socketType:(int)type protocol:(int)protocol address:(NSData *)address; - (id)initWithProtocolFamily:(int)family socketType:(int)type protocol:(int)protocol socket:(NSSocketNativeHandle)sock; - (id)initRemoteWithTCPPort:(unsigned short)port host:(NSString *)hostName; - (id)initRemoteWithProtocolFamily:(int)family socketType:(int)type protocol:(int)protocol address:(NSData *)address; - (int)protocolFamily; - (int)socketType; - (int)protocol; - (NSData *)address; - (NSSocketNativeHandle)socket; @end #endif /* NSPredicate.h Copyright (c) 2004-2012, Apple Inc. All rights reserved. */ #import #import #import // Predicates wrap some combination of expressions and operators and when evaluated return a BOOL. NS_CLASS_AVAILABLE(10_4, 3_0) @interface NSPredicate : NSObject { void *_reserved; } // Parse predicateFormat and return an appropriate predicate + (NSPredicate *)predicateWithFormat:(NSString *)predicateFormat argumentArray:(NSArray *)arguments; + (NSPredicate *)predicateWithFormat:(NSString *)predicateFormat, ...; + (NSPredicate *)predicateWithFormat:(NSString *)predicateFormat arguments:(va_list)argList; + (NSPredicate *)predicateWithValue:(BOOL)value; // return predicates that always evaluate to true/false #if NS_BLOCKS_AVAILABLE + (NSPredicate*)predicateWithBlock:(BOOL (^)(id evaluatedObject, NSDictionary *bindings))block NS_AVAILABLE(10_6, 4_0); #endif - (NSString *)predicateFormat; // returns the format string of the predicate - (NSPredicate *)predicateWithSubstitutionVariables:(NSDictionary *)variables; // substitute constant values for variables - (BOOL)evaluateWithObject:(id)object; // evaluate a predicate against a single object - (BOOL)evaluateWithObject:(id)object substitutionVariables:(NSDictionary *)bindings NS_AVAILABLE(10_5, 3_0); // single pass evaluation substituting variables from the bindings dictionary for any variable expressions encountered @end @interface NSArray (NSPredicateSupport) - (NSArray *)filteredArrayUsingPredicate:(NSPredicate *)predicate; // evaluate a predicate against an array of objects and return a filtered array @end @interface NSMutableArray (NSPredicateSupport) - (void)filterUsingPredicate:(NSPredicate *)predicate; // evaluate a predicate against an array of objects and filter the mutable array directly @end @interface NSSet (NSPredicateSupport) - (NSSet *)filteredSetUsingPredicate:(NSPredicate *)predicate NS_AVAILABLE(10_5, 3_0); // evaluate a predicate against a set of objects and return a filtered set @end @interface NSMutableSet (NSPredicateSupport) - (void)filterUsingPredicate:(NSPredicate *)predicate NS_AVAILABLE(10_5, 3_0); // evaluate a predicate against a set of objects and filter the mutable set directly @end /* NSProcessInfo.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import #import enum { /* Constants returned by -operatingSystem */ NSWindowsNTOperatingSystem = 1, NSWindows95OperatingSystem, NSSolarisOperatingSystem, NSHPUXOperatingSystem, NSMACHOperatingSystem, NSSunOSOperatingSystem, NSOSF1OperatingSystem }; @class NSArray, NSString, NSDictionary; @interface NSProcessInfo : NSObject { @private NSDictionary *environment; NSArray *arguments; NSString *hostName; NSString *name; NSInteger automaticTerminationOptOutCounter; } + (NSProcessInfo *)processInfo; - (NSDictionary *)environment; - (NSArray *)arguments; - (NSString *)hostName; - (NSString *)processName; - (int)processIdentifier; - (void)setProcessName:(NSString *)newName; - (NSString *)globallyUniqueString; - (NSUInteger)operatingSystem; - (NSString *)operatingSystemName; - (NSString *)operatingSystemVersionString; /* Human readable, localized; appropriate for displaying to user or using in bug emails and such; NOT appropriate for parsing */ - (NSUInteger)processorCount NS_AVAILABLE(10_5, 2_0); - (NSUInteger)activeProcessorCount NS_AVAILABLE(10_5, 2_0); - (unsigned long long)physicalMemory NS_AVAILABLE(10_5, 2_0); - (NSTimeInterval)systemUptime NS_AVAILABLE(10_6, 4_0); /* Disable or reenable the ability to be quickly killed. The default implementations of these methods increment or decrement, respectively, a counter whose value is 1 when the process is first created. When the counter's value is 0 the application is considered to be safely killable and may be killed by the operating system without any notification or event being sent to the process first. If an application's Info.plist has an NSSupportsSuddenTermination entry whose value is true then NSApplication invokes -enableSuddenTermination automatically during application launch, which typically renders the process killable right away. You can also manually invoke -enableSuddenTermination right away in, for example, agents or daemons that don't depend on AppKit. After that, you can invoke these methods whenever the process has work it must do before it terminates. For example: - NSUserDefaults uses these to prevent process killing between the time at which a default has been set and the time at which the preferences file including that default has been written to disk. - NSDocument uses these to prevent process killing between the time at which the user has made a change to a document and the time at which the user's change has been written to disk. - You can use these whenever your application defers work that must be done before the application terminates. If for example your application ever defers writing something to disk, and it has an NSSupportsSuddenTermination entry in its Info.plist so as not to contribute to user-visible delays at logout or shutdown time, it must invoke -disableSuddenTermination when the writing is first deferred and -enableSuddenTermination after the writing is actually done. */ - (void)disableSuddenTermination NS_AVAILABLE(10_6, NA); - (void)enableSuddenTermination NS_AVAILABLE(10_6, NA); /* * Increment or decrement the counter tracking the number of automatic quit opt-out requests. When this counter is greater than zero, the app will be considered 'active' and ineligible for automatic termination. * An example of using this would be disabling autoquitting when the user of an instant messaging application signs on, due to it requiring a background connection to be maintained even if the app is otherwise inactive. * Each pair of calls should have a matching "reason" argument, which can be used to easily track why an application is or is not automatically terminable. * A given reason can be used more than once at the same time (for example: two files are transferring over the network, each one disables automatic termination with the reason @"file transfer in progress") */ - (void)disableAutomaticTermination:(NSString *)reason NS_AVAILABLE(10_7, NA); - (void)enableAutomaticTermination:(NSString *)reason NS_AVAILABLE(10_7, NA); /* * Marks the calling app as supporting automatic termination. Without calling this or setting the equivalent Info.plist key (NSSupportsAutomaticTermination), the above methods (disableAutomaticTermination:/enableAutomaticTermination:) have no effect, * although the counter tracking automatic termination opt-outs is still kept up to date to ensure correctness if this is called later. Currently, passing NO has no effect. * This should be called during -applicationDidFinishLaunching or earlier. */ - (void) setAutomaticTerminationSupportEnabled:(BOOL)flag NS_AVAILABLE(10_7, NA); - (BOOL) automaticTerminationSupportEnabled NS_AVAILABLE(10_7, NA); @end /* NSPropertyList.h Copyright (c) 2002-2012, Apple Inc. All rights reserved. */ #import #include @class NSData, NSString, NSError, NSInputStream, NSOutputStream; typedef NS_OPTIONS(NSUInteger, NSPropertyListMutabilityOptions) { NSPropertyListImmutable = kCFPropertyListImmutable, NSPropertyListMutableContainers = kCFPropertyListMutableContainers, NSPropertyListMutableContainersAndLeaves = kCFPropertyListMutableContainersAndLeaves }; typedef NS_ENUM(NSUInteger, NSPropertyListFormat) { NSPropertyListOpenStepFormat = kCFPropertyListOpenStepFormat, NSPropertyListXMLFormat_v1_0 = kCFPropertyListXMLFormat_v1_0, NSPropertyListBinaryFormat_v1_0 = kCFPropertyListBinaryFormat_v1_0 }; typedef NSUInteger NSPropertyListReadOptions; typedef NSUInteger NSPropertyListWriteOptions; @interface NSPropertyListSerialization : NSObject { void *reserved[6]; } /* Verify that a specified property list is valid for a given format. Returns YES if the property list is valid. */ + (BOOL)propertyList:(id)plist isValidForFormat:(NSPropertyListFormat)format; /* Create an NSData from a property list. The format can be either NSPropertyListXMLFormat_v1_0 or NSPropertyListBinaryFormat_v1_0. The options parameter is currently unused and should be set to 0. If an error occurs the return value will be nil and the error parameter (if non-NULL) set to an autoreleased NSError describing the problem. */ + (NSData *)dataWithPropertyList:(id)plist format:(NSPropertyListFormat)format options:(NSPropertyListWriteOptions)opt error:(out NSError **)error NS_AVAILABLE(10_6, 4_0); /* Write a property list to an output stream. The stream should be opened and configured. The format can be either NSPropertyListXMLFormat_v1_0 or NSPropertyListBinaryFormat_v1_0. The options parameter is currently unused and should be set to 0. If an error occurs the return value will be 0 and the error parameter (if non-NULL) set to an autoreleased NSError describing the problem. In a successful case, the return value is the number of bytes written to the stream. */ + (NSInteger)writePropertyList:(id)plist toStream:(NSOutputStream *)stream format:(NSPropertyListFormat)format options:(NSPropertyListWriteOptions)opt error:(out NSError **)error NS_AVAILABLE(10_6, 4_0); /* Create a property list from an NSData. The options can be any of NSPropertyListMutabilityOptions. If the format parameter is non-NULL, it will be filled out with the format that the property list was stored in. If an error occurs the return value will be nil and the error parameter (if non-NULL) set to an autoreleased NSError describing the problem. */ + (id)propertyListWithData:(NSData *)data options:(NSPropertyListReadOptions)opt format:(NSPropertyListFormat *)format error:(out NSError **)error NS_AVAILABLE(10_6, 4_0); /* Create a property list by reading from an NSInputStream. The options can be any of NSPropertyListMutabilityOptions. If the format parameter is non-NULL, it will be filled out with the format that the property list was stored in. If an error occurs the return value will be nil and the error parameter (if non-NULL) set to an autoreleased NSError describing the problem. */ + (id)propertyListWithStream:(NSInputStream *)stream options:(NSPropertyListReadOptions)opt format:(NSPropertyListFormat *)format error:(out NSError **)error NS_AVAILABLE(10_6, 4_0); /* This method is obsolete and will be deprecated soon. Use dataWithPropertyList:format:options:error: instead. */ + (NSData *)dataFromPropertyList:(id)plist format:(NSPropertyListFormat)format errorDescription:(out __strong NSString **)errorString; /* This method is obsolete and will be deprecated soon. Use propertyListWithData:options:format:error: instead. */ + (id)propertyListFromData:(NSData *)data mutabilityOption:(NSPropertyListMutabilityOptions)opt format:(NSPropertyListFormat *)format errorDescription:(out __strong NSString **)errorString; @end /* NSProxy.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import @class NSMethodSignature, NSInvocation; NS_ROOT_CLASS @interface NSProxy { Class isa; } + (id)alloc; + (id)allocWithZone:(NSZone *)zone NS_AUTOMATED_REFCOUNT_UNAVAILABLE; + (Class)class; - (void)forwardInvocation:(NSInvocation *)invocation; - (NSMethodSignature *)methodSignatureForSelector:(SEL)sel; - (void)dealloc; - (void)finalize; - (NSString *)description; - (NSString *)debugDescription; + (BOOL)respondsToSelector:(SEL)aSelector; - (BOOL)allowsWeakReference NS_UNAVAILABLE; - (BOOL)retainWeakReference NS_UNAVAILABLE; // - (id)forwardingTargetForSelector:(SEL)aSelector; @end /* NSRange.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import #import @class NSString; typedef struct _NSRange { NSUInteger location; NSUInteger length; } NSRange; typedef NSRange *NSRangePointer; NS_INLINE NSRange NSMakeRange(NSUInteger loc, NSUInteger len) { NSRange r; r.location = loc; r.length = len; return r; } NS_INLINE NSUInteger NSMaxRange(NSRange range) { return (range.location + range.length); } NS_INLINE BOOL NSLocationInRange(NSUInteger loc, NSRange range) { return (loc - range.location < range.length); } NS_INLINE BOOL NSEqualRanges(NSRange range1, NSRange range2) { return (range1.location == range2.location && range1.length == range2.length); } FOUNDATION_EXPORT NSRange NSUnionRange(NSRange range1, NSRange range2); FOUNDATION_EXPORT NSRange NSIntersectionRange(NSRange range1, NSRange range2); FOUNDATION_EXPORT NSString *NSStringFromRange(NSRange range); FOUNDATION_EXPORT NSRange NSRangeFromString(NSString *aString); @interface NSValue (NSValueRangeExtensions) + (NSValue *)valueWithRange:(NSRange)range; - (NSRange)rangeValue; @end /* NSRegularExpression.h Copyright (c) 2009-2012, Apple Inc. All rights reserved. */ #import #import #import @class NSArray; /* NSRegularExpression is a class used to represent and apply regular expressions. An instance of this class is an immutable representation of a compiled regular expression pattern and various option flags. */ typedef NS_OPTIONS(NSUInteger, NSRegularExpressionOptions) { NSRegularExpressionCaseInsensitive = 1 << 0, /* Match letters in the pattern independent of case. */ NSRegularExpressionAllowCommentsAndWhitespace = 1 << 1, /* Ignore whitespace and #-prefixed comments in the pattern. */ NSRegularExpressionIgnoreMetacharacters = 1 << 2, /* Treat the entire pattern as a literal string. */ NSRegularExpressionDotMatchesLineSeparators = 1 << 3, /* Allow . to match any character, including line separators. */ NSRegularExpressionAnchorsMatchLines = 1 << 4, /* Allow ^ and $ to match the start and end of lines. */ NSRegularExpressionUseUnixLineSeparators = 1 << 5, /* Treat only \n as a line separator (otherwise, all standard line separators are used). */ NSRegularExpressionUseUnicodeWordBoundaries = 1 << 6 /* Use Unicode TR#29 to specify word boundaries (otherwise, traditional regular expression word boundaries are used). */ }; NS_CLASS_AVAILABLE(10_7, 4_0) @interface NSRegularExpression : NSObject { @protected // all instance variables are private NSString *_pattern; NSUInteger _options; void *_internal; id _reserved1; int32_t _checkout; int32_t _reserved2; } /* An instance of NSRegularExpression is created from a regular expression pattern and a set of options. If the pattern is invalid, nil will be returned and an NSError will be returned by reference. The pattern syntax currently supported is that specified by ICU. */ + (NSRegularExpression *)regularExpressionWithPattern:(NSString *)pattern options:(NSRegularExpressionOptions)options error:(NSError **)error; - (id)initWithPattern:(NSString *)pattern options:(NSRegularExpressionOptions)options error:(NSError **)error; @property (readonly) NSString *pattern; @property (readonly) NSRegularExpressionOptions options; @property (readonly) NSUInteger numberOfCaptureGroups; /* This class method will produce a string by adding backslash escapes as necessary to the given string, to escape any characters that would otherwise be treated as pattern metacharacters. */ + (NSString *)escapedPatternForString:(NSString *)string; @end typedef NS_OPTIONS(NSUInteger, NSMatchingOptions) { NSMatchingReportProgress = 1 << 0, /* Call the block periodically during long-running match operations. */ NSMatchingReportCompletion = 1 << 1, /* Call the block once after the completion of any matching. */ NSMatchingAnchored = 1 << 2, /* Limit matches to those at the start of the search range. */ NSMatchingWithTransparentBounds = 1 << 3, /* Allow matching to look beyond the bounds of the search range. */ NSMatchingWithoutAnchoringBounds = 1 << 4 /* Prevent ^ and $ from automatically matching the beginning and end of the search range. */ }; typedef NS_OPTIONS(NSUInteger, NSMatchingFlags) { NSMatchingProgress = 1 << 0, /* Set when the block is called to report progress during a long-running match operation. */ NSMatchingCompleted = 1 << 1, /* Set when the block is called after completion of any matching. */ NSMatchingHitEnd = 1 << 2, /* Set when the current match operation reached the end of the search range. */ NSMatchingRequiredEnd = 1 << 3, /* Set when the current match depended on the location of the end of the search range. */ NSMatchingInternalError = 1 << 4 /* Set when matching failed due to an internal error. */ }; @interface NSRegularExpression (NSMatching) /* The fundamental matching method on NSRegularExpression is a block iterator. There are several additional convenience methods, for returning all matches at once, the number of matches, the first match, or the range of the first match. Each match is specified by an instance of NSTextCheckingResult (of type NSTextCheckingTypeRegularExpression) in which the overall match range is given by the range property (equivalent to rangeAtIndex:0) and any capture group ranges are given by rangeAtIndex: for indexes from 1 to numberOfCaptureGroups. {NSNotFound, 0} is used if a particular capture group does not participate in the match. */ #if NS_BLOCKS_AVAILABLE - (void)enumerateMatchesInString:(NSString *)string options:(NSMatchingOptions)options range:(NSRange)range usingBlock:(void (^)(NSTextCheckingResult *result, NSMatchingFlags flags, BOOL *stop))block; #endif /* NS_BLOCKS_AVAILABLE */ - (NSArray *)matchesInString:(NSString *)string options:(NSMatchingOptions)options range:(NSRange)range; - (NSUInteger)numberOfMatchesInString:(NSString *)string options:(NSMatchingOptions)options range:(NSRange)range; - (NSTextCheckingResult *)firstMatchInString:(NSString *)string options:(NSMatchingOptions)options range:(NSRange)range; - (NSRange)rangeOfFirstMatchInString:(NSString *)string options:(NSMatchingOptions)options range:(NSRange)range; /* By default, the block iterator method calls the block precisely once for each match, with a non-nil result and appropriate flags. The client may then stop the operation by setting the contents of stop to YES. If the NSMatchingReportProgress option is specified, the block will also be called periodically during long-running match operations, with nil result and NSMatchingProgress set in the flags, at which point the client may again stop the operation by setting the contents of stop to YES. If the NSMatchingReportCompletion option is specified, the block will be called once after matching is complete, with nil result and NSMatchingCompleted set in the flags, plus any additional relevant flags from among NSMatchingHitEnd, NSMatchingRequiredEnd, or NSMatchingInternalError. NSMatchingReportProgress and NSMatchingReportCompletion have no effect for methods other than the block iterator. NSMatchingHitEnd is set in the flags passed to the block if the current match operation reached the end of the search range. NSMatchingRequiredEnd is set in the flags passed to the block if the current match depended on the location of the end of the search range. NSMatchingInternalError is set in the flags passed to the block if matching failed due to an internal error (such as an expression requiring exponential memory allocations) without examining the entire search range. NSMatchingAnchored, NSMatchingWithTransparentBounds, and NSMatchingWithoutAnchoringBounds can apply to any match or replace method. If NSMatchingAnchored is specified, matches are limited to those at the start of the search range. If NSMatchingWithTransparentBounds is specified, matching may examine parts of the string beyond the bounds of the search range, for purposes such as word boundary detection, lookahead, etc. If NSMatchingWithoutAnchoringBounds is specified, ^ and $ will not automatically match the beginning and end of the search range (but will still match the beginning and end of the entire string). NSMatchingWithTransparentBounds and NSMatchingWithoutAnchoringBounds have no effect if the search range covers the entire string. NSRegularExpression is designed to be immutable and threadsafe, so that a single instance can be used in matching operations on multiple threads at once. However, the string on which it is operating should not be mutated during the course of a matching operation (whether from another thread or from within the block used in the iteration). */ @end @interface NSRegularExpression (NSReplacement) /* NSRegularExpression also provides find-and-replace methods for both immutable and mutable strings. The replacement is treated as a template, with $0 being replaced by the contents of the matched range, $1 by the contents of the first capture group, and so on. Additional digits beyond the maximum required to represent the number of capture groups will be treated as ordinary characters, as will a $ not followed by digits. Backslash will escape both $ and itself. */ - (NSString *)stringByReplacingMatchesInString:(NSString *)string options:(NSMatchingOptions)options range:(NSRange)range withTemplate:(NSString *)templ; - (NSUInteger)replaceMatchesInString:(NSMutableString *)string options:(NSMatchingOptions)options range:(NSRange)range withTemplate:(NSString *)templ; /* For clients implementing their own replace functionality, this is a method to perform the template substitution for a single result, given the string from which the result was matched, an offset to be added to the location of the result in the string (for example, in case modifications to the string moved the result since it was matched), and a replacement template. */ - (NSString *)replacementStringForResult:(NSTextCheckingResult *)result inString:(NSString *)string offset:(NSInteger)offset template:(NSString *)templ; /* This class method will produce a string by adding backslash escapes as necessary to the given string, to escape any characters that would otherwise be treated as template metacharacters. */ + (NSString *)escapedTemplateForString:(NSString *)string; @end NS_CLASS_AVAILABLE(10_7, 4_0) @interface NSDataDetector : NSRegularExpression { @protected // all instance variables are private NSTextCheckingTypes _types; } /* NSDataDetector is a specialized subclass of NSRegularExpression. Instead of finding matches to regular expression patterns, it matches items identified by Data Detectors, such as dates, addresses, and URLs. The checkingTypes argument should contain one or more of the types NSTextCheckingTypeDate, NSTextCheckingTypeAddress, NSTextCheckingTypeLink, NSTextCheckingTypePhoneNumber, and NSTextCheckingTypeTransitInformation. The NSTextCheckingResult instances returned will be of the appropriate types from that list. */ + (NSDataDetector *)dataDetectorWithTypes:(NSTextCheckingTypes)checkingTypes error:(NSError **)error; - (id)initWithTypes:(NSTextCheckingTypes)checkingTypes error:(NSError **)error; @property (readonly) NSTextCheckingTypes checkingTypes; @end /* NSRunLoop.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import #import #import @class NSTimer, NSPort, NSArray; FOUNDATION_EXPORT NSString * const NSDefaultRunLoopMode; FOUNDATION_EXPORT NSString * const NSRunLoopCommonModes NS_AVAILABLE(10_5, 2_0); @interface NSRunLoop : NSObject { @private id _rl; id _dperf; id _perft; id _info; id _ports; void *_reserved[6]; } + (NSRunLoop *)currentRunLoop; + (NSRunLoop *)mainRunLoop NS_AVAILABLE(10_5, 2_0); - (NSString *)currentMode; - (CFRunLoopRef)getCFRunLoop; - (void)addTimer:(NSTimer *)timer forMode:(NSString *)mode; - (void)addPort:(NSPort *)aPort forMode:(NSString *)mode; - (void)removePort:(NSPort *)aPort forMode:(NSString *)mode; - (NSDate *)limitDateForMode:(NSString *)mode; - (void)acceptInputForMode:(NSString *)mode beforeDate:(NSDate *)limitDate; @end @interface NSRunLoop (NSRunLoopConveniences) - (void)run; - (void)runUntilDate:(NSDate *)limitDate; - (BOOL)runMode:(NSString *)mode beforeDate:(NSDate *)limitDate; #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) - (void)configureAsServer NS_DEPRECATED(10_0, 10_5, 2_0, 2_0); #endif @end /**************** Delayed perform ******************/ @interface NSObject (NSDelayedPerforming) - (void)performSelector:(SEL)aSelector withObject:(id)anArgument afterDelay:(NSTimeInterval)delay inModes:(NSArray *)modes; - (void)performSelector:(SEL)aSelector withObject:(id)anArgument afterDelay:(NSTimeInterval)delay; + (void)cancelPreviousPerformRequestsWithTarget:(id)aTarget selector:(SEL)aSelector object:(id)anArgument; + (void)cancelPreviousPerformRequestsWithTarget:(id)aTarget; @end @interface NSRunLoop (NSOrderedPerform) - (void)performSelector:(SEL)aSelector target:(id)target argument:(id)arg order:(NSUInteger)order modes:(NSArray *)modes; - (void)cancelPerformSelector:(SEL)aSelector target:(id)target argument:(id)arg; - (void)cancelPerformSelectorsWithTarget:(id)target; @end /* NSScanner.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import @class NSString, NSCharacterSet, NSDictionary; @interface NSScanner : NSObject - (NSString *)string; - (NSUInteger)scanLocation; - (void)setScanLocation:(NSUInteger)pos; - (void)setCharactersToBeSkipped:(NSCharacterSet *)set; - (void)setCaseSensitive:(BOOL)flag; - (void)setLocale:(id)locale; @end @interface NSScanner (NSExtendedScanner) - (NSCharacterSet *)charactersToBeSkipped; - (BOOL)caseSensitive; - (id)locale; - (BOOL)scanInt:(int *)value; - (BOOL)scanInteger:(NSInteger *)value NS_AVAILABLE(10_5, 2_0); - (BOOL)scanHexLongLong:(unsigned long long *)result NS_AVAILABLE(10_5, 2_0); - (BOOL)scanHexFloat:(float *)result NS_AVAILABLE(10_5, 2_0); // Corresponding to %a or %A formatting. Requires "0x" or "0X" prefix. - (BOOL)scanHexDouble:(double *)result NS_AVAILABLE(10_5, 2_0); // Corresponding to %a or %A formatting. Requires "0x" or "0X" prefix. - (BOOL)scanHexInt:(unsigned *)value; // Optionally prefixed with "0x" or "0X" - (BOOL)scanLongLong:(long long *)value; - (BOOL)scanFloat:(float *)value; - (BOOL)scanDouble:(double *)value; - (BOOL)scanString:(NSString *)string intoString:(NSString **)value; - (BOOL)scanCharactersFromSet:(NSCharacterSet *)set intoString:(NSString **)value; - (BOOL)scanUpToString:(NSString *)string intoString:(NSString **)value; - (BOOL)scanUpToCharactersFromSet:(NSCharacterSet *)set intoString:(NSString **)value; - (BOOL)isAtEnd; - (id)initWithString:(NSString *)string; + (id)scannerWithString:(NSString *)string; + (id)localizedScannerWithString:(NSString *)string; @end /* NSSet.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import #import @class NSArray, NSDictionary, NSString; /**************** Immutable Set ****************/ @interface NSSet : NSObject - (NSUInteger)count; - (id)member:(id)object; - (NSEnumerator *)objectEnumerator; @end @interface NSSet (NSExtendedSet) - (NSArray *)allObjects; - (id)anyObject; - (BOOL)containsObject:(id)anObject; - (NSString *)description; - (NSString *)descriptionWithLocale:(id)locale; - (BOOL)intersectsSet:(NSSet *)otherSet; - (BOOL)isEqualToSet:(NSSet *)otherSet; - (BOOL)isSubsetOfSet:(NSSet *)otherSet; - (void)makeObjectsPerformSelector:(SEL)aSelector; - (void)makeObjectsPerformSelector:(SEL)aSelector withObject:(id)argument; - (NSSet *)setByAddingObject:(id)anObject NS_AVAILABLE(10_5, 2_0); - (NSSet *)setByAddingObjectsFromSet:(NSSet *)other NS_AVAILABLE(10_5, 2_0); - (NSSet *)setByAddingObjectsFromArray:(NSArray *)other NS_AVAILABLE(10_5, 2_0); #if NS_BLOCKS_AVAILABLE - (void)enumerateObjectsUsingBlock:(void (^)(id obj, BOOL *stop))block NS_AVAILABLE(10_6, 4_0); - (void)enumerateObjectsWithOptions:(NSEnumerationOptions)opts usingBlock:(void (^)(id obj, BOOL *stop))block NS_AVAILABLE(10_6, 4_0); - (NSSet *)objectsPassingTest:(BOOL (^)(id obj, BOOL *stop))predicate NS_AVAILABLE(10_6, 4_0); - (NSSet *)objectsWithOptions:(NSEnumerationOptions)opts passingTest:(BOOL (^)(id obj, BOOL *stop))predicate NS_AVAILABLE(10_6, 4_0); #endif @end @interface NSSet (NSSetCreation) + (id)set; + (id)setWithObject:(id)object; + (id)setWithObjects:(const id [])objects count:(NSUInteger)cnt; + (id)setWithObjects:(id)firstObj, ... NS_REQUIRES_NIL_TERMINATION; + (id)setWithSet:(NSSet *)set; + (id)setWithArray:(NSArray *)array; - (id)initWithObjects:(const id [])objects count:(NSUInteger)cnt; - (id)initWithObjects:(id)firstObj, ... NS_REQUIRES_NIL_TERMINATION; - (id)initWithSet:(NSSet *)set; - (id)initWithSet:(NSSet *)set copyItems:(BOOL)flag; - (id)initWithArray:(NSArray *)array; @end /**************** Mutable Set ****************/ @interface NSMutableSet : NSSet - (void)addObject:(id)object; - (void)removeObject:(id)object; @end @interface NSMutableSet (NSExtendedMutableSet) - (void)addObjectsFromArray:(NSArray *)array; - (void)intersectSet:(NSSet *)otherSet; - (void)minusSet:(NSSet *)otherSet; - (void)removeAllObjects; - (void)unionSet:(NSSet *)otherSet; - (void)setSet:(NSSet *)otherSet; @end @interface NSMutableSet (NSMutableSetCreation) + (id)setWithCapacity:(NSUInteger)numItems; - (id)initWithCapacity:(NSUInteger)numItems; @end /**************** Counted Set ****************/ @interface NSCountedSet : NSMutableSet { @private id _table; void *_reserved; } - (id)initWithCapacity:(NSUInteger)numItems; // designated initializer - (id)initWithArray:(NSArray *)array; - (id)initWithSet:(NSSet *)set; - (NSUInteger)countForObject:(id)object; - (NSEnumerator *)objectEnumerator; - (void)addObject:(id)object; - (void)removeObject:(id)object; @end /* NSSortDescriptor.h Foundation Copyright (c) 2002-2012, Apple Inc. All rights reserved. */ #import #import @interface NSSortDescriptor : NSObject { @private NSUInteger _sortDescriptorFlags; NSString *_key; SEL _selector; id _selectorOrBlock; } + (id)sortDescriptorWithKey:(NSString *)key ascending:(BOOL)ascending NS_AVAILABLE(10_6, 4_0); + (id)sortDescriptorWithKey:(NSString *)key ascending:(BOOL)ascending selector:(SEL)selector NS_AVAILABLE(10_6, 4_0); // keys may be key paths - (id)initWithKey:(NSString *)key ascending:(BOOL)ascending; - (id)initWithKey:(NSString *)key ascending:(BOOL)ascending selector:(SEL)selector; - (NSString *)key; - (BOOL)ascending; - (SEL)selector; #if NS_BLOCKS_AVAILABLE + (id)sortDescriptorWithKey:(NSString *)key ascending:(BOOL)ascending comparator:(NSComparator)cmptr NS_AVAILABLE(10_6, 4_0); - (id)initWithKey:(NSString *)key ascending:(BOOL)ascending comparator:(NSComparator)cmptr NS_AVAILABLE(10_6, 4_0); - (NSComparator)comparator NS_AVAILABLE(10_6, 4_0); #endif - (NSComparisonResult)compareObject:(id)object1 toObject:(id)object2; // primitive - override this method if you want to perform comparisons differently (not key based for example) - (id)reversedSortDescriptor; // primitive - override this method to return a sort descriptor instance with reversed sort order @end @interface NSSet (NSSortDescriptorSorting) - (NSArray *)sortedArrayUsingDescriptors:(NSArray *)sortDescriptors NS_AVAILABLE(10_6, 4_0); // returns a new array by sorting the objects of the receiver @end @interface NSArray (NSSortDescriptorSorting) - (NSArray *)sortedArrayUsingDescriptors:(NSArray *)sortDescriptors; // returns a new array by sorting the objects of the receiver @end @interface NSMutableArray (NSSortDescriptorSorting) - (void)sortUsingDescriptors:(NSArray *)sortDescriptors; // sorts the array itself @end /* NSStream.h Copyright (c) 2003-2012, Apple Inc. All rights reserved */ #import @class NSData, NSDictionary, NSError, NSHost, NSInputStream, NSOutputStream, NSRunLoop, NSString, NSURL; @protocol NSStreamDelegate; typedef NS_ENUM(NSUInteger, NSStreamStatus) { NSStreamStatusNotOpen = 0, NSStreamStatusOpening = 1, NSStreamStatusOpen = 2, NSStreamStatusReading = 3, NSStreamStatusWriting = 4, NSStreamStatusAtEnd = 5, NSStreamStatusClosed = 6, NSStreamStatusError = 7 }; typedef NS_OPTIONS(NSUInteger, NSStreamEvent) { NSStreamEventNone = 0, NSStreamEventOpenCompleted = 1UL << 0, NSStreamEventHasBytesAvailable = 1UL << 1, NSStreamEventHasSpaceAvailable = 1UL << 2, NSStreamEventErrorOccurred = 1UL << 3, NSStreamEventEndEncountered = 1UL << 4 }; // NSStream is an abstract class encapsulating the common API to NSInputStream and NSOutputStream. // Subclassers of NSInputStream and NSOutputStream must also implement these methods. @interface NSStream : NSObject - (void)open; - (void)close; - (id )delegate; - (void)setDelegate:(id )delegate; // By default, a stream is its own delegate, and subclassers of NSInputStream and NSOutputStream must maintain this contract. [someStream setDelegate:nil] must restore this behavior. As usual, delegates are not retained. - (id)propertyForKey:(NSString *)key; - (BOOL)setProperty:(id)property forKey:(NSString *)key; - (void)scheduleInRunLoop:(NSRunLoop *)aRunLoop forMode:(NSString *)mode; - (void)removeFromRunLoop:(NSRunLoop *)aRunLoop forMode:(NSString *)mode; - (NSStreamStatus)streamStatus; - (NSError *)streamError; @end // NSInputStream is an abstract class representing the base functionality of a read stream. // Subclassers are required to implement these methods. @interface NSInputStream : NSStream - (NSInteger)read:(uint8_t *)buffer maxLength:(NSUInteger)len; // reads up to length bytes into the supplied buffer, which must be at least of size len. Returns the actual number of bytes read. - (BOOL)getBuffer:(uint8_t **)buffer length:(NSUInteger *)len; // returns in O(1) a pointer to the buffer in 'buffer' and by reference in 'len' how many bytes are available. This buffer is only valid until the next stream operation. Subclassers may return NO for this if it is not appropriate for the stream type. This may return NO if the buffer is not available. - (BOOL)hasBytesAvailable; // returns YES if the stream has bytes available or if it impossible to tell without actually doing the read. @end // NSOutputStream is an abstract class representing the base functionality of a write stream. // Subclassers are required to implement these methods. @interface NSOutputStream : NSStream - (NSInteger)write:(const uint8_t *)buffer maxLength:(NSUInteger)len; // writes the bytes from the specified buffer to the stream up to len bytes. Returns the number of bytes actually written. - (BOOL)hasSpaceAvailable; // returns YES if the stream can be written to or if it is impossible to tell without actually doing the write. @end #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) @interface NSStream (NSSocketStreamCreationExtensions) + (void)getStreamsToHost:(NSHost *)host port:(NSInteger)port inputStream:(NSInputStream **)inputStream outputStream:(NSOutputStream **)outputStream; @end #endif // The NSInputStreamExtensions category contains additional initializers and convenience routines for dealing with NSInputStreams. @interface NSInputStream (NSInputStreamExtensions) - (id)initWithData:(NSData *)data; - (id)initWithFileAtPath:(NSString *)path; - (id)initWithURL:(NSURL *)url NS_AVAILABLE(10_6, 4_0); + (id)inputStreamWithData:(NSData *)data; + (id)inputStreamWithFileAtPath:(NSString *)path; + (id)inputStreamWithURL:(NSURL *)url NS_AVAILABLE(10_6, 4_0); @end // The NSOutputStreamExtensions category contains additional initializers and convenience routines for dealing with NSOutputStreams. @interface NSOutputStream (NSOutputStreamExtensions) - (id)initToMemory; - (id)initToBuffer:(uint8_t *)buffer capacity:(NSUInteger)capacity; - (id)initToFileAtPath:(NSString *)path append:(BOOL)shouldAppend; - (id)initWithURL:(NSURL *)url append:(BOOL)shouldAppend NS_AVAILABLE(10_6, 4_0); + (id)outputStreamToMemory; + (id)outputStreamToBuffer:(uint8_t *)buffer capacity:(NSUInteger)capacity; + (id)outputStreamToFileAtPath:(NSString *)path append:(BOOL)shouldAppend; + (id)outputStreamWithURL:(NSURL *)url append:(BOOL)shouldAppend NS_AVAILABLE(10_6, 4_0); @end @protocol NSStreamDelegate @optional - (void)stream:(NSStream *)aStream handleEvent:(NSStreamEvent)eventCode; @end // NSString constants for the propertyForKey/setProperty:forKey: API // String constants for the setting of the socket security level. FOUNDATION_EXPORT NSString * const NSStreamSocketSecurityLevelKey NS_AVAILABLE(10_3, 2_0); // use this as the key for setting one of the following values for the security level of the target stream. FOUNDATION_EXPORT NSString * const NSStreamSocketSecurityLevelNone NS_AVAILABLE(10_3, 2_0); FOUNDATION_EXPORT NSString * const NSStreamSocketSecurityLevelSSLv2 NS_AVAILABLE(10_3, 2_0); FOUNDATION_EXPORT NSString * const NSStreamSocketSecurityLevelSSLv3 NS_AVAILABLE(10_3, 2_0); FOUNDATION_EXPORT NSString * const NSStreamSocketSecurityLevelTLSv1 NS_AVAILABLE(10_3, 2_0); FOUNDATION_EXPORT NSString * const NSStreamSocketSecurityLevelNegotiatedSSL NS_AVAILABLE(10_3, 2_0); FOUNDATION_EXPORT NSString * const NSStreamSOCKSProxyConfigurationKey NS_AVAILABLE(10_3, 2_0); // Value is an NSDictionary containing the key/value pairs below. The dictionary returned from SystemConfiguration for SOCKS proxies will work without alteration. FOUNDATION_EXPORT NSString * const NSStreamSOCKSProxyHostKey NS_AVAILABLE(10_3, 2_0); // Value is an NSString FOUNDATION_EXPORT NSString * const NSStreamSOCKSProxyPortKey NS_AVAILABLE(10_3, 2_0); // Value is an NSNumber FOUNDATION_EXPORT NSString * const NSStreamSOCKSProxyVersionKey NS_AVAILABLE(10_3, 2_0); // Value is one of NSStreamSOCKSProxyVersion4 or NSStreamSOCKSProxyVersion5 FOUNDATION_EXPORT NSString * const NSStreamSOCKSProxyUserKey NS_AVAILABLE(10_3, 2_0); // Value is an NSString FOUNDATION_EXPORT NSString * const NSStreamSOCKSProxyPasswordKey NS_AVAILABLE(10_3, 2_0); // Value is an NSString FOUNDATION_EXPORT NSString * const NSStreamSOCKSProxyVersion4 NS_AVAILABLE(10_3, 2_0); // Value for NSStreamSOCKProxyVersionKey FOUNDATION_EXPORT NSString * const NSStreamSOCKSProxyVersion5 NS_AVAILABLE(10_3, 2_0); // Value for NSStreamSOCKProxyVersionKey FOUNDATION_EXPORT NSString * const NSStreamDataWrittenToMemoryStreamKey NS_AVAILABLE(10_3, 2_0); // Key for obtaining the data written to a memory stream. FOUNDATION_EXPORT NSString * const NSStreamFileCurrentOffsetKey NS_AVAILABLE(10_3, 2_0); // Value is an NSNumber representing the current absolute offset of the stream. // NSString constants for error domains. FOUNDATION_EXPORT NSString * const NSStreamSocketSSLErrorDomain NS_AVAILABLE(10_3, 2_0); // SSL errors are to be interpreted via FOUNDATION_EXPORT NSString * const NSStreamSOCKSErrorDomain NS_AVAILABLE(10_3, 2_0); // Property key to specify the type of service for the stream. This // allows the system to properly handle the request with respect to // routing, suspension behavior and other networking related attributes // appropriate for the given service type. The service types supported // are documented below. FOUNDATION_EXPORT NSString * const NSStreamNetworkServiceType NS_AVAILABLE(10_7, 4_0); // Supported network service types: FOUNDATION_EXPORT NSString * const NSStreamNetworkServiceTypeVoIP NS_AVAILABLE(10_7, 4_0); FOUNDATION_EXPORT NSString * const NSStreamNetworkServiceTypeVideo NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString * const NSStreamNetworkServiceTypeBackground NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString * const NSStreamNetworkServiceTypeVoice NS_AVAILABLE(10_7, 5_0); /* NSString.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ typedef unsigned short unichar; #import #import #import #import @class NSData, NSArray, NSDictionary, NSCharacterSet, NSURL, NSError, NSLocale; FOUNDATION_EXPORT NSString * const NSParseErrorException; // raised by -propertyList #define NSMaximumStringLength (INT_MAX-1) /* These options apply to the various search/find and comparison methods (except where noted). */ typedef NS_OPTIONS(NSUInteger, NSStringCompareOptions) { NSCaseInsensitiveSearch = 1, NSLiteralSearch = 2, /* Exact character-by-character equivalence */ NSBackwardsSearch = 4, /* Search from end of source string */ NSAnchoredSearch = 8, /* Search is limited to start (or end, if NSBackwardsSearch) of source string */ NSNumericSearch = 64, /* Added in 10.2; Numbers within strings are compared using numeric value, that is, Foo2.txt < Foo7.txt < Foo25.txt; only applies to compare methods, not find */ NSDiacriticInsensitiveSearch NS_ENUM_AVAILABLE(10_5, 2_0) = 128, /* If specified, ignores diacritics (o-umlaut == o) */ NSWidthInsensitiveSearch NS_ENUM_AVAILABLE(10_5, 2_0) = 256, /* If specified, ignores width differences ('a' == UFF41) */ NSForcedOrderingSearch NS_ENUM_AVAILABLE(10_5, 2_0) = 512, /* If specified, comparisons are forced to return either NSOrderedAscending or NSOrderedDescending if the strings are equivalent but not strictly equal, for stability when sorting (e.g. "aaa" > "AAA" with NSCaseInsensitiveSearch specified) */ NSRegularExpressionSearch NS_ENUM_AVAILABLE(10_7, 3_2) = 1024 /* Applies to rangeOfString:..., stringByReplacingOccurrencesOfString:..., and replaceOccurrencesOfString:... methods only; the search string is treated as an ICU-compatible regular expression; if set, no other options can apply except NSCaseInsensitiveSearch and NSAnchoredSearch */ }; /* Note that in addition to the values explicitly listed below, NSStringEncoding supports encodings provided by CFString. See CFStringEncodingExt.h for a list of these encodings. See CFString.h for functions which convert between NSStringEncoding and CFStringEncoding. */ enum { NSASCIIStringEncoding = 1, /* 0..127 only */ NSNEXTSTEPStringEncoding = 2, NSJapaneseEUCStringEncoding = 3, NSUTF8StringEncoding = 4, NSISOLatin1StringEncoding = 5, NSSymbolStringEncoding = 6, NSNonLossyASCIIStringEncoding = 7, NSShiftJISStringEncoding = 8, /* kCFStringEncodingDOSJapanese */ NSISOLatin2StringEncoding = 9, NSUnicodeStringEncoding = 10, NSWindowsCP1251StringEncoding = 11, /* Cyrillic; same as AdobeStandardCyrillic */ NSWindowsCP1252StringEncoding = 12, /* WinLatin1 */ NSWindowsCP1253StringEncoding = 13, /* Greek */ NSWindowsCP1254StringEncoding = 14, /* Turkish */ NSWindowsCP1250StringEncoding = 15, /* WinLatin2 */ NSISO2022JPStringEncoding = 21, /* ISO 2022 Japanese encoding for e-mail */ NSMacOSRomanStringEncoding = 30, NSUTF16StringEncoding = NSUnicodeStringEncoding, /* An alias for NSUnicodeStringEncoding */ NSUTF16BigEndianStringEncoding = 0x90000100, /* NSUTF16StringEncoding encoding with explicit endianness specified */ NSUTF16LittleEndianStringEncoding = 0x94000100, /* NSUTF16StringEncoding encoding with explicit endianness specified */ NSUTF32StringEncoding = 0x8c000100, NSUTF32BigEndianStringEncoding = 0x98000100, /* NSUTF32StringEncoding encoding with explicit endianness specified */ NSUTF32LittleEndianStringEncoding = 0x9c000100 /* NSUTF32StringEncoding encoding with explicit endianness specified */ }; typedef NSUInteger NSStringEncoding; typedef NS_OPTIONS(NSUInteger, NSStringEncodingConversionOptions) { NSStringEncodingConversionAllowLossy = 1, NSStringEncodingConversionExternalRepresentation = 2 }; FOUNDATION_EXPORT NSString * const NSCharacterConversionException; @interface NSString : NSObject /* NSString primitive (funnel) methods. A minimal subclass of NSString just needs to implement these, although we also recommend getCharacters:range:. See below for the other methods. */ - (NSUInteger)length; - (unichar)characterAtIndex:(NSUInteger)index; @end @interface NSString (NSStringExtensionMethods) - (void)getCharacters:(unichar *)buffer range:(NSRange)aRange; - (NSString *)substringFromIndex:(NSUInteger)from; - (NSString *)substringToIndex:(NSUInteger)to; - (NSString *)substringWithRange:(NSRange)range; // Hint: Use with rangeOfComposedCharacterSequencesForRange: to avoid breaking up composed characters /* In the compare: methods, the range argument specifies the subrange, rather than the whole, of the receiver to use in the comparison. The range is not applied to the search string. For example, [@"AB" compare:@"ABC" options:0 range:NSMakeRange(0,1)] compares "A" to "ABC", not "A" to "A", and will return NSOrderedAscending. */ - (NSComparisonResult)compare:(NSString *)string; - (NSComparisonResult)compare:(NSString *)string options:(NSStringCompareOptions)mask; - (NSComparisonResult)compare:(NSString *)string options:(NSStringCompareOptions)mask range:(NSRange)compareRange; - (NSComparisonResult)compare:(NSString *)string options:(NSStringCompareOptions)mask range:(NSRange)compareRange locale:(id)locale; // locale arg used to be a dictionary pre-Leopard. We now accept NSLocale. Assumes the current locale if non-nil and non-NSLocale. nil continues to mean canonical compare, which doesn't depend on user's locale choice. - (NSComparisonResult)caseInsensitiveCompare:(NSString *)string; - (NSComparisonResult)localizedCompare:(NSString *)string; - (NSComparisonResult)localizedCaseInsensitiveCompare:(NSString *)string; /* localizedStandardCompare:, added in 10.6, should be used whenever file names or other strings are presented in lists and tables where Finder-like sorting is appropriate. The exact behavior of this method may be tweaked in future releases, and will be different under different localizations, so clients should not depend on the exact sorting order of the strings. */ - (NSComparisonResult)localizedStandardCompare:(NSString *)string NS_AVAILABLE(10_6, 4_0); - (BOOL)isEqualToString:(NSString *)aString; - (BOOL)hasPrefix:(NSString *)aString; - (BOOL)hasSuffix:(NSString *)aString; /* These methods return length==0 if the target string is not found. So, to check for containment: ([str rangeOfString:@"target"].length > 0). Note that the length of the range returned by these methods might be different than the length of the target string, due composed characters and such. */ - (NSRange)rangeOfString:(NSString *)aString; - (NSRange)rangeOfString:(NSString *)aString options:(NSStringCompareOptions)mask; - (NSRange)rangeOfString:(NSString *)aString options:(NSStringCompareOptions)mask range:(NSRange)searchRange; - (NSRange)rangeOfString:(NSString *)aString options:(NSStringCompareOptions)mask range:(NSRange)searchRange locale:(NSLocale *)locale NS_AVAILABLE(10_5, 2_0); /* These return the range of the first character from the set in the string, not the range of a sequence of characters. */ - (NSRange)rangeOfCharacterFromSet:(NSCharacterSet *)aSet; - (NSRange)rangeOfCharacterFromSet:(NSCharacterSet *)aSet options:(NSStringCompareOptions)mask; - (NSRange)rangeOfCharacterFromSet:(NSCharacterSet *)aSet options:(NSStringCompareOptions)mask range:(NSRange)searchRange; - (NSRange)rangeOfComposedCharacterSequenceAtIndex:(NSUInteger)index; - (NSRange)rangeOfComposedCharacterSequencesForRange:(NSRange)range NS_AVAILABLE(10_5, 2_0); - (NSString *)stringByAppendingString:(NSString *)aString; - (NSString *)stringByAppendingFormat:(NSString *)format, ... NS_FORMAT_FUNCTION(1,2); /* The following convenience methods all skip initial space characters (whitespaceSet) and ignore trailing characters. NSScanner can be used for more "exact" parsing of numbers. */ - (double)doubleValue; - (float)floatValue; - (int)intValue; - (NSInteger)integerValue NS_AVAILABLE(10_5, 2_0); - (long long)longLongValue NS_AVAILABLE(10_5, 2_0); - (BOOL)boolValue NS_AVAILABLE(10_5, 2_0); // Skips initial space characters (whitespaceSet), or optional -/+ sign followed by zeroes. Returns YES on encountering one of "Y", "y", "T", "t", or a digit 1-9. It ignores any trailing characters. - (NSArray *)componentsSeparatedByString:(NSString *)separator; - (NSArray *)componentsSeparatedByCharactersInSet:(NSCharacterSet *)separator NS_AVAILABLE(10_5, 2_0); - (NSString *)commonPrefixWithString:(NSString *)aString options:(NSStringCompareOptions)mask; /* The following three case methods perform the canonical (non-localized) mappings. They are suitable for programming operations that require stable results not depending on the user's locale preference. For localized case mapping for strings presented to users, use their corresponding methods with locale argument below. */ - (NSString *)uppercaseString; - (NSString *)lowercaseString; - (NSString *)capitalizedString; /* The following methods perform localized case mappings based on the locale specified. Passing nil indicates the canonical mapping. For the user preference locale setting, specify +[NSLocale currentLocale]. */ - (NSString *)uppercaseStringWithLocale:(NSLocale *)locale NS_AVAILABLE(10_8, 6_0); - (NSString *)lowercaseStringWithLocale:(NSLocale *)locale NS_AVAILABLE(10_8, 6_0); - (NSString *)capitalizedStringWithLocale:(NSLocale *)locale NS_AVAILABLE(10_8, 6_0); - (NSString *)stringByTrimmingCharactersInSet:(NSCharacterSet *)set; - (NSString *)stringByPaddingToLength:(NSUInteger)newLength withString:(NSString *)padString startingAtIndex:(NSUInteger)padIndex; - (void)getLineStart:(NSUInteger *)startPtr end:(NSUInteger *)lineEndPtr contentsEnd:(NSUInteger *)contentsEndPtr forRange:(NSRange)range; - (NSRange)lineRangeForRange:(NSRange)range; - (void)getParagraphStart:(NSUInteger *)startPtr end:(NSUInteger *)parEndPtr contentsEnd:(NSUInteger *)contentsEndPtr forRange:(NSRange)range; - (NSRange)paragraphRangeForRange:(NSRange)range; #if NS_BLOCKS_AVAILABLE typedef NS_OPTIONS(NSUInteger, NSStringEnumerationOptions) { // Pass in one of the "By" options: NSStringEnumerationByLines = 0, // Equivalent to lineRangeForRange: NSStringEnumerationByParagraphs = 1, // Equivalent to paragraphRangeForRange: NSStringEnumerationByComposedCharacterSequences = 2, // Equivalent to rangeOfComposedCharacterSequencesForRange: NSStringEnumerationByWords = 3, NSStringEnumerationBySentences = 4, // ...and combine any of the desired additional options: NSStringEnumerationReverse = 1UL << 8, NSStringEnumerationSubstringNotRequired = 1UL << 9, NSStringEnumerationLocalized = 1UL << 10 // User's default locale }; /* In the enumerate methods, the blocks will be invoked inside an autorelease pool, so any values assigned inside the block should be retained. */ - (void)enumerateSubstringsInRange:(NSRange)range options:(NSStringEnumerationOptions)opts usingBlock:(void (^)(NSString *substring, NSRange substringRange, NSRange enclosingRange, BOOL *stop))block NS_AVAILABLE(10_6, 4_0); - (void)enumerateLinesUsingBlock:(void (^)(NSString *line, BOOL *stop))block NS_AVAILABLE(10_6, 4_0); #endif - (NSString *)description; - (NSUInteger)hash; /*** Encoding methods ***/ - (NSStringEncoding)fastestEncoding; // Result in O(1) time; a rough estimate - (NSStringEncoding)smallestEncoding; // Result in O(n) time; the encoding in which the string is most compact - (NSData *)dataUsingEncoding:(NSStringEncoding)encoding allowLossyConversion:(BOOL)lossy; // External representation - (NSData *)dataUsingEncoding:(NSStringEncoding)encoding; // External representation - (BOOL)canBeConvertedToEncoding:(NSStringEncoding)encoding; /* Methods to convert NSString to a NULL-terminated cString using the specified encoding. Note, these are the "new" cString methods, and are not deprecated like the older cString methods which do not take encoding arguments. */ - (__strong const char *)cStringUsingEncoding:(NSStringEncoding)encoding NS_RETURNS_INNER_POINTER; // "Autoreleased"; NULL return if encoding conversion not possible; for performance reasons, lifetime of this should not be considered longer than the lifetime of the receiving string (if the receiver string is freed, this might go invalid then, before the end of the autorelease scope) - (BOOL)getCString:(char *)buffer maxLength:(NSUInteger)maxBufferCount encoding:(NSStringEncoding)encoding; // NO return if conversion not possible due to encoding errors or too small of a buffer. The buffer should include room for maxBufferCount bytes; this number should accomodate the expected size of the return value plus the NULL termination character, which this method adds. (So note that the maxLength passed to this method is one more than the one you would have passed to the deprecated getCString:maxLength:.) /* Use this to convert string section at a time into a fixed-size buffer, without any allocations. Does not NULL-terminate. buffer is the buffer to write to; if NULL, this method can be used to computed size of needed buffer. maxBufferCount is the length of the buffer in bytes. It's a good idea to make sure this is at least enough to hold one character's worth of conversion. usedBufferCount is the length of the buffer used up by the current conversion. Can be NULL. encoding is the encoding to convert to. options specifies the options to apply. range is the range to convert. leftOver is the remaining range. Can be NULL. YES return indicates some characters were converted. Conversion might usually stop when the buffer fills, but it might also stop when the conversion isn't possible due to the chosen encoding. */ - (BOOL)getBytes:(void *)buffer maxLength:(NSUInteger)maxBufferCount usedLength:(NSUInteger *)usedBufferCount encoding:(NSStringEncoding)encoding options:(NSStringEncodingConversionOptions)options range:(NSRange)range remainingRange:(NSRangePointer)leftover; /* These return the maximum and exact number of bytes needed to store the receiver in the specified encoding in non-external representation. The first one is O(1), while the second one is O(n). These do not include space for a terminating null. */ - (NSUInteger)maximumLengthOfBytesUsingEncoding:(NSStringEncoding)enc; // Result in O(1) time; the estimate may be way over what's needed. Returns 0 on error (overflow) - (NSUInteger)lengthOfBytesUsingEncoding:(NSStringEncoding)enc; // Result in O(n) time; the result is exact. Returns 0 on error (cannot convert to specified encoding, or overflow) - (NSString *)decomposedStringWithCanonicalMapping; - (NSString *)precomposedStringWithCanonicalMapping; - (NSString *)decomposedStringWithCompatibilityMapping; - (NSString *)precomposedStringWithCompatibilityMapping; /* Returns a string with the character folding options applied. theOptions is a mask of compare flags with *InsensitiveSearch suffix. */ - (NSString *)stringByFoldingWithOptions:(NSStringCompareOptions)options locale:(NSLocale *)locale NS_AVAILABLE(10_5, 2_0); /* Replace all occurrences of the target string in the specified range with replacement. Specified compare options are used for matching target. If NSRegularExpressionSearch is specified, the replacement is treated as a template, as in the corresponding NSRegularExpression methods, and no other options can apply except NSCaseInsensitiveSearch and NSAnchoredSearch. */ - (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement options:(NSStringCompareOptions)options range:(NSRange)searchRange NS_AVAILABLE(10_5, 2_0); /* Replace all occurrences of the target string with replacement. Invokes the above method with 0 options and range of the whole string. */ - (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement NS_AVAILABLE(10_5, 2_0); /* Replace characters in range with the specified string, returning new string. */ - (NSString *)stringByReplacingCharactersInRange:(NSRange)range withString:(NSString *)replacement NS_AVAILABLE(10_5, 2_0); - (__strong const char *)UTF8String NS_RETURNS_INNER_POINTER; // Convenience to return null-terminated UTF8 representation /* User-dependent encoding who value is derived from user's default language and potentially other factors. The use of this encoding might sometimes be needed when interpreting user documents with unknown encodings, in the absence of other hints. This encoding should be used rarely, if at all. Note that some potential values here might result in unexpected encoding conversions of even fairly straightforward NSString content --- for instance, punctuation characters with a bidirectional encoding. */ + (NSStringEncoding)defaultCStringEncoding; // Should be rarely used + (const NSStringEncoding *)availableStringEncodings; + (NSString *)localizedNameOfStringEncoding:(NSStringEncoding)encoding; /*** Creation methods ***/ /* In general creation methods in NSString do not apply to subclassers, as subclassers are assumed to provide their own init methods which create the string in the way the subclass wishes. Designated initializers of NSString are thus init and initWithCoder:. */ - (id)init; - (id)initWithCharactersNoCopy:(unichar *)characters length:(NSUInteger)length freeWhenDone:(BOOL)freeBuffer; /* "NoCopy" is a hint */ - (id)initWithCharacters:(const unichar *)characters length:(NSUInteger)length; - (id)initWithUTF8String:(const char *)nullTerminatedCString; - (id)initWithString:(NSString *)aString; - (id)initWithFormat:(NSString *)format, ... NS_FORMAT_FUNCTION(1,2); - (id)initWithFormat:(NSString *)format arguments:(va_list)argList NS_FORMAT_FUNCTION(1,0); - (id)initWithFormat:(NSString *)format locale:(id)locale, ... NS_FORMAT_FUNCTION(1,3); - (id)initWithFormat:(NSString *)format locale:(id)locale arguments:(va_list)argList NS_FORMAT_FUNCTION(1,0); - (id)initWithData:(NSData *)data encoding:(NSStringEncoding)encoding; - (id)initWithBytes:(const void *)bytes length:(NSUInteger)len encoding:(NSStringEncoding)encoding; - (id)initWithBytesNoCopy:(void *)bytes length:(NSUInteger)len encoding:(NSStringEncoding)encoding freeWhenDone:(BOOL)freeBuffer; /* "NoCopy" is a hint */ + (id)string; + (id)stringWithString:(NSString *)string; + (id)stringWithCharacters:(const unichar *)characters length:(NSUInteger)length; + (id)stringWithUTF8String:(const char *)nullTerminatedCString; + (id)stringWithFormat:(NSString *)format, ... NS_FORMAT_FUNCTION(1,2); + (id)localizedStringWithFormat:(NSString *)format, ... NS_FORMAT_FUNCTION(1,2); - (id)initWithCString:(const char *)nullTerminatedCString encoding:(NSStringEncoding)encoding; + (id)stringWithCString:(const char *)cString encoding:(NSStringEncoding)enc; /* These use the specified encoding. If nil is returned, the optional error return indicates problem that was encountered (for instance, file system or encoding errors). */ - (id)initWithContentsOfURL:(NSURL *)url encoding:(NSStringEncoding)enc error:(NSError **)error; - (id)initWithContentsOfFile:(NSString *)path encoding:(NSStringEncoding)enc error:(NSError **)error; + (id)stringWithContentsOfURL:(NSURL *)url encoding:(NSStringEncoding)enc error:(NSError **)error; + (id)stringWithContentsOfFile:(NSString *)path encoding:(NSStringEncoding)enc error:(NSError **)error; /* These try to determine the encoding, and return the encoding which was used. Note that these methods might get "smarter" in subsequent releases of the system, and use additional techniques for recognizing encodings. If nil is returned, the optional error return indicates problem that was encountered (for instance, file system or encoding errors). */ - (id)initWithContentsOfURL:(NSURL *)url usedEncoding:(NSStringEncoding *)enc error:(NSError **)error; - (id)initWithContentsOfFile:(NSString *)path usedEncoding:(NSStringEncoding *)enc error:(NSError **)error; + (id)stringWithContentsOfURL:(NSURL *)url usedEncoding:(NSStringEncoding *)enc error:(NSError **)error; + (id)stringWithContentsOfFile:(NSString *)path usedEncoding:(NSStringEncoding *)enc error:(NSError **)error; /* Write to specified url or path using the specified encoding. The optional error return is to indicate file system or encoding errors. */ - (BOOL)writeToURL:(NSURL *)url atomically:(BOOL)useAuxiliaryFile encoding:(NSStringEncoding)enc error:(NSError **)error; - (BOOL)writeToFile:(NSString *)path atomically:(BOOL)useAuxiliaryFile encoding:(NSStringEncoding)enc error:(NSError **)error; @end @interface NSMutableString : NSString /* NSMutableString primitive (funnel) method. See below for the other mutation methods. */ - (void)replaceCharactersInRange:(NSRange)range withString:(NSString *)aString; @end @interface NSMutableString (NSMutableStringExtensionMethods) - (void)insertString:(NSString *)aString atIndex:(NSUInteger)loc; - (void)deleteCharactersInRange:(NSRange)range; - (void)appendString:(NSString *)aString; - (void)appendFormat:(NSString *)format, ... NS_FORMAT_FUNCTION(1,2); - (void)setString:(NSString *)aString; /* In addition to these two, NSMutableString responds properly to all NSString creation methods. */ - (id)initWithCapacity:(NSUInteger)capacity; + (id)stringWithCapacity:(NSUInteger)capacity; /* This method replaces all occurrences of the target string with the replacement string, in the specified range of the receiver string, and returns the number of replacements. NSBackwardsSearch means the search is done from the end of the range (the results could be different); NSAnchoredSearch means only anchored (but potentially multiple) instances will be replaced. NSLiteralSearch and NSCaseInsensitiveSearch also apply. NSNumericSearch is ignored. Use NSMakeRange(0, [receiver length]) to process whole string. If NSRegularExpressionSearch is specified, the replacement is treated as a template, as in the corresponding NSRegularExpression methods, and no other options can apply except NSCaseInsensitiveSearch and NSAnchoredSearch. */ - (NSUInteger)replaceOccurrencesOfString:(NSString *)target withString:(NSString *)replacement options:(NSStringCompareOptions)options range:(NSRange)searchRange; @end @interface NSString (NSExtendedStringPropertyListParsing) /* These methods are no longer recommended since they do not work with property lists and strings files in binary plist format. Please use the APIs in NSPropertyList.h instead. */ - (id)propertyList; - (NSDictionary *)propertyListFromStringsFileFormat; @end @interface NSString (NSStringDeprecated) /* The following methods are deprecated and will be removed from this header file in the near future. These methods use [NSString defaultCStringEncoding] as the encoding to convert to, which means the results depend on the user's language and potentially other settings. This might be appropriate in some cases, but often these methods are misused, resulting in issues when running in languages other then English. UTF8String in general is a much better choice when converting arbitrary NSStrings into 8-bit representations. Additional potential replacement methods are being introduced in NSString as appropriate. */ - (const char *)cString NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); - (const char *)lossyCString NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); - (NSUInteger)cStringLength NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); - (void)getCString:(char *)bytes NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); - (void)getCString:(char *)bytes maxLength:(NSUInteger)maxLength NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); - (void)getCString:(char *)bytes maxLength:(NSUInteger)maxLength range:(NSRange)aRange remainingRange:(NSRangePointer)leftoverRange NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); - (BOOL)writeToFile:(NSString *)path atomically:(BOOL)useAuxiliaryFile NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); - (BOOL)writeToURL:(NSURL *)url atomically:(BOOL)atomically NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); - (id)initWithContentsOfFile:(NSString *)path NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); - (id)initWithContentsOfURL:(NSURL *)url NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); + (id)stringWithContentsOfFile:(NSString *)path NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); + (id)stringWithContentsOfURL:(NSURL *)url NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); - (id)initWithCStringNoCopy:(char *)bytes length:(NSUInteger)length freeWhenDone:(BOOL)freeBuffer NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); - (id)initWithCString:(const char *)bytes length:(NSUInteger)length NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); - (id)initWithCString:(const char *)bytes NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); + (id)stringWithCString:(const char *)bytes length:(NSUInteger)length NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); + (id)stringWithCString:(const char *)bytes NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); /* This method is unsafe because it could potentially cause buffer overruns. You should use -getCharacters:range: instead. */ - (void)getCharacters:(unichar *)buffer; @end enum { NSProprietaryStringEncoding = 65536 /* Installation-specific encoding */ }; /* The rest of this file is bookkeeping stuff that has to be here. Don't use this stuff, don't refer to it. */ #if !defined(_OBJC_UNICHAR_H_) #define _OBJC_UNICHAR_H_ #endif #define NS_UNICHAR_IS_EIGHT_BIT 0 @interface NSSimpleCString : NSString { @package char *bytes; int numBytes; #if __LP64__ int _unused; #endif } @end @interface NSConstantString : NSSimpleCString @end #if __LP64__ #else extern void *_NSConstantStringClassReference; #endif /* NSTextCheckingResult.h Copyright (c) 2008-2012, Apple Inc. All rights reserved. */ #import #import #import @class NSString, NSArray, NSDictionary, NSDate, NSTimeZone, NSOrthography, NSURL, NSRegularExpression; /* NSTextCheckingResult is a class used to describe items located by text checking. Each of these objects represents something that has been found during checking--a misspelled word, a sentence with grammatical issues, a detected URL, a straight quote to be replaced with curly quotes, and so forth. */ typedef NS_OPTIONS(uint64_t, NSTextCheckingType) { // a single type NSTextCheckingTypeOrthography = 1ULL << 0, // language identification NSTextCheckingTypeSpelling = 1ULL << 1, // spell checking NSTextCheckingTypeGrammar = 1ULL << 2, // grammar checking NSTextCheckingTypeDate = 1ULL << 3, // date/time detection NSTextCheckingTypeAddress = 1ULL << 4, // address detection NSTextCheckingTypeLink = 1ULL << 5, // link detection NSTextCheckingTypeQuote = 1ULL << 6, // smart quotes NSTextCheckingTypeDash = 1ULL << 7, // smart dashes NSTextCheckingTypeReplacement = 1ULL << 8, // fixed replacements, such as copyright symbol for (c) NSTextCheckingTypeCorrection = 1ULL << 9, // autocorrection NSTextCheckingTypeRegularExpression NS_ENUM_AVAILABLE(10_7, 4_0) = 1ULL << 10, // regular expression matches NSTextCheckingTypePhoneNumber NS_ENUM_AVAILABLE(10_7, 4_0) = 1ULL << 11, // phone number detection NSTextCheckingTypeTransitInformation NS_ENUM_AVAILABLE(10_7, 4_0) = 1ULL << 12 // transit (e.g. flight) info detection }; typedef NS_OPTIONS(uint64_t, NSTextCheckingTypes) { // a combination of types NSTextCheckingAllSystemTypes = 0xffffffffULL, // the first 32 types are reserved NSTextCheckingAllCustomTypes = 0xffffffffULL << 32, // clients may use the remainder for their own purposes NSTextCheckingAllTypes = (NSTextCheckingAllSystemTypes | NSTextCheckingAllCustomTypes) }; NS_CLASS_AVAILABLE(10_6, 4_0) @interface NSTextCheckingResult : NSObject /* Mandatory properties, used with all types of results. */ @property (readonly) NSTextCheckingType resultType; @property (readonly) NSRange range; @end @interface NSTextCheckingResult (NSTextCheckingResultOptional) /* Optional properties, used with certain types of results. */ @property (readonly) NSOrthography *orthography; @property (readonly) NSArray *grammarDetails; @property (readonly) NSDate *date; @property (readonly) NSTimeZone *timeZone; @property (readonly) NSTimeInterval duration; @property (readonly) NSDictionary *components NS_AVAILABLE(10_7, 4_0); @property (readonly) NSURL *URL; @property (readonly) NSString *replacementString; @property (readonly) NSRegularExpression *regularExpression NS_AVAILABLE(10_7, 4_0); @property (readonly) NSString *phoneNumber NS_AVAILABLE(10_7, 4_0); @property (readonly) NSDictionary *addressComponents; /* A result must have at least one range, but may optionally have more (for example, to represent regular expression capture groups). The range at index 0 always matches the range property. Additional ranges, if any, will have indexes from 1 to numberOfRanges-1. */ @property (readonly) NSUInteger numberOfRanges NS_AVAILABLE(10_7, 4_0); - (NSRange)rangeAtIndex:(NSUInteger)idx NS_AVAILABLE(10_7, 4_0); - (NSTextCheckingResult *)resultByAdjustingRangesWithOffset:(NSInteger)offset NS_AVAILABLE(10_7, 5_0); @end /* Keys for address components. */ FOUNDATION_EXPORT NSString * const NSTextCheckingNameKey NS_AVAILABLE(10_6, 4_0); FOUNDATION_EXPORT NSString * const NSTextCheckingJobTitleKey NS_AVAILABLE(10_6, 4_0); FOUNDATION_EXPORT NSString * const NSTextCheckingOrganizationKey NS_AVAILABLE(10_6, 4_0); FOUNDATION_EXPORT NSString * const NSTextCheckingStreetKey NS_AVAILABLE(10_6, 4_0); FOUNDATION_EXPORT NSString * const NSTextCheckingCityKey NS_AVAILABLE(10_6, 4_0); FOUNDATION_EXPORT NSString * const NSTextCheckingStateKey NS_AVAILABLE(10_6, 4_0); FOUNDATION_EXPORT NSString * const NSTextCheckingZIPKey NS_AVAILABLE(10_6, 4_0); FOUNDATION_EXPORT NSString * const NSTextCheckingCountryKey NS_AVAILABLE(10_6, 4_0); FOUNDATION_EXPORT NSString * const NSTextCheckingPhoneKey NS_AVAILABLE(10_6, 4_0); FOUNDATION_EXPORT NSString * const NSTextCheckingAirlineKey NS_AVAILABLE(10_7, 4_0); FOUNDATION_EXPORT NSString * const NSTextCheckingFlightKey NS_AVAILABLE(10_7, 4_0); @interface NSTextCheckingResult (NSTextCheckingResultCreation) /* Methods for creating instances of the various types of results. */ + (NSTextCheckingResult *)orthographyCheckingResultWithRange:(NSRange)range orthography:(NSOrthography *)orthography; + (NSTextCheckingResult *)spellCheckingResultWithRange:(NSRange)range; + (NSTextCheckingResult *)grammarCheckingResultWithRange:(NSRange)range details:(NSArray *)details; + (NSTextCheckingResult *)dateCheckingResultWithRange:(NSRange)range date:(NSDate *)date; + (NSTextCheckingResult *)dateCheckingResultWithRange:(NSRange)range date:(NSDate *)date timeZone:(NSTimeZone *)timeZone duration:(NSTimeInterval)duration; + (NSTextCheckingResult *)addressCheckingResultWithRange:(NSRange)range components:(NSDictionary *)components; + (NSTextCheckingResult *)linkCheckingResultWithRange:(NSRange)range URL:(NSURL *)url; + (NSTextCheckingResult *)quoteCheckingResultWithRange:(NSRange)range replacementString:(NSString *)replacementString; + (NSTextCheckingResult *)dashCheckingResultWithRange:(NSRange)range replacementString:(NSString *)replacementString; + (NSTextCheckingResult *)replacementCheckingResultWithRange:(NSRange)range replacementString:(NSString *)replacementString; + (NSTextCheckingResult *)correctionCheckingResultWithRange:(NSRange)range replacementString:(NSString *)replacementString; + (NSTextCheckingResult *)regularExpressionCheckingResultWithRanges:(NSRangePointer)ranges count:(NSUInteger)count regularExpression:(NSRegularExpression *)regularExpression NS_AVAILABLE(10_7, 4_0); + (NSTextCheckingResult *)phoneNumberCheckingResultWithRange:(NSRange)range phoneNumber:(NSString *)phoneNumber NS_AVAILABLE(10_7, 4_0); + (NSTextCheckingResult *)transitInformationCheckingResultWithRange:(NSRange)range components:(NSDictionary *)components NS_AVAILABLE(10_7, 4_0); @end /* NSThread.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import #import @class NSArray, NSMutableDictionary, NSDate; @interface NSThread : NSObject { @private id _private; uint8_t _bytes[44]; } + (NSThread *)currentThread; + (void)detachNewThreadSelector:(SEL)selector toTarget:(id)target withObject:(id)argument; + (BOOL)isMultiThreaded; - (NSMutableDictionary *)threadDictionary; + (void)sleepUntilDate:(NSDate *)date; + (void)sleepForTimeInterval:(NSTimeInterval)ti; + (void)exit; + (double)threadPriority; + (BOOL)setThreadPriority:(double)p; - (double)threadPriority NS_AVAILABLE(10_6, 4_0); - (void)setThreadPriority:(double)p NS_AVAILABLE(10_6, 4_0); + (NSArray *)callStackReturnAddresses NS_AVAILABLE(10_5, 2_0); + (NSArray *)callStackSymbols NS_AVAILABLE(10_6, 4_0); - (void)setName:(NSString *)n NS_AVAILABLE(10_5, 2_0); - (NSString *)name NS_AVAILABLE(10_5, 2_0); - (NSUInteger)stackSize NS_AVAILABLE(10_5, 2_0); - (void)setStackSize:(NSUInteger)s NS_AVAILABLE(10_5, 2_0); - (BOOL)isMainThread NS_AVAILABLE(10_5, 2_0); + (BOOL)isMainThread NS_AVAILABLE(10_5, 2_0); // reports whether current thread is main + (NSThread *)mainThread NS_AVAILABLE(10_5, 2_0); - (id)init NS_AVAILABLE(10_5, 2_0); // designated initializer - (id)initWithTarget:(id)target selector:(SEL)selector object:(id)argument NS_AVAILABLE(10_5, 2_0); - (BOOL)isExecuting NS_AVAILABLE(10_5, 2_0); - (BOOL)isFinished NS_AVAILABLE(10_5, 2_0); - (BOOL)isCancelled NS_AVAILABLE(10_5, 2_0); - (void)cancel NS_AVAILABLE(10_5, 2_0); - (void)start NS_AVAILABLE(10_5, 2_0); - (void)main NS_AVAILABLE(10_5, 2_0); // thread body method @end FOUNDATION_EXPORT NSString * const NSWillBecomeMultiThreadedNotification; FOUNDATION_EXPORT NSString * const NSDidBecomeSingleThreadedNotification; FOUNDATION_EXPORT NSString * const NSThreadWillExitNotification; @interface NSObject (NSThreadPerformAdditions) - (void)performSelectorOnMainThread:(SEL)aSelector withObject:(id)arg waitUntilDone:(BOOL)wait modes:(NSArray *)array; - (void)performSelectorOnMainThread:(SEL)aSelector withObject:(id)arg waitUntilDone:(BOOL)wait; // equivalent to the first method with kCFRunLoopCommonModes - (void)performSelector:(SEL)aSelector onThread:(NSThread *)thr withObject:(id)arg waitUntilDone:(BOOL)wait modes:(NSArray *)array NS_AVAILABLE(10_5, 2_0); - (void)performSelector:(SEL)aSelector onThread:(NSThread *)thr withObject:(id)arg waitUntilDone:(BOOL)wait NS_AVAILABLE(10_5, 2_0); // equivalent to the first method with kCFRunLoopCommonModes - (void)performSelectorInBackground:(SEL)aSelector withObject:(id)arg NS_AVAILABLE(10_5, 2_0); @end /* NSTimeZone.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import #import @class NSString, NSArray, NSDictionary, NSDate, NSData, NSLocale; @interface NSTimeZone : NSObject - (NSString *)name; - (NSData *)data; - (NSInteger)secondsFromGMTForDate:(NSDate *)aDate; - (NSString *)abbreviationForDate:(NSDate *)aDate; - (BOOL)isDaylightSavingTimeForDate:(NSDate *)aDate; - (NSTimeInterval)daylightSavingTimeOffsetForDate:(NSDate *)aDate NS_AVAILABLE(10_5, 2_0); - (NSDate *)nextDaylightSavingTimeTransitionAfterDate:(NSDate *)aDate NS_AVAILABLE(10_5, 2_0); @end @interface NSTimeZone (NSExtendedTimeZone) + (NSTimeZone *)systemTimeZone; + (void)resetSystemTimeZone; + (NSTimeZone *)defaultTimeZone; + (void)setDefaultTimeZone:(NSTimeZone *)aTimeZone; + (NSTimeZone *)localTimeZone; + (NSArray *)knownTimeZoneNames; + (NSDictionary *)abbreviationDictionary; + (void)setAbbreviationDictionary:(NSDictionary *)dict NS_AVAILABLE(10_6, 4_0); + (NSString *)timeZoneDataVersion NS_AVAILABLE(10_6, 4_0); - (NSInteger)secondsFromGMT; - (NSString *)abbreviation; - (BOOL)isDaylightSavingTime; - (NSTimeInterval)daylightSavingTimeOffset NS_AVAILABLE(10_5, 2_0); // for current instant - (NSDate *)nextDaylightSavingTimeTransition NS_AVAILABLE(10_5, 2_0); // after current instant - (NSString *)description; - (BOOL)isEqualToTimeZone:(NSTimeZone *)aTimeZone; typedef NS_ENUM(NSInteger, NSTimeZoneNameStyle) { NSTimeZoneNameStyleStandard, // Central Standard Time NSTimeZoneNameStyleShortStandard, // CST NSTimeZoneNameStyleDaylightSaving, // Central Daylight Time NSTimeZoneNameStyleShortDaylightSaving, // CDT NSTimeZoneNameStyleGeneric, // Central Time NSTimeZoneNameStyleShortGeneric // CT }; - (NSString *)localizedName:(NSTimeZoneNameStyle)style locale:(NSLocale *)locale NS_AVAILABLE(10_5, 2_0); @end @interface NSTimeZone (NSTimeZoneCreation) // Primary creation method is +timeZoneWithName:; the // data-taking variants should rarely be used directly + (id)timeZoneWithName:(NSString *)tzName; + (id)timeZoneWithName:(NSString *)tzName data:(NSData *)aData; - (id)initWithName:(NSString *)tzName; - (id)initWithName:(NSString *)tzName data:(NSData *)aData; // Time zones created with this never have daylight savings and the // offset is constant no matter the date; the name and abbreviation // do NOT follow the POSIX convention (of minutes-west). + (id)timeZoneForSecondsFromGMT:(NSInteger)seconds; + (id)timeZoneWithAbbreviation:(NSString *)abbreviation; @end FOUNDATION_EXPORT NSString * const NSSystemTimeZoneDidChangeNotification NS_AVAILABLE(10_5, 2_0); /* NSTimer.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import #import @interface NSTimer : NSObject + (NSTimer *)timerWithTimeInterval:(NSTimeInterval)ti invocation:(NSInvocation *)invocation repeats:(BOOL)yesOrNo; + (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)ti invocation:(NSInvocation *)invocation repeats:(BOOL)yesOrNo; + (NSTimer *)timerWithTimeInterval:(NSTimeInterval)ti target:(id)aTarget selector:(SEL)aSelector userInfo:(id)userInfo repeats:(BOOL)yesOrNo; + (NSTimer *)scheduledTimerWithTimeInterval:(NSTimeInterval)ti target:(id)aTarget selector:(SEL)aSelector userInfo:(id)userInfo repeats:(BOOL)yesOrNo; - (id)initWithFireDate:(NSDate *)date interval:(NSTimeInterval)ti target:(id)t selector:(SEL)s userInfo:(id)ui repeats:(BOOL)rep; - (void)fire; - (NSDate *)fireDate; - (void)setFireDate:(NSDate *)date; - (NSTimeInterval)timeInterval; - (void)invalidate; - (BOOL)isValid; - (id)userInfo; @end /* NSURL.h Copyright (c) 1997-2012, Apple Inc. All rights reserved. */ #import #import #if !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) #import #endif @class NSNumber, NSData, NSDictionary; #if (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE) @interface NSURL : NSObject #else @interface NSURL : NSObject #endif { NSString *_urlString; NSURL *_baseURL; void *_clients; __strong void *_reserved; } /* As more schemes are used and understood, strong constants for them will be added here */ FOUNDATION_EXPORT NSString *NSURLFileScheme; /* Convenience initializers */ - (id)initWithScheme:(NSString *)scheme host:(NSString *)host path:(NSString *)path; // this call percent-encodes both the host and path, so this cannot be used to set a username/password or port in the hostname part or with a IPv6 '[...]' type address; use initWithString: and construct the string yourself in those cases - (id)initFileURLWithPath:(NSString *)path isDirectory:(BOOL)isDir NS_AVAILABLE(10_5, 2_0); - (id)initFileURLWithPath:(NSString *)path; // Better to use initFileURLWithPath:isDirectory: if you know if the path is a directory vs non-directory, as it saves an i/o. + (id)fileURLWithPath:(NSString *)path isDirectory:(BOOL) isDir NS_AVAILABLE(10_5, 2_0); + (id)fileURLWithPath:(NSString *)path; // Better to use fileURLWithPath:isDirectory: if you know if the path is a directory vs non-directory, as it saves an i/o. /* These methods expect their string arguments to contain any percent escape codes that are necessary. It is an error for URLString to be nil. */ - initWithString:(NSString *)URLString; - initWithString:(NSString *)URLString relativeToURL:(NSURL *)baseURL; + (id)URLWithString:(NSString *)URLString; + (id)URLWithString:(NSString *)URLString relativeToURL:(NSURL *)baseURL; - (NSString *)absoluteString; - (NSString *)relativeString; // The relative portion of a URL. If baseURL is nil, or if the receiver is itself absolute, this is the same as absoluteString - (NSURL *)baseURL; // may be nil. - (NSURL *)absoluteURL; // if the receiver is itself absolute, this will return self. /* Any URL is composed of these two basic pieces. The full URL would be the concatenation of [myURL scheme], ':', [myURL resourceSpecifier] */ - (NSString *)scheme; - (NSString *)resourceSpecifier; /* If the URL conforms to rfc 1808 (the most common form of URL), the following accessors will return the various components; otherwise they return nil. The litmus test for conformance is as recommended in RFC 1808 - whether the first two characters of resourceSpecifier is @"//". In all cases, they return the component's value after resolving the receiver against its base URL. */ - (NSString *)host; - (NSNumber *)port; - (NSString *)user; - (NSString *)password; - (NSString *)path; - (NSString *)fragment; - (NSString *)parameterString; - (NSString *)query; - (NSString *)relativePath; // The same as path if baseURL is nil - (BOOL)isFileURL; // Whether the scheme is file:; if [myURL isFileURL] is YES, then [myURL path] is suitable for input into NSFileManager or NSPathUtilities. - (NSURL *)standardizedURL; /* Returns whether the URL's resource exists and is reachable. This method synchronously checks if the resource's backing store is reachable. Checking reachability is appropriate when making decisions that do not require other immediate operations on the resource, e.g. periodic maintenance of UI state that depends on the existence of a specific document. When performing operations such as opening a file or copying resource properties, it is more efficient to simply try the operation and handle failures. If this method returns NO, the optional error is populated. This method is currently applicable only to URLs for file system resources. For other URL types, NO is returned. Symbol is present in iOS 4, but performs no operation. */ - (BOOL)checkResourceIsReachableAndReturnError:(NSError **)error NS_AVAILABLE(10_6, 4_0); /* Working with file reference URLs */ /* Returns whether the URL is a file reference URL. Symbol is present in iOS 4, but performs no operation. */ - (BOOL)isFileReferenceURL NS_AVAILABLE(10_6, 4_0); /* Returns a file reference URL that refers to the same resource as a specified file URL. File reference URLs use a URL path syntax that identifies a file system object by reference, not by path. This form of file URL remains valid when the file system path of the URL’s underlying resource changes. An error will occur if the url parameter is not a file URL. File reference URLs cannot be created to file system objects which do not exist or are not reachable. In some areas of the file system hierarchy, file reference URLs cannot be generated to the leaf node of the URL path. A file reference URL's path should never be persistently stored because is not valid across system restarts, and across remounts of volumes -- if you want to create a persistent reference to a file system object, use a bookmark (see -bookmarkDataWithOptions:includingResourceValuesForKeys:relativeToURL:error:). Symbol is present in iOS 4, but performs no operation. */ - (NSURL *)fileReferenceURL NS_AVAILABLE(10_6, 4_0); /* Returns a file path URL that refers to the same resource as a specified URL. File path URLs use a file system style path. An error will occur if the url parameter is not a file URL. A file reference URL's resource must exist and be reachable to be converted to a file path URL. Symbol is present in iOS 4, but performs no operation. */ - (NSURL *)filePathURL NS_AVAILABLE(10_6, 4_0); /* Resource access The behavior of resource value caching is slightly different between the NSURL and CFURL API. When the NSURL methods which get, set, or use cached resource values are used from the main thread, resource values cached by the URL (except those added as temporary properties) are invalidated the next time the main thread's run loop runs. The CFURL functions do not automatically clear any resource values cached by the URL. The client has complete control over the cache lifetime. If you are using CFURL API, you must use CFURLClearResourcePropertyCacheForKey or CFURLClearResourcePropertyCache to clear cached resource values. */ /* Returns the resource value identified by a given resource key. This method first checks if the URL object already caches the resource value. If so, it returns the cached resource value to the caller. If not, then this method synchronously obtains the resource value from the backing store, adds the resource value to the URL object's cache, and returns the resource value to the caller. The type of the resource value varies by resource property (see resource key definitions). If this method returns YES and value is populated with nil, it means the resource property is not available for the specified resource and no errors occurred when determining the resource property was not available. If this method returns NO, the optional error is populated. This method is currently applicable only to URLs for file system resources. Symbol is present in iOS 4, but performs no operation. */ - (BOOL)getResourceValue:(out id *)value forKey:(NSString *)key error:(out NSError **)error NS_AVAILABLE(10_6, 4_0); /* Returns the resource values identified by specified array of resource keys. This method first checks if the URL object already caches the resource values. If so, it returns the cached resource values to the caller. If not, then this method synchronously obtains the resource values from the backing store, adds the resource values to the URL object's cache, and returns the resource values to the caller. The type of the resource values vary by property (see resource key definitions). If the result dictionary does not contain a resource value for one or more of the requested resource keys, it means those resource properties are not available for the specified resource and no errors occurred when determining those resource properties were not available. If this method returns NULL, the optional error is populated. This method is currently applicable only to URLs for file system resources. Symbol is present in iOS 4, but performs no operation. */ - (NSDictionary *)resourceValuesForKeys:(NSArray *)keys error:(NSError **)error NS_AVAILABLE(10_6, 4_0); /* Sets the resource value identified by a given resource key. This method writes the new resource value out to the backing store. Attempts to set a read-only resource property or to set a resource property not supported by the resource are ignored and are not considered errors. If this method returns NO, the optional error is populated. This method is currently applicable only to URLs for file system resources. Symbol is present in iOS 4, but performs no operation. */ - (BOOL)setResourceValue:(id)value forKey:(NSString *)key error:(NSError **)error NS_AVAILABLE(10_6, 4_0); /* Sets any number of resource values of a URL's resource. This method writes the new resource values out to the backing store. Attempts to set read-only resource properties or to set resource properties not supported by the resource are ignored and are not considered errors. If an error occurs after some resource properties have been successfully changed, the userInfo dictionary in the returned error contains an array of resource keys that were not set with the key kCFURLKeysOfUnsetValuesKey. The order in which the resource values are set is not defined. If you need to guarantee the order resource values are set, you should make multiple requests to this method or to -setResourceValue:forKey:error: to guarantee the order. If this method returns NO, the optional error is populated. This method is currently applicable only to URLs for file system resources. Symbol is present in iOS 4, but performs no operation. */ - (BOOL)setResourceValues:(NSDictionary *)keyedValues error:(NSError **)error NS_AVAILABLE(10_6, 4_0); FOUNDATION_EXPORT NSString * const NSURLKeysOfUnsetValuesKey NS_AVAILABLE(10_7, 5_0); // Key for the resource properties that have not been set after setResourceValues:error: returns an error, returned as an array of of strings. /* The File System Resource Keys URLs to file system resources support the properties defined below. Note that not all property values will exist for all file system URLs. For example, if a file is located on a volume that does not support creation dates, it is valid to request the creation date property, but the returned value will be nil, and no error will be generated. */ /* Resource keys applicable to all file system objects */ FOUNDATION_EXPORT NSString * const NSURLNameKey NS_AVAILABLE(10_6, 4_0); // The resource name provided by the file system (Read-write, value type NSString) FOUNDATION_EXPORT NSString * const NSURLLocalizedNameKey NS_AVAILABLE(10_6, 4_0); // Localized or extension-hidden name as displayed to users (Read-only, value type NSString) FOUNDATION_EXPORT NSString * const NSURLIsRegularFileKey NS_AVAILABLE(10_6, 4_0); // True for regular files (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLIsDirectoryKey NS_AVAILABLE(10_6, 4_0); // True for directories (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLIsSymbolicLinkKey NS_AVAILABLE(10_6, 4_0); // True for symlinks (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLIsVolumeKey NS_AVAILABLE(10_6, 4_0); // True for the root directory of a volume (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLIsPackageKey NS_AVAILABLE(10_6, 4_0); // True for packaged directories (Read-only 10_6 and 10_7, read-write 10_8, value type boolean NSNumber). Note: You can only set or clear this property on directories; if you try to set this property on non-directory objects, the property is ignored. If the directory is a package for some other reason (extension type, etc), setting this property to false will have no effect. FOUNDATION_EXPORT NSString * const NSURLIsSystemImmutableKey NS_AVAILABLE(10_6, 4_0); // True for system-immutable resources (Read-write, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLIsUserImmutableKey NS_AVAILABLE(10_6, 4_0); // True for user-immutable resources (Read-write, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLIsHiddenKey NS_AVAILABLE(10_6, 4_0); // True for resources normally not displayed to users (Read-write, value type boolean NSNumber). Note: If the resource is a hidden because its name starts with a period, setting this property to false will not change the property. FOUNDATION_EXPORT NSString * const NSURLHasHiddenExtensionKey NS_AVAILABLE(10_6, 4_0); // True for resources whose filename extension is removed from the localized name property (Read-write, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLCreationDateKey NS_AVAILABLE(10_6, 4_0); // The date the resource was created (Read-write, value type NSDate) FOUNDATION_EXPORT NSString * const NSURLContentAccessDateKey NS_AVAILABLE(10_6, 4_0); // The date the resource was last accessed (Read-only, value type NSDate) FOUNDATION_EXPORT NSString * const NSURLContentModificationDateKey NS_AVAILABLE(10_6, 4_0); // The time the resource content was last modified (Read-write, value type NSDate) FOUNDATION_EXPORT NSString * const NSURLAttributeModificationDateKey NS_AVAILABLE(10_6, 4_0); // The time the resource's attributes were last modified (Read-write, value type NSDate) FOUNDATION_EXPORT NSString * const NSURLLinkCountKey NS_AVAILABLE(10_6, 4_0); // Number of hard links to the resource (Read-only, value type NSNumber) FOUNDATION_EXPORT NSString * const NSURLParentDirectoryURLKey NS_AVAILABLE(10_6, 4_0); // The resource's parent directory, if any (Read-only, value type NSURL) FOUNDATION_EXPORT NSString * const NSURLVolumeURLKey NS_AVAILABLE(10_6, 4_0); // URL of the volume on which the resource is stored (Read-only, value type NSURL) FOUNDATION_EXPORT NSString * const NSURLTypeIdentifierKey NS_AVAILABLE(10_6, 4_0); // Uniform type identifier (UTI) for the resource (Read-only, value type NSString) FOUNDATION_EXPORT NSString * const NSURLLocalizedTypeDescriptionKey NS_AVAILABLE(10_6, 4_0); // User-visible type or "kind" description (Read-only, value type NSString) FOUNDATION_EXPORT NSString * const NSURLLabelNumberKey NS_AVAILABLE(10_6, 4_0); // The label number assigned to the resource (Read-write, value type NSNumber) FOUNDATION_EXPORT NSString * const NSURLLabelColorKey NS_AVAILABLE(10_6, 4_0); // The color of the assigned label (Read-only, value type NSColor) FOUNDATION_EXPORT NSString * const NSURLLocalizedLabelKey NS_AVAILABLE(10_6, 4_0); // The user-visible label text (Read-only, value type NSString) FOUNDATION_EXPORT NSString * const NSURLEffectiveIconKey NS_AVAILABLE(10_6, 4_0); // The icon normally displayed for the resource (Read-only, value type NSImage) FOUNDATION_EXPORT NSString * const NSURLCustomIconKey NS_AVAILABLE(10_6, 4_0); // The custom icon assigned to the resource, if any (Currently not implemented, value type NSImage) FOUNDATION_EXPORT NSString * const NSURLFileResourceIdentifierKey NS_AVAILABLE(10_7, 5_0); // An identifier which can be used to compare two file system objects for equality using -isEqual (i.e, two object identifiers are equal if they have the same file system path or if the paths are linked to same inode on the same file system). This identifier is not persistent across system restarts. (Read-only, value type id) FOUNDATION_EXPORT NSString * const NSURLVolumeIdentifierKey NS_AVAILABLE(10_7, 5_0); // An identifier that can be used to identify the volume the file system object is on. Other objects on the same volume will have the same volume identifier and can be compared using for equality using -isEqual. This identifier is not persistent across system restarts. (Read-only, value type id) FOUNDATION_EXPORT NSString * const NSURLPreferredIOBlockSizeKey NS_AVAILABLE(10_7, 5_0); // The optimal block size when reading or writing this file's data, or nil if not available. (Read-only, value type NSNumber) FOUNDATION_EXPORT NSString * const NSURLIsReadableKey NS_AVAILABLE(10_7, 5_0); // true if this process (as determined by EUID) can read the resource. (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLIsWritableKey NS_AVAILABLE(10_7, 5_0); // true if this process (as determined by EUID) can write to the resource. (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLIsExecutableKey NS_AVAILABLE(10_7, 5_0); // true if this process (as determined by EUID) can execute a file resource or search a directory resource. (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLFileSecurityKey NS_AVAILABLE(10_7, 5_0); // The file system object's security information encapsulated in a NSFileSecurity object. (Value type NSFileSecurity) FOUNDATION_EXPORT NSString * const NSURLIsExcludedFromBackupKey NS_AVAILABLE(10_8, 5_1); // true if resource should be excluded from backups, false otherwise (Read-write, value type boolean NSNumber). This property is only useful for excluding cache and other application support files which are not needed in a backup. Some operations commonly made to user documents will cause this property to be reset to false and so this property should not be used on user documents. FOUNDATION_EXPORT NSString * const NSURLPathKey NS_AVAILABLE(10_8, 6_0); // the URL's path as a file system path (Read-only, value type NSString) FOUNDATION_EXPORT NSString * const NSURLIsMountTriggerKey NS_AVAILABLE(10_7, 5_0); // true if this URL is a file system trigger directory. Traversing or opening a file system trigger will cause an attempt to mount a file system on the trigger directory. (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLFileResourceTypeKey NS_AVAILABLE(10_7, 5_0); // Returns the file system object type. (Read-only, value type NSString) /* The file system object type values returned for the NSURLFileResourceTypeKey */ FOUNDATION_EXPORT NSString * const NSURLFileResourceTypeNamedPipe NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString * const NSURLFileResourceTypeCharacterSpecial NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString * const NSURLFileResourceTypeDirectory NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString * const NSURLFileResourceTypeBlockSpecial NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString * const NSURLFileResourceTypeRegular NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString * const NSURLFileResourceTypeSymbolicLink NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString * const NSURLFileResourceTypeSocket NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString * const NSURLFileResourceTypeUnknown NS_AVAILABLE(10_7, 5_0); /* Resource keys applicable only to regular files */ FOUNDATION_EXPORT NSString * const NSURLFileSizeKey NS_AVAILABLE(10_6, 4_0); // Total file size in bytes (Read-only, value type NSNumber) FOUNDATION_EXPORT NSString * const NSURLFileAllocatedSizeKey NS_AVAILABLE(10_6, 4_0); // Total size allocated on disk for the file in bytes (number of blocks times block size) (Read-only, value type NSNumber) FOUNDATION_EXPORT NSString * const NSURLTotalFileSizeKey NS_AVAILABLE(10_7, 5_0); // Total displayable size of the file in bytes (this may include space used by metadata), or nil if not available. (Read-only, value type NSNumber) FOUNDATION_EXPORT NSString * const NSURLTotalFileAllocatedSizeKey NS_AVAILABLE(10_7, 5_0); // Total allocated size of the file in bytes (this may include space used by metadata), or nil if not available. This can be less than the value returned by NSURLTotalFileSizeKey if the resource is compressed. (Read-only, value type NSNumber) FOUNDATION_EXPORT NSString * const NSURLIsAliasFileKey NS_AVAILABLE(10_6, 4_0); // true if the resource is a Finder alias file or a symlink, false otherwise ( Read-only, value type boolean NSNumber) /* Volumes resource keys As a convenience, volume resource values can be requested from any file system URL. The value returned will reflect the property value for the volume on which the resource is located. */ FOUNDATION_EXPORT NSString * const NSURLVolumeLocalizedFormatDescriptionKey NS_AVAILABLE(10_6, 4_0); // The user-visible volume format (Read-only, value type NSString) FOUNDATION_EXPORT NSString * const NSURLVolumeTotalCapacityKey NS_AVAILABLE(10_6, 4_0); // Total volume capacity in bytes (Read-only, value type NSNumber) FOUNDATION_EXPORT NSString * const NSURLVolumeAvailableCapacityKey NS_AVAILABLE(10_6, 4_0); // Total free space in bytes (Read-only, value type NSNumber) FOUNDATION_EXPORT NSString * const NSURLVolumeResourceCountKey NS_AVAILABLE(10_6, 4_0); // Total number of resources on the volume (Read-only, value type NSNumber) FOUNDATION_EXPORT NSString * const NSURLVolumeSupportsPersistentIDsKey NS_AVAILABLE(10_6, 4_0); // true if the volume format supports persistent object identifiers and can look up file system objects by their IDs (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLVolumeSupportsSymbolicLinksKey NS_AVAILABLE(10_6, 4_0); // true if the volume format supports symbolic links (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLVolumeSupportsHardLinksKey NS_AVAILABLE(10_6, 4_0); // true if the volume format supports hard links (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLVolumeSupportsJournalingKey NS_AVAILABLE(10_6, 4_0); // true if the volume format supports a journal used to speed recovery in case of unplanned restart (such as a power outage or crash). This does not necessarily mean the volume is actively using a journal. (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLVolumeIsJournalingKey NS_AVAILABLE(10_6, 4_0); // true if the volume is currently using a journal for speedy recovery after an unplanned restart. (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLVolumeSupportsSparseFilesKey NS_AVAILABLE(10_6, 4_0); // true if the volume format supports sparse files, that is, files which can have 'holes' that have never been written to, and thus do not consume space on disk. A sparse file may have an allocated size on disk that is less than its logical length (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLVolumeSupportsZeroRunsKey NS_AVAILABLE(10_6, 4_0); // For security reasons, parts of a file (runs) that have never been written to must appear to contain zeroes. true if the volume keeps track of allocated but unwritten runs of a file so that it can substitute zeroes without actually writing zeroes to the media. (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLVolumeSupportsCaseSensitiveNamesKey NS_AVAILABLE(10_6, 4_0); // true if the volume format treats upper and lower case characters in file and directory names as different. Otherwise an upper case character is equivalent to a lower case character, and you can't have two names that differ solely in the case of the characters. (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLVolumeSupportsCasePreservedNamesKey NS_AVAILABLE(10_6, 4_0); // true if the volume format preserves the case of file and directory names. Otherwise the volume may change the case of some characters (typically making them all upper or all lower case). (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLVolumeSupportsRootDirectoryDatesKey NS_AVAILABLE(10_7, 5_0); // true if the volume supports reliable storage of times for the root directory. (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLVolumeSupportsVolumeSizesKey NS_AVAILABLE(10_7, 5_0); // true if the volume supports returning volume size values (NSURLVolumeTotalCapacityKey and NSURLVolumeAvailableCapacityKey). (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLVolumeSupportsRenamingKey NS_AVAILABLE(10_7, 5_0); // true if the volume can be renamed. (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLVolumeSupportsAdvisoryFileLockingKey NS_AVAILABLE(10_7, 5_0); // true if the volume implements whole-file flock(2) style advisory locks, and the O_EXLOCK and O_SHLOCK flags of the open(2) call. (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLVolumeSupportsExtendedSecurityKey NS_AVAILABLE(10_7, 5_0); // true if the volume implements extended security (ACLs). (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLVolumeIsBrowsableKey NS_AVAILABLE(10_7, 5_0); // true if the volume should be visible via the GUI (i.e., appear on the Desktop as a separate volume). (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLVolumeMaximumFileSizeKey NS_AVAILABLE(10_7, 5_0); // The largest file size (in bytes) supported by this file system, or nil if this cannot be determined. (Read-only, value type NSNumber) FOUNDATION_EXPORT NSString * const NSURLVolumeIsEjectableKey NS_AVAILABLE(10_7, 5_0); // true if the volume's media is ejectable from the drive mechanism under software control. (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLVolumeIsRemovableKey NS_AVAILABLE(10_7, 5_0); // true if the volume's media is removable from the drive mechanism. (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLVolumeIsInternalKey NS_AVAILABLE(10_7, 5_0); // true if the volume's device is connected to an internal bus, false if connected to an external bus, or nil if not available. (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLVolumeIsAutomountedKey NS_AVAILABLE(10_7, 5_0); // true if the volume is automounted. Note: do not mistake this with the functionality provided by kCFURLVolumeSupportsBrowsingKey. (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLVolumeIsLocalKey NS_AVAILABLE(10_7, 5_0); // true if the volume is stored on a local device. (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLVolumeIsReadOnlyKey NS_AVAILABLE(10_7, 5_0); // true if the volume is read-only. (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLVolumeCreationDateKey NS_AVAILABLE(10_7, 5_0); // The volume's creation date, or nil if this cannot be determined. (Read-only, value type NSDate) FOUNDATION_EXPORT NSString * const NSURLVolumeURLForRemountingKey NS_AVAILABLE(10_7, 5_0); // The NSURL needed to remount a network volume, or nil if not available. (Read-only, value type NSURL) FOUNDATION_EXPORT NSString * const NSURLVolumeUUIDStringKey NS_AVAILABLE(10_7, 5_0); // The volume's persistent UUID as a string, or nil if a persistent UUID is not available for the volume. (Read-only, value type NSString) FOUNDATION_EXPORT NSString * const NSURLVolumeNameKey NS_AVAILABLE(10_7, 5_0); // The name of the volume (settable if NSURLVolumeSupportsRenamingKey is YES, value type NSString) FOUNDATION_EXPORT NSString * const NSURLVolumeLocalizedNameKey NS_AVAILABLE(10_7, 5_0); // The user-presentable name of the volume (Read-only, value type NSString) /* Ubiquitous item resource keys */ FOUNDATION_EXPORT NSString * const NSURLIsUbiquitousItemKey NS_AVAILABLE(10_7, 5_0); // true if this item is synced to the cloud, false if it is only a local file. (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLUbiquitousItemHasUnresolvedConflictsKey NS_AVAILABLE(10_7, 5_0); // true if this item has conflicts outstanding. (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLUbiquitousItemIsDownloadedKey NS_AVAILABLE(10_7, 5_0); // true if there is local data present for this item. (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLUbiquitousItemIsDownloadingKey NS_AVAILABLE(10_7, 5_0); // true if data is being downloaded for this item. (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLUbiquitousItemIsUploadedKey NS_AVAILABLE(10_7, 5_0); // true if there is data present in the cloud for this item. (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLUbiquitousItemIsUploadingKey NS_AVAILABLE(10_7, 5_0); // true if data is being uploaded for this item. (Read-only, value type boolean NSNumber) FOUNDATION_EXPORT NSString * const NSURLUbiquitousItemPercentDownloadedKey NS_DEPRECATED(10_7, 10_8, 5_0, 6_0); // Use NSMetadataQuery and NSMetadataUbiquitousItemPercentDownloadedKey on NSMetadataItem instead FOUNDATION_EXPORT NSString * const NSURLUbiquitousItemPercentUploadedKey NS_DEPRECATED(10_7, 10_8, 5_0, 6_0); // Use NSMetadataQuery and NSMetadataUbiquitousItemPercentUploadedKey on NSMetadataItem instead /* Working with Bookmarks and alias (bookmark) files */ typedef NS_OPTIONS(NSUInteger, NSURLBookmarkCreationOptions) { NSURLBookmarkCreationPreferFileIDResolution = ( 1UL << 8 ), /* At resolution time, this bookmark will prefer resolving by the embedded fileID to the path */ NSURLBookmarkCreationMinimalBookmark = ( 1UL << 9 ), /* Creates a bookmark with "less" information, which may be smaller but still be able to resolve in certain ways */ NSURLBookmarkCreationSuitableForBookmarkFile = ( 1UL << 10 ), /* include properties required in Finder alias files in created bookmark */ NSURLBookmarkCreationWithSecurityScope NS_ENUM_AVAILABLE(10_7, NA) = ( 1 << 11 ), /* include information in the bookmark data which allows the same sandboxed process to access the resource after being relaunched */ NSURLBookmarkCreationSecurityScopeAllowOnlyReadAccess NS_ENUM_AVAILABLE(10_7, NA) = ( 1 << 12 ), /* if used with kCFURLBookmarkCreationWithSecurityScope, at resolution time only read access to the resource will be granted */ } NS_ENUM_AVAILABLE(10_6, 4_0); typedef NS_OPTIONS(NSUInteger, NSURLBookmarkResolutionOptions) { NSURLBookmarkResolutionWithoutUI = ( 1UL << 8 ), /* don't perform any UI during bookmark resolution */ NSURLBookmarkResolutionWithoutMounting = ( 1UL << 9 ), /* don't mount a volume during bookmark resolution */ NSURLBookmarkResolutionWithSecurityScope NS_ENUM_AVAILABLE(10_7, NA) = ( 1 << 10 ) /* use the secure information included at creation time to provide the ability to access the resource in a sandboxed process */ }; typedef NSUInteger NSURLBookmarkFileCreationOptions; /* Create a NSData containing a externalizable representation from a given url, which can later be resolved or interrogated for properties */ - (NSData *)bookmarkDataWithOptions:(NSURLBookmarkCreationOptions)options includingResourceValuesForKeys:(NSArray *)keys relativeToURL:(NSURL *)relativeURL error:(NSError **)error NS_AVAILABLE(10_6, 4_0); /* Resolve bookmark data into a url; init and factory methods */ - (id)initByResolvingBookmarkData:(NSData *)bookmarkData options:(NSURLBookmarkResolutionOptions)options relativeToURL:(NSURL *)relativeURL bookmarkDataIsStale:(BOOL *)isStale error:(NSError **)error NS_AVAILABLE(10_6, 4_0); + (id)URLByResolvingBookmarkData:(NSData *)bookmarkData options:(NSURLBookmarkResolutionOptions)options relativeToURL:(NSURL *)relativeURL bookmarkDataIsStale:(BOOL *)isStale error:(NSError **)error NS_AVAILABLE(10_6, 4_0); /* Property access. Given a NSData* created with bookmarkDataWithOptions, return a given property or all of the properties in bookmark data */ + (NSDictionary *)resourceValuesForKeys:(NSArray *)keys fromBookmarkData:(NSData *)bookmarkData NS_AVAILABLE(10_6, 4_0); /* Create a bookmark file on disk at bookmarkFileURL which can be resolved back to the file system item represented by bookmarkData, using the given options. If relativeToURL is non-NULL, create a relative url. The bookmark data must have been created with the NSURLBookmarkCreationSuitableForBookmarkFile flag or this routine will fail. If bookmarkFileURL is a directory then the file will be created in that directory with the name of the item represented by the bookmarkData with ".alias" appended. If bookmarkFileURL is a file url then its extension will be changed to ".alias", if not present. */ + (BOOL)writeBookmarkData:(NSData *)bookmarkData toURL:(NSURL *)bookmarkFileURL options:(NSURLBookmarkFileCreationOptions)options error:(NSError **)error NS_AVAILABLE(10_6, 4_0); /* Given the url of a file which is a Finder "alias" file, return a NSData with the bookmark data from the file. If bookmarkFileURL points to an alias file created before SnowLeopard which contains Alias Manager information and no bookmark data, then a NSData will be synthesized which contains a approximation of the alias information in a format which can be used to resolve the bookmark. If an error prevents reading the data or if it is corrupt, nil will be returned and error will be filled in if errorRef is non-NULL. */ + (NSData *)bookmarkDataWithContentsOfURL:(NSURL *)bookmarkFileURL error:(NSError **)error NS_AVAILABLE(10_6, 4_0); /* Given a NSURL created by resolving a bookmark data created with security scope, make the resource referenced by the url accessible to the process. When access to this resource is no longer needed the client should call stopAccessingSecurityScopedResource. Each call to startAccessingSecurityScopedResource must be balanced with a call to stopAccessingSecurityScopedResource */ - (BOOL) startAccessingSecurityScopedResource NS_AVAILABLE(10_7, NA); /* Revokes the access granted to the url by a prior successful call to startAccessingSecurityScopedResource */ - (void) stopAccessingSecurityScopedResource NS_AVAILABLE(10_7, NA); @end @interface NSString (NSURLUtilities) /* Adds all percent escapes necessary to convert the receiver into a legal URL string. Uses the given encoding to determine the correct percent escapes (returning nil if the given encoding cannot encode a particular character). See CFURLCreateStringByAddingPercentEscapes in CFURL.h for more complex transformations */ - (NSString *)stringByAddingPercentEscapesUsingEncoding:(NSStringEncoding)enc; /* Replaces all percent escapes with the matching characters as determined by the given encoding. Returns nil if the transformation is not possible (i.e. the percent escapes give a byte sequence not legal in the given encoding). See CFURLCreateStringByReplacingPercentEscapes in CFURL.h for more complex transformations */ - (NSString *)stringByReplacingPercentEscapesUsingEncoding:(NSStringEncoding)enc; @end @interface NSURL (NSURLPathUtilities) /* The following methods work on the path portion of a URL in the same manner that the NSPathUtilities methods on NSString do. */ + (NSURL *)fileURLWithPathComponents:(NSArray *)components NS_AVAILABLE(10_6, 4_0); - (NSArray *)pathComponents NS_AVAILABLE(10_6, 4_0); - (NSString *)lastPathComponent NS_AVAILABLE(10_6, 4_0); - (NSString *)pathExtension NS_AVAILABLE(10_6, 4_0); - (NSURL *)URLByAppendingPathComponent:(NSString *)pathComponent NS_AVAILABLE(10_6, 4_0); - (NSURL *)URLByAppendingPathComponent:(NSString *)pathComponent isDirectory:(BOOL)isDirectory NS_AVAILABLE(10_7, 5_0); - (NSURL *)URLByDeletingLastPathComponent NS_AVAILABLE(10_6, 4_0); - (NSURL *)URLByAppendingPathExtension:(NSString *)pathExtension NS_AVAILABLE(10_6, 4_0); - (NSURL *)URLByDeletingPathExtension NS_AVAILABLE(10_6, 4_0); /* The following methods work only on `file:` scheme URLs; for non-`file:` scheme URLs, these methods return the URL unchanged. */ - (NSURL *)URLByStandardizingPath NS_AVAILABLE(10_6, 4_0); - (NSURL *)URLByResolvingSymlinksInPath NS_AVAILABLE(10_6, 4_0) ; @end #if (TARGET_OS_MAC || (TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) /* NSFileSecurity encapsulates a file system object's security information. NSFileSecurity and CFFileSecurity are toll-free bridged. */ @interface NSFileSecurity : NSObject @end #endif /* deprecated interfaces */ #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) /* Client informal protocol for use with the deprecated loadResourceDataNotifyingClient: below. */ @interface NSObject (NSURLClient) - (void)URL:(NSURL *)sender resourceDataDidBecomeAvailable:(NSData *)newBytes NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); - (void)URLResourceDidFinishLoading:(NSURL *)sender NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); - (void)URLResourceDidCancelLoading:(NSURL *)sender NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); - (void)URL:(NSURL *)sender resourceDidFailLoadingWithReason:(NSString *)reason NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); @end /* This entire protocol is deprecated; use NSURLConnection instead. */ @interface NSURL (NSURLLoading) - (NSData *)resourceDataUsingCache:(BOOL)shouldUseCache NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); // Blocks to load the data if necessary. If shouldUseCache is YES, then if an equivalent URL has already been loaded and cached, its resource data will be returned immediately. If shouldUseCache is NO, a new load will be started - (void)loadResourceDataNotifyingClient:(id)client usingCache:(BOOL)shouldUseCache NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); // Starts an asynchronous load of the data, registering delegate to receive notification. Only one such background load can proceed at a time. - (id)propertyForKey:(NSString *)propertyKey NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); /* These attempt to write the given arguments for the resource specified by the URL; they return success or failure */ - (BOOL)setResourceData:(NSData *)data NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); - (BOOL)setProperty:(id)property forKey:(NSString *)propertyKey NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); - (NSURLHandle *)URLHandleUsingCache:(BOOL)shouldUseCache NS_DEPRECATED(10_0, 10_4, 2_0, 2_0); // Sophisticated clients will want to ask for this, then message the handle directly. If shouldUseCache is NO, a newly instantiated handle is returned, even if an equivalent URL has been loaded @end #endif /* NSURLAuthenticationChallenge.h Copyright (c) 2003-2012, Apple Inc. All rights reserved. Public header file. */ #import @class NSURLAuthenticationChallenge; @class NSURLCredential; @class NSURLProtectionSpace; @class NSURLResponse; @class NSError; /*! @protocol NSURLAuthenticationChallengeSender @discussion This protocol represents the sender of an authentication challenge. It has methods to provide a credential, to continue without any credential, getting whatever failure result would happen in that case, cancel a challenge, perform the default action as defined by the system, or reject the currently supplied protection-space in the challenge. */ @protocol NSURLAuthenticationChallengeSender /*! @method useCredential:forAuthenticationChallenge: */ - (void)useCredential:(NSURLCredential *)credential forAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge; /*! @method continueWithoutCredentialForAuthenticationChallenge: */ - (void)continueWithoutCredentialForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge; /*! @method cancelAuthenticationChallenge: */ - (void)cancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge; @optional /*! @method performDefaultHandlingForAuthenticationChallenge: */ - (void)performDefaultHandlingForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge; /*! @method rejectProtectionSpaceAndContinueWithChallenge: */ - (void)rejectProtectionSpaceAndContinueWithChallenge:(NSURLAuthenticationChallenge *)challenge; @end @class NSURLAuthenticationChallengeInternal; /*! @class NSURLAuthenticationChallenge @discussion This class represents an authentication challenge. It provides all the information about the challenge, and has a method to indicate when it's done. */ @interface NSURLAuthenticationChallenge : NSObject { @private NSURLAuthenticationChallengeInternal *_internal; } /*! @method initWithProtectionSpace:proposedCredential:previousFailureCount:failureResponse:error: @abstract Initialize an authentication challenge @param space The NSURLProtectionSpace to use @param credential The proposed NSURLCredential for this challenge, or nil @param previousFailureCount A count of previous failures attempting access. @param response The NSURLResponse for the authentication failure, if applicable, else nil @param error The NSError for the authentication failure, if applicable, else nil @result An authentication challenge initialized with the specified parameters */ - (id)initWithProtectionSpace:(NSURLProtectionSpace *)space proposedCredential:(NSURLCredential *)credential previousFailureCount:(NSInteger)previousFailureCount failureResponse:(NSURLResponse *)response error:(NSError *)error sender:(id)sender; /*! @method initWithAuthenticationChallenge: @abstract Initialize an authentication challenge copying all parameters from another one. @param challenge @result A new challenge initialized with the parameters from the passed in challenge @discussion This initializer may be useful to subclassers that want to proxy one type of authentication challenge to look like another type. */ - (id)initWithAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge sender:(id)sender; /*! @method protectionSpace @abstract Get a description of the protection space that requires authentication @result The protection space that needs authentication */ - (NSURLProtectionSpace *)protectionSpace; /*! @method proposedCredential @abstract Get the proposed credential for this challenge @result The proposed credential @discussion proposedCredential may be nil, if there is no default credential to use for this challenge (either stored or in the URL). If the credential is not nil and returns YES for hasPassword, this means the NSURLConnection thinks the credential is ready to use as-is. If it returns NO for hasPassword, then the credential is not ready to use as-is, but provides a default username the client could use when prompting. */ - (NSURLCredential *)proposedCredential; /*! @method previousFailureCount @abstract Get count of previous failed authentication attempts @result The count of previous failures */ - (NSInteger)previousFailureCount; /*! @method failureResponse @abstract Get the response representing authentication failure. @result The failure response or nil @discussion If there was a previous authentication failure, and this protocol uses responses to indicate authentication failure, then this method will return the response. Otherwise it will return nil. */ - (NSURLResponse *)failureResponse; /*! @method error @abstract Get the error representing authentication failure. @discussion If there was a previous authentication failure, and this protocol uses errors to indicate authentication failure, then this method will return the error. Otherwise it will return nil. */ - (NSError *)error; /*! @method sender @abstract Get the sender of this challenge @result The sender of the challenge @discussion The sender is the object you should reply to when done processing the challenge. */ - (id)sender; @end /* NSURLCache.h Copyright (c) 2003-2012, Apple Inc. All rights reserved. Public header file. */ #import /*! @enum NSURLCacheStoragePolicy @discussion The NSURLCacheStoragePolicy enum defines constants that can be used to specify the type of storage that is allowable for an NSCachedURLResponse object that is to be stored in an NSURLCache. @constant NSURLCacheStorageAllowed Specifies that storage in an NSURLCache is allowed without restriction. @constant NSURLCacheStorageAllowedInMemoryOnly Specifies that storage in an NSURLCache is allowed; however storage should be done in memory only, no disk storage should be done. @constant NSURLCacheStorageNotAllowed Specifies that storage in an NSURLCache is not allowed in any fashion, either in memory or on disk. */ enum { NSURLCacheStorageAllowed, NSURLCacheStorageAllowedInMemoryOnly, NSURLCacheStorageNotAllowed, }; typedef NSUInteger NSURLCacheStoragePolicy; @class NSCachedURLResponseInternal; @class NSData; @class NSDictionary; @class NSURLRequest; @class NSURLResponse; /*! @class NSCachedURLResponse NSCachedURLResponse is a class whose objects functions as a wrapper for objects that are stored in the framework's caching system. It is used to maintain characteristics and attributes of a cached object. */ @interface NSCachedURLResponse : NSObject { @private NSCachedURLResponseInternal *_internal; } /*! @method initWithResponse:data @abstract Initializes an NSCachedURLResponse with the given response and data. @discussion A default NSURLCacheStoragePolicy is used for NSCachedURLResponse objects initialized with this method: NSURLCacheStorageAllowed. @param response a NSURLResponse object. @param data an NSData object representing the URL content corresponding to the given response. @result an initialized NSCachedURLResponse. */ - (id)initWithResponse:(NSURLResponse *)response data:(NSData *)data; /*! @method initWithResponse:data:userInfo:storagePolicy: @abstract Initializes an NSCachedURLResponse with the given response, data, user-info dictionary, and storage policy. @param response a NSURLResponse object. @param data an NSData object representing the URL content corresponding to the given response. @param userInfo a dictionary user-specified information to be stored with the NSCachedURLResponse. @param storagePolicy an NSURLCacheStoragePolicy constant. @result an initialized NSCachedURLResponse. */ - (id)initWithResponse:(NSURLResponse *)response data:(NSData *)data userInfo:(NSDictionary *)userInfo storagePolicy:(NSURLCacheStoragePolicy)storagePolicy; /*! @method response @abstract Returns the response wrapped by this instance. @result The response wrapped by this instance. */ - (NSURLResponse *)response; /*! @method data @abstract Returns the data of the receiver. @result The data of the receiver. */ - (NSData *)data; /*! @method userInfo @abstract Returns the userInfo dictionary of the receiver. @result The userInfo dictionary of the receiver. */ - (NSDictionary *)userInfo; /*! @method storagePolicy @abstract Returns the NSURLCacheStoragePolicy constant of the receiver. @result The NSURLCacheStoragePolicy constant of the receiver. */ - (NSURLCacheStoragePolicy)storagePolicy; @end @class NSURLRequest; @class NSURLCacheInternal; @interface NSURLCache : NSObject { @private NSURLCacheInternal *_internal; } /*! @method sharedURLCache @abstract Returns the shared NSURLCache instance. @discussion Unless set explicitly through a call to +setSharedURLCache:, this method returns an NSURLCache instance created with the following default values:

  • Memory capacity: 4 megabytes (4 * 1024 * 1024 bytes)
  • Disk capacity: 20 megabytes (20 * 1024 * 1024 bytes)
  • Disk path: (user home directory)/Library/Caches/(current application name)
    where:
    user home directory is determined by calling NSHomeDirectory()
    current application name is determined by calling [[NSProcessInfo processInfo] processName]

Users who do not have special caching requirements or constraints should find the default shared cache instance acceptable. If this default shared cache instance is not acceptable, +setSharedURLCache: can be called to set a different NSURLCache instance to be returned from this method. @result the shared NSURLCache instance. */ + (NSURLCache *)sharedURLCache; /*! @method setSharedURLCache: @abstract Sets the NSURLCache instance shared by all clients of the current process. This will be the new object returned when calls to the sharedURLCache method are made. @discussion Callers should take care to ensure that this method is called at a time when no other caller has a reference to the previously-set shared URL cache. This is to prevent storing cache data from becoming unexpectedly unretrievable. @param cache the new shared NSURLCache instance. */ + (void)setSharedURLCache:(NSURLCache *)cache; /*! @method initWithMemoryCapacity:diskCapacity:diskPath: @abstract Initializes an NSURLCache with the given capacity and path. @discussion The returned NSURLCache is backed by disk, so developers can be more liberal with space when choosing the capacity for this kind of cache. A disk cache measured in the tens of megabytes should be acceptable in most cases. @param capacity the capacity, measured in bytes, for the cache. @param path the path on disk where the cache data is stored. @result an initialized NSURLCache, with the given capacity, backed by disk. */ - (id)initWithMemoryCapacity:(NSUInteger)memoryCapacity diskCapacity:(NSUInteger)diskCapacity diskPath:(NSString *)path; /*! @method cachedResponseForRequest: @abstract Returns the NSCachedURLResponse stored in the cache with the given request. @discussion The method returns nil if there is no NSCachedURLResponse stored using the given request. @param request the NSURLRequest to use as a key for the lookup. @result The NSCachedURLResponse stored in the cache with the given request, or nil if there is no NSCachedURLResponse stored with the given request. */ - (NSCachedURLResponse *)cachedResponseForRequest:(NSURLRequest *)request; /*! @method storeCachedResponse:forRequest: @abstract Stores the given NSCachedURLResponse in the cache using the given request. @param cachedResponse The cached response to store. @param request the NSURLRequest to use as a key for the storage. */ - (void)storeCachedResponse:(NSCachedURLResponse *)cachedResponse forRequest:(NSURLRequest *)request; /*! @method removeCachedResponseForRequest: @abstract Removes the NSCachedURLResponse from the cache that is stored using the given request. @discussion No action is taken if there is no NSCachedURLResponse stored with the given request. @param request the NSURLRequest to use as a key for the lookup. */ - (void)removeCachedResponseForRequest:(NSURLRequest *)request; /*! @method removeAllCachedResponses @abstract Clears the given cache, removing all NSCachedURLResponse objects that it stores. */ - (void)removeAllCachedResponses; /*! @method memoryCapacity @abstract Returns the in-memory capacity of the receiver. @result The in-memory capacity, measured in bytes, for the receiver. */ - (NSUInteger)memoryCapacity; /*! @method diskCapacity @abstract Returns the on-disk capacity of the receiver. @result The on-disk capacity, measured in bytes, for the receiver. */ - (NSUInteger)diskCapacity; /*! @method setMemoryCapacity: @abstract Sets the in-memory capacity of the receiver. @discussion At the time this call is made, the in-memory cache will truncate its contents to the size given, if necessary. @param memoryCapacity the new in-memory capacity, measured in bytes, for the receiver. */ - (void)setMemoryCapacity:(NSUInteger)memoryCapacity; /*! @method setDiskCapacity: @abstract Sets the on-disk capacity of the receiver. @discussion At the time this call is made, the on-disk cache will truncate its contents to the size given, if necessary. @param diskCapacity the new on-disk capacity, measured in bytes, for the receiver. */ - (void)setDiskCapacity:(NSUInteger)diskCapacity; /*! @method currentMemoryUsage @abstract Returns the current amount of space consumed by the in-memory cache of the receiver. @discussion This size, measured in bytes, indicates the current usage of the in-memory cache. @result the current usage of the in-memory cache of the receiver. */ - (NSUInteger)currentMemoryUsage; /*! @method currentDiskUsage @abstract Returns the current amount of space consumed by the on-disk cache of the receiver. @discussion This size, measured in bytes, indicates the current usage of the on-disk cache. @result the current usage of the on-disk cache of the receiver. */ - (NSUInteger)currentDiskUsage; @end /* NSURLConnection.h Copyright (c) 2003-2012, Apple Inc. All rights reserved. Public header file. */ #import @class NSArray; @class NSURL; @class NSCachedURLResponse; @class NSData; @class NSError; @class NSURLAuthenticationChallenge; @class NSURLConnectionInternal; @class NSURLRequest; @class NSURLResponse; @class NSRunLoop; @class NSInputStream; @class NSURLProtectionSpace; @class NSOperationQueue; @protocol NSURLConnectionDelegate; /*! @class NSURLConnection @abstract An NSURLConnection object provides support to perform asynchronous loads of a URL request, providing data to a client supplied delegate. @discussion The interface for NSURLConnection is very sparse, providing only the controls to start and cancel asynchronous loads of a URL request.

An NSURLConnection may be used for loading of resource data directly to memory, in which case an NSURLConnectionDataDelegate should be supplied, or for downloading of resource data directly to a file, in which case an NSURLConnectionDownloadDelegate is used. The delegate is retained by the NSURLConnection until a terminal condition is encountered. These two delegates are logically subclasses of the base protocol, NSURLConnectionDelegate.

A terminal condition produced by the loader will result in a connection:didFailWithError: in the case of an error, or connectiondidFinishLoading: or connectionDidFinishDownloading: delegate message.

The -cancel message hints to the loader that a resource load should be abandoned but does not guarantee that more delegate messages will not be delivered. If -cancel does cause the load to be abandoned, the delegate will be released without further messages. In general, a caller should be prepared for -cancel to have no effect, and internally ignore any delegate callbacks until the delegate is released. Scheduling of an NSURLConnection specifies the context in which delegate callbacks will be made, but the actual IO may occur on a separate thread and should be considered an implementation detail.

When created, an NSURLConnection performs a deep-copy of the NSURLRequest. This copy is available through the -originalRequest method. As the connection performs the load, this request may change as a result of protocol canonicalization or due to following redirects. -currentRequest can be used to retrieve this value.

An NSURLConnections created with the +connectionWithRequest:delegate: or -initWithRequest:delegate: methods are scheduled on the current runloop immediately, and it is not necessary to send the -start message to begin the resource load.

NSURLConnections created with -initWithRequest:delegate:startImmediately: are not automatically scheduled. Use -scheduleWithRunLoop:forMode: or -setDelegateQueue: to specify the context for delegate callbacks, and -start to begin the load. If you do not explicitly schedule the connection before -start, it will be scheduled on the current runloop and mode automatically.

The NSURLConnectionSynchronousLoading category adds +sendSynchronousRequest:returningResponse:error, which blocks the current thread until the resource data is available or an error occurs. It should be noted that using this method on an applications main run loop may result in an unacceptably long delay in a user interface and its use is strongly discourage.

The NSURLConnectionQueuedLoading category implements +sendAsynchronousRequest:queue:completionHandler, providing similar simplicity but provides a mechanism where the current runloop is not blocked.

Both of the immediate loading categories do not provide for customization of resource load, and do not allow the caller to respond to, e.g., authentication challenges.

*/ @interface NSURLConnection : NSObject { @private NSURLConnectionInternal *_internal; } /* Designated initializer */ - (id)initWithRequest:(NSURLRequest *)request delegate:(id)delegate startImmediately:(BOOL)startImmediately NS_AVAILABLE(10_5, 2_0); - (id)initWithRequest:(NSURLRequest *)request delegate:(id)delegate; + (NSURLConnection*)connectionWithRequest:(NSURLRequest *)request delegate:(id)delegate; - (NSURLRequest *)originalRequest NS_AVAILABLE_IOS(5_0); - (NSURLRequest *)currentRequest NS_AVAILABLE_IOS(5_0); - (void)start NS_AVAILABLE(10_5, 2_0); - (void)cancel; - (void)scheduleInRunLoop:(NSRunLoop *)aRunLoop forMode:(NSString *)mode NS_AVAILABLE(10_5, 2_0); - (void)unscheduleFromRunLoop:(NSRunLoop *)aRunLoop forMode:(NSString *)mode NS_AVAILABLE(10_5, 2_0); - (void)setDelegateQueue:(NSOperationQueue*) queue NS_AVAILABLE(10_7, 5_0); /*! @method canHandleRequest: @abstract Performs a "preflight" operation that performs some speculative checks to see if a connection can be initialized, and the associated I/O that is started in the initializer methods can begin. @discussion The result of this method is valid only as long as no protocols are registered or unregistered, and as long as the request is not mutated (if the request is mutable). Hence, clients should be prepared to handle failures even if they have performed request preflighting by calling this method. @param request The request to preflight. @result YES if it is likely that the given request can be used to initialize a connection and the associated I/O can be started NO */ + (BOOL)canHandleRequest:(NSURLRequest *)request; @end /*! @protocol NSURLConnectionDelegate @abstract Delegate methods that are common to all forms of NSURLConnection. These are all optional. This protocol should be considered a base class for the NSURLConnectionDataDelegate and NSURLConnectionDownloadDelegate protocols. @discussion connection:didFailWithError: will be called at most once, if an error occurs during a resource load. No other callbacks will be made after.

connectionShouldUseCredentialStorage: will be called at most once, before a resource load begins (which means it may be called during construction of the connection.) The delegate should return TRUE if the connection should consult the shared NSURLCredentialStorage in response to authentication challenges. Regardless of the result, the authentication challenge methods may still be called. connection:willSendRequestForAuthenticationChallenge: is the preferred (Mac OS X 10.6 and iOS 4.0 or later) mechanism for responding to authentication challenges. See for more information on dealing with the various types of authentication challenges. connection:canAuthenticateAgainstProtectionSpace: connection:didReciveAuthenticationChallenge: connection:didCancelAuthenticationChallenge: are deprected and new code should adopt connection:willSendRequestForAuthenticationChallenge. The older delegates will still be called for compatability, but incur more latency in dealing with the authentication challenge. */ @protocol NSURLConnectionDelegate @optional - (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error; - (BOOL)connectionShouldUseCredentialStorage:(NSURLConnection *)connection; - (void)connection:(NSURLConnection *)connection willSendRequestForAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge; // Deprecated authentication delegates. - (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace; - (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge; - (void)connection:(NSURLConnection *)connection didCancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge; @end /*! @protocol NSURLConnectionDataDelegate @abstract Delegate methods used for loading data to memory. These delegate methods are all optional. @discussion connection:willSendRequest:redirectResponse: is called whenever an connection determines that it must change URLs in order to continue loading a request. This gives the delegate an opportunity inspect and if necessary modify a request. A delegate can cause the request to abort by either calling the connections -cancel method, or by returning nil from this callback.

There is one subtle difference which results from this choice. If -cancel is called in the delegate method, all processing for the connection stops, and no further delegate callbacks will be sent. If the delegate returns nil, the connection will continue to process, and this has special relevance in the case where the redirectResponse argument is non-nil. In this case, any data that is loaded for the connection will be sent to the delegate, and the delegate will receive a finished or failure delegate callback as appropriate.

connection:didReceiveResponse: is called when enough data has been read to construct an NSURLResponse object. In the event of a protocol which may return multiple responses (such as HTTP multipart/x-mixed-replace) the delegate should be prepared to inspect the new response and make itself ready for data callbacks as appropriate.

connection:didReceiveData: is called with a single immutable NSData object to the delegate, representing the next portion of the data loaded from the connection. This is the only guaranteed for the delegate to receive the data from the resource load.

connection:needNewBodyStream: is called when the loader must retransmit a requests payload, due to connection errors or authentication challenges. Delegates should construct a new unopened and autoreleased NSInputStream. If not implemented, the loader will be required to spool the bytes to be uploaded to disk, a potentially expensive operation. Returning nil will cancel the connection. connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite: is called during an upload operation to provide progress feedback. Note that the values may change in unexpected ways if the request needs to be retransmitted.

connection:willCacheResponse: gives the delegate an opportunity to inspect and modify the NSCachedURLResponse which will be cached by the loader if caching is enabled for the original NSURLRequest. Returning nil from this delegate will prevent the resource from being cached. Note that the -data method of the cached response may return an autoreleased in-memory copy of the true data, and should not be used as an alternative to receiving and accumulating the data through connection:didReceiveData:

connectionDidFinishLoading: is called when all connection processing has completed successfully, before the delegate is released by the connection.

*/ @protocol NSURLConnectionDataDelegate @optional - (NSURLRequest *)connection:(NSURLConnection *)connection willSendRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)response; - (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response; - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data; - (NSInputStream *)connection:(NSURLConnection *)connection needNewBodyStream:(NSURLRequest *)request; - (void)connection:(NSURLConnection *)connection didSendBodyData:(NSInteger)bytesWritten totalBytesWritten:(NSInteger)totalBytesWritten totalBytesExpectedToWrite:(NSInteger)totalBytesExpectedToWrite; - (NSCachedURLResponse *)connection:(NSURLConnection *)connection willCacheResponse:(NSCachedURLResponse *)cachedResponse; - (void)connectionDidFinishLoading:(NSURLConnection *)connection; @end /*! @protocol NSURLConnectionDownloadDelegate @abstract Delegate methods used to perform resource downloads directly to a disk file. All the methods are optional with the exception of connectionDidFinishDownloading:destinationURL: which must be implemented in order to inform the delegate of the location of the finished download. This delegate and download implementation is currently only available on iOS 5.0 or later. @discussion connection:didWriteData:totalBytesWritten:expectedTotalBytes: provides progress information about the state of the download, the number of bytes written since the last delegate callback, the total number of bytes written to disk and the total number of bytes that are expected (or 0 if this is unknown.) connectionDidResumeDownloading:totalBytesWritten:expectedTotalBytes: is called when the connection is able to resume an in progress download. This may happen due to a connection or network failure. connectionDidFinishDownloading:destinationURL: is a terminal event which indicates the completion of a download and provides the location of the file. The file will be located in the applications cache directory and is guaranteed to exist for the duration of the delegate callback. The implication is that the delegate should copy or move the download to a more persistent location if desired. */ @protocol NSURLConnectionDownloadDelegate @optional - (void)connection:(NSURLConnection *)connection didWriteData:(long long)bytesWritten totalBytesWritten:(long long)totalBytesWritten expectedTotalBytes:(long long) expectedTotalBytes; - (void)connectionDidResumeDownloading:(NSURLConnection *)connection totalBytesWritten:(long long)totalBytesWritten expectedTotalBytes:(long long) expectedTotalBytes; @required - (void)connectionDidFinishDownloading:(NSURLConnection *)connection destinationURL:(NSURL *) destinationURL; @end /*! @category NSURLConnection(NSURLConnectionSynchronousLoading) @abstract The NSURLConnectionSynchronousLoading category on NSURLConnection provides the interface to perform synchronous loading of URL requests. */ @interface NSURLConnection (NSURLConnectionSynchronousLoading) /*! @method sendSynchronousRequest:returningResponse:error: @abstract Performs a synchronous load of the given request, returning an NSURLResponse in the given out parameter. @discussion A synchronous load for the given request is built on top of the asynchronous loading code made available by the class. The calling thread is blocked while the asynchronous loading system performs the URL load on a thread spawned specifically for this load request. No special threading or run loop configuration is necessary in the calling thread in order to perform a synchronous load. For instance, the calling thread need not be running its run loop. @param request The request to load. Note that the request is deep-copied as part of the initialization process. Changes made to the request argument after this method returns do not affect the request that is used for the loading process. @param response An out parameter which is filled in with the response generated by performing the load. @param error Out parameter (may be NULL) used if an error occurs while processing the request. Will not be modified if the load succeeds. @result The content of the URL resulting from performing the load, or nil if the load failed. */ + (NSData *)sendSynchronousRequest:(NSURLRequest *)request returningResponse:(NSURLResponse **)response error:(NSError **)error; @end #if NS_BLOCKS_AVAILABLE /*! @category NSURLConnection(NSURLConnectionQueuedLoading) The NSURLConnectionQueuedLoading category on NSURLConnection provides the interface to perform asynchronous loading of URL requests where the results of the request are delivered to a block via an NSOperationQueue. Note that there is no guarantee of load ordering implied by this method. */ @interface NSURLConnection (NSURLConnectionQueuedLoading) /*! @method sendAsynchronousRequest:queue:completionHandler: @abstract Performs an asynchronous load of the given request. When the request has completed or failed, the block will be executed from the context of the specified NSOperationQueue. @discussion This is a convenience routine that allows for asynchronous loading of an url based resource. If the resource load is successful, the data parameter to the callback will contain the resource data and the error parameter will be nil. If the resource load fails, the data parameter will be nil and the error will contain information about the failure. @param request The request to load. Note that the request is deep-copied as part of the initialization process. Changes made to the request argument after this method returns do not affect the request that is used for the loading process. @param queue An NSOperationQueue upon which the handler block will be dispatched. @param handler A block which receives the results of the resource load. */ + (void)sendAsynchronousRequest:(NSURLRequest *)request queue:(NSOperationQueue*) queue completionHandler:(void (^)(NSURLResponse*, NSData*, NSError*)) handler NS_AVAILABLE(10_7, 5_0); @end #endif /* NSURLCredential.h Copyright (c) 2003-2012, Apple Inc. All rights reserved. Public header file. */ #import #import @class NSString; @class NSArray; /*! @enum NSURLCredentialPersistence @abstract Constants defining how long a credential will be kept around @constant NSURLCredentialPersistenceNone This credential won't be saved. @constant NSURLCredentialPersistenceForSession This credential will only be stored for this session. @constant NSURLCredentialPersistencePermanent This credential will be stored permanently. Note: Whereas in Mac OS X any application can access any credential provided the user gives permission, in iPhone OS an application can access only its own credentials. */ typedef NS_ENUM(NSUInteger, NSURLCredentialPersistence) { NSURLCredentialPersistenceNone, NSURLCredentialPersistenceForSession, NSURLCredentialPersistencePermanent }; @class NSURLCredentialInternal; /*! @class NSURLCredential @discussion This class is an immutable object representing an authentication credential. The actual type of the credential is determined by the constructor called in the categories declared below. */ @interface NSURLCredential : NSObject { @private __strong NSURLCredentialInternal *_internal; } /*! @method persistence @abstract Determine whether this credential is or should be stored persistently @result A value indicating whether this credential is stored permanently, per session or not at all. */ - (NSURLCredentialPersistence)persistence; @end /*! @class NSURLCredential(NSInternetPassword) @discussion This category defines the methods available to an NSURLCredential created to represent an internet password credential. These are most commonly used for resources that require a username and password combination. */ @interface NSURLCredential(NSInternetPassword) /*! @method initWithUser:password:persistence: @abstract Initialize a NSURLCredential with a user and password @param user the username @param password the password @param persistence enum that says to store per session, permanently or not at all @result The initialized NSURLCredential */ - (id)initWithUser:(NSString *)user password:(NSString *)password persistence:(NSURLCredentialPersistence)persistence; /*! @method credentialWithUser:password:persistence: @abstract Create a new NSURLCredential with a user and password @param user the username @param password the password @param persistence enum that says to store per session, permanently or not at all @result The new autoreleased NSURLCredential */ + (NSURLCredential *)credentialWithUser:(NSString *)user password:(NSString *)password persistence:(NSURLCredentialPersistence)persistence; /*! @method user @abstract Get the username @result The user string */ - (NSString *)user; /*! @method password @abstract Get the password @result The password string @discussion This method might actually attempt to retrieve the password from an external store, possible resulting in prompting, so do not call it unless needed. */ - (NSString *)password; /*! @method hasPassword @abstract Find out if this credential has a password, without trying to get it @result YES if this credential has a password, otherwise NO @discussion If this credential's password is actually kept in an external store, the password method may return nil even if this method returns YES, since getting the password may fail, or the user may refuse access. */ - (BOOL)hasPassword; @end /*! @class NSURLCredential(NSClientCertificate) @discussion This category defines the methods available to an NSURLCredential created to represent a client certificate credential. Client certificates are commonly stored on the users computer in the keychain and must be presented to the server during a handshake. */ @interface NSURLCredential(NSClientCertificate) /*! @method initWithIdentity:certificateArray:persistence: @abstract Initialize an NSURLCredential with an identity and array of at least 1 client certificates (SecCertificateRef) @param identity a SecIdentityRef object @param certArray an array containing at least one SecCertificateRef objects @param persistence enum that says to store per session, permanently or not at all @result the Initialized NSURLCredential */ - (id)initWithIdentity:(SecIdentityRef)identity certificates:(NSArray *)certArray persistence:(NSURLCredentialPersistence) persistence NS_AVAILABLE(10_6, 3_0); /*! @method credentialWithCertificateArray:password:persistence: @abstract Create a new NSURLCredential with an identity and certificate array @param identity a SecIdentityRef object @param certArray an array containing at least one SecCertificateRef objects @param persistence enum that says to store per session, permanently or not at all @result The new autoreleased NSURLCredential */ + (NSURLCredential *)credentialWithIdentity:(SecIdentityRef)identity certificates:(NSArray *)certArray persistence:(NSURLCredentialPersistence)persistence NS_AVAILABLE(10_6, 3_0); /*! @method identity @abstract Returns the SecIdentityRef of this credential, if it was created with a certificate and identity @result A SecIdentityRef or NULL if this is a username/password credential */ - (SecIdentityRef)identity; /*! @method certificateArray @abstract Returns an NSArray of SecCertificateRef objects representing the client certificate for this credential, if this credential was created with an identity and certificate. @result an NSArray of SecCertificateRef or NULL if this is a username/password credential */ - (NSArray *)certificates NS_AVAILABLE(10_6, 3_0); @end @interface NSURLCredential(NSServerTrust) /*! @method initWithTrust:(SecTrustRef) trust @abstract Initialize a new NSURLCredential which specifies that the specified trust has been accepted. @result the Initialized NSURLCredential */ - (id)initWithTrust:(SecTrustRef)trust NS_AVAILABLE(10_6, 3_0); /*! @method continueWithHandshakeCredential @abstract Create a new NSURLCredential which specifies that a handshake has been trusted. @result The new autoreleased NSURLCredential */ + (NSURLCredential *)credentialForTrust:(SecTrustRef)trust NS_AVAILABLE(10_6, 3_0); @end /* NSURLCredentialStorage.h Copyright (c) 2003-2012, Apple Inc. All rights reserved. Public header file. */ #import @class NSDictionary; @class NSString; @class NSURLCredential; @class NSURLProtectionSpace; @class NSURLCredentialStorageInternal; /*! @class NSURLCredentialStorage @discussion NSURLCredentialStorage implements a singleton object (shared instance) which manages the shared credentials cache. Note: Whereas in Mac OS X any application can access any credential with a persistence of NSURLCredentialPersistencePermanent provided the user gives permission, in iPhone OS an application can access only its own credentials. */ @interface NSURLCredentialStorage : NSObject { @private NSURLCredentialStorageInternal *_internal; } /*! @method sharedCredentialStorage @abstract Get the shared singleton authentication storage @result the shared authentication storage */ + (NSURLCredentialStorage *)sharedCredentialStorage; /*! @method credentialsForProtectionSpace: @abstract Get a dictionary mapping usernames to credentials for the specified protection space. @param protectionSpace An NSURLProtectionSpace indicating the protection space for which to get credentials @result A dictionary where the keys are usernames and the values are the corresponding NSURLCredentials. */ - (NSDictionary *)credentialsForProtectionSpace:(NSURLProtectionSpace *)space; /*! @method allCredentials @abstract Get a dictionary mapping NSURLProtectionSpaces to dictionaries which map usernames to NSURLCredentials @result an NSDictionary where the keys are NSURLProtectionSpaces and the values are dictionaries, in which the keys are usernames and the values are NSURLCredentials */ - (NSDictionary *)allCredentials; /*! @method setCredential:forProtectionSpace: @abstract Add a new credential to the set for the specified protection space or replace an existing one. @param credential The credential to set. @param space The protection space for which to add it. @discussion Multiple credentials may be set for a given protection space, but each must have a distinct user. If a credential with the same user is already set for the protection space, the new one will replace it. */ - (void)setCredential:(NSURLCredential *)credential forProtectionSpace:(NSURLProtectionSpace *)space; /*! @method removeCredential:forProtectionSpace: @abstract Remove the a credential from the set for the specified protection space. @param credential The credential to remove. @param space The protection space for which a credential should be removed @discussion The credential is removed from both persistent and temporary storage. */ - (void)removeCredential:(NSURLCredential *)credential forProtectionSpace:(NSURLProtectionSpace *)space; /*! @method defaultCredentialForProtectionSpace: @abstract Get the default credential for the specified protection space. @param space The protection space for which to get the default credential. */ - (NSURLCredential *)defaultCredentialForProtectionSpace:(NSURLProtectionSpace *)space; /*! @method setDefaultCredential:forProtectionSpace: @abstract Set the default credential for the specified protection space. @param credential The credential to set as default. @param space The protection space for which the credential should be set as default. @discussion If the credential is not yet in the set for the protection space, it will be added to it. */ - (void)setDefaultCredential:(NSURLCredential *)credential forProtectionSpace:(NSURLProtectionSpace *)space; @end /*! @const NSURLCredentialStorageChangedNotification @abstract This notification is sent on the main thread whenever the set of stored credentials changes. */ FOUNDATION_EXPORT NSString *const NSURLCredentialStorageChangedNotification; /* NSURLError.h Copyright (c) 2003-2012, Apple Inc. All rights reserved. Public header file. */ // Retrieve kCFURLError* values used in the NSURLError* assignments #if TARGET_OS_EMBEDDED || TARGET_OS_IPHONE || TARGET_OS_WIN32 #import #else #import #endif #import @class NSString; /* @discussion Constants used by NSError to differentiate between "domains" of error codes, serving as a discriminator for error codes that originate from different subsystems or sources. @constant WebFoundationErrorDomain Indicates a WebFoundation error. */ FOUNDATION_EXPORT NSString * const NSURLErrorDomain; /*! @const NSURLErrorFailingURLErrorKey @abstract The NSError userInfo dictionary key used to store and retrieve the URL which caused a load to fail. */ FOUNDATION_EXPORT NSString * const NSURLErrorFailingURLErrorKey NS_AVAILABLE(10_6, 4_0); /*! @const NSURLErrorFailingURLStringErrorKey @abstract The NSError userInfo dictionary key used to store and retrieve the NSString object for the URL which caused a load to fail. @discussion This constant supersedes NSErrorFailingURLStringKey, which was deprecated in Mac OS X 10.6. Both constants refer to the same value for backward-compatibility, but this symbol name has a better prefix. */ FOUNDATION_EXPORT NSString * const NSURLErrorFailingURLStringErrorKey NS_AVAILABLE(10_6, 4_0); /*! @const NSErrorFailingURLStringKey @abstract The NSError userInfo dictionary key used to store and retrieve the NSString object for the URL which caused a load to fail. @discussion This constant is deprecated in Mac OS X 10.6, and is superseded by NSURLErrorFailingURLStringErrorKey. Both constants refer to the same value for backward-compatibility, but the new symbol name has a better prefix. */ FOUNDATION_EXPORT NSString * const NSErrorFailingURLStringKey NS_DEPRECATED(10_0, 10_6, 2_0, 4_0); /*! @const NSURLErrorFailingURLPeerTrustErrorKey @abstract The NSError userInfo dictionary key used to store and retrieve the SecTrustRef object representing the state of a failed SSL handshake. */ FOUNDATION_EXPORT NSString * const NSURLErrorFailingURLPeerTrustErrorKey NS_AVAILABLE(10_6, 4_0); /*! @enum NSURL-related Error Codes @abstract Constants used by NSError to indicate errors in the WebFoundation domain @discussion Documentation on each constant forthcoming. */ enum { NSURLErrorUnknown = -1, NSURLErrorCancelled = kCFURLErrorCancelled, NSURLErrorBadURL = kCFURLErrorBadURL, NSURLErrorTimedOut = kCFURLErrorTimedOut, NSURLErrorUnsupportedURL = kCFURLErrorUnsupportedURL, NSURLErrorCannotFindHost = kCFURLErrorCannotFindHost, NSURLErrorCannotConnectToHost = kCFURLErrorCannotConnectToHost, NSURLErrorNetworkConnectionLost = kCFURLErrorNetworkConnectionLost, NSURLErrorDNSLookupFailed = kCFURLErrorDNSLookupFailed, NSURLErrorHTTPTooManyRedirects = kCFURLErrorHTTPTooManyRedirects, NSURLErrorResourceUnavailable = kCFURLErrorResourceUnavailable, NSURLErrorNotConnectedToInternet = kCFURLErrorNotConnectedToInternet, NSURLErrorRedirectToNonExistentLocation = kCFURLErrorRedirectToNonExistentLocation, NSURLErrorBadServerResponse = kCFURLErrorBadServerResponse, NSURLErrorUserCancelledAuthentication = kCFURLErrorUserCancelledAuthentication, NSURLErrorUserAuthenticationRequired = kCFURLErrorUserAuthenticationRequired, NSURLErrorZeroByteResource = kCFURLErrorZeroByteResource, NSURLErrorCannotDecodeRawData = kCFURLErrorCannotDecodeRawData, NSURLErrorCannotDecodeContentData = kCFURLErrorCannotDecodeContentData, NSURLErrorCannotParseResponse = kCFURLErrorCannotParseResponse, NSURLErrorFileDoesNotExist = kCFURLErrorFileDoesNotExist, NSURLErrorFileIsDirectory = kCFURLErrorFileIsDirectory, NSURLErrorNoPermissionsToReadFile = kCFURLErrorNoPermissionsToReadFile, NSURLErrorDataLengthExceedsMaximum NS_ENUM_AVAILABLE(10_5, 2_0) = kCFURLErrorDataLengthExceedsMaximum, // SSL errors NSURLErrorSecureConnectionFailed = kCFURLErrorSecureConnectionFailed, NSURLErrorServerCertificateHasBadDate = kCFURLErrorServerCertificateHasBadDate, NSURLErrorServerCertificateUntrusted = kCFURLErrorServerCertificateUntrusted, NSURLErrorServerCertificateHasUnknownRoot = kCFURLErrorServerCertificateHasUnknownRoot, NSURLErrorServerCertificateNotYetValid = kCFURLErrorServerCertificateNotYetValid, NSURLErrorClientCertificateRejected = kCFURLErrorClientCertificateRejected, NSURLErrorClientCertificateRequired = kCFURLErrorClientCertificateRequired, NSURLErrorCannotLoadFromNetwork = kCFURLErrorCannotLoadFromNetwork, // Download and file I/O errors NSURLErrorCannotCreateFile = kCFURLErrorCannotCreateFile, NSURLErrorCannotOpenFile = kCFURLErrorCannotOpenFile, NSURLErrorCannotCloseFile = kCFURLErrorCannotCloseFile, NSURLErrorCannotWriteToFile = kCFURLErrorCannotWriteToFile, NSURLErrorCannotRemoveFile = kCFURLErrorCannotRemoveFile, NSURLErrorCannotMoveFile = kCFURLErrorCannotMoveFile, NSURLErrorDownloadDecodingFailedMidStream = kCFURLErrorDownloadDecodingFailedMidStream, NSURLErrorDownloadDecodingFailedToComplete =kCFURLErrorDownloadDecodingFailedToComplete, NSURLErrorInternationalRoamingOff NS_ENUM_AVAILABLE(10_7, 3_0) = kCFURLErrorInternationalRoamingOff, NSURLErrorCallIsActive NS_ENUM_AVAILABLE(10_7, 3_0) = kCFURLErrorCallIsActive, NSURLErrorDataNotAllowed NS_ENUM_AVAILABLE(10_7, 3_0) = kCFURLErrorDataNotAllowed, NSURLErrorRequestBodyStreamExhausted NS_ENUM_AVAILABLE(10_7, 3_0) = kCFURLErrorRequestBodyStreamExhausted, }; /* NSURLProtectionSpace.h Copyright (c) 2003-2012, Apple Inc. All rights reserved. Public header file. */ #import #import @class NSString; @class NSArray; /*! @const NSURLProtectionSpaceHTTP @abstract The protocol for HTTP */ FOUNDATION_EXPORT NSString * const NSURLProtectionSpaceHTTP NS_AVAILABLE(10_5, 2_0); /*! @const NSURLProtectionSpaceHTTPS @abstract The protocol for HTTPS */ FOUNDATION_EXPORT NSString * const NSURLProtectionSpaceHTTPS NS_AVAILABLE(10_5, 2_0); /*! @const NSURLProtectionSpaceFTP @abstract The protocol for FTP */ FOUNDATION_EXPORT NSString * const NSURLProtectionSpaceFTP NS_AVAILABLE(10_5, 2_0); /*! @const NSURLProtectionSpaceHTTPProxy @abstract The proxy type for http proxies */ FOUNDATION_EXPORT NSString * const NSURLProtectionSpaceHTTPProxy; /*! @const NSURLProtectionSpaceHTTPSProxy @abstract The proxy type for https proxies */ FOUNDATION_EXPORT NSString * const NSURLProtectionSpaceHTTPSProxy; /*! @const NSURLProtectionSpaceFTPProxy @abstract The proxy type for ftp proxies */ FOUNDATION_EXPORT NSString * const NSURLProtectionSpaceFTPProxy; /*! @const NSURLProtectionSpaceSOCKSProxy @abstract The proxy type for SOCKS proxies */ FOUNDATION_EXPORT NSString * const NSURLProtectionSpaceSOCKSProxy; /*! @const NSURLAuthenticationMethodDefault @abstract The default authentication method for a protocol */ FOUNDATION_EXPORT NSString * const NSURLAuthenticationMethodDefault; /*! @const NSURLAuthenticationMethodHTTPBasic @abstract HTTP basic authentication. Equivalent to NSURLAuthenticationMethodDefault for http. */ FOUNDATION_EXPORT NSString * const NSURLAuthenticationMethodHTTPBasic; /*! @const NSURLAuthenticationMethodHTTPDigest @abstract HTTP digest authentication. */ FOUNDATION_EXPORT NSString * const NSURLAuthenticationMethodHTTPDigest; /*! @const NSURLAuthenticationMethodHTMLForm @abstract HTML form authentication. Applies to any protocol. */ FOUNDATION_EXPORT NSString * const NSURLAuthenticationMethodHTMLForm; /*! @const NSURLAuthenticationMethodNTLM @abstract NTLM authentication. */ FOUNDATION_EXPORT NSString * const NSURLAuthenticationMethodNTLM NS_AVAILABLE(10_5, 2_0); /*! @const NSURLAuthenticationMethodNegotiate @abstract Negotiate authentication. */ FOUNDATION_EXPORT NSString * const NSURLAuthenticationMethodNegotiate NS_AVAILABLE(10_5, 2_0); /*! @const NSURLAuthenticationMethodClientCertificate @abstract SSL Client certificate. Applies to any protocol. */ FOUNDATION_EXPORT NSString * const NSURLAuthenticationMethodClientCertificate NS_AVAILABLE(10_6, 3_0); /*! @const NSURLAuthenticationMethodServerTrust @abstract SecTrustRef validation required. Applies to any protocol. */ FOUNDATION_EXPORT NSString * const NSURLAuthenticationMethodServerTrust NS_AVAILABLE(10_6, 3_0); @class NSURLProtectionSpaceInternal; /*! @class NSURLProtectionSpace @discussion This class represents a protection space requiring authentication. */ @interface NSURLProtectionSpace : NSObject { @private NSURLProtectionSpaceInternal *_internal; } /*! @method initWithHost:port:protocol:realm:authenticationMethod: @abstract Initialize a protection space representing an origin server, or a realm on one @param host The hostname of the server @param port The port for the server @param protocol The sprotocol for this server - e.g. "http", "ftp", "https" @param realm A string indicating a protocol-specific subdivision of a single host. For http and https, this maps to the realm string in http authentication challenges. For many other protocols it is unused. @param authenticationMethod The authentication method to use to access this protection space - valid values include nil (default method), @"digest" and @"form". @result The initialized object. */ - (id)initWithHost:(NSString *)host port:(NSInteger)port protocol:(NSString *)protocol realm:(NSString *)realm authenticationMethod:(NSString *)authenticationMethod; /*! @method initWithProxyHost:port:type:realm:authenticationMethod: @abstract Initialize a protection space representing a proxy server, or a realm on one @param host The hostname of the proxy server @param port The port for the proxy server @param type The type of proxy - e.g. "http", "ftp", "SOCKS" @param realm A string indicating a protocol-specific subdivision of a single host. For http and https, this maps to the realm string in http authentication challenges. For many other protocols it is unused. @param authenticationMethod The authentication method to use to access this protection space - valid values include nil (default method) and @"digest" @result The initialized object. */ - (id)initWithProxyHost:(NSString *)host port:(NSInteger)port type:(NSString *)type realm:(NSString *)realm authenticationMethod:(NSString *)authenticationMethod; /*! @method realm @abstract Get the authentication realm for which the protection space that needs authentication @discussion This is generally only available for http authentication, and may be nil otherwise. @result The realm string */ - (NSString *)realm; /*! @method receivesCredentialSecurely @abstract Determine if the password for this protection space can be sent securely @result YES if a secure authentication method or protocol will be used, NO otherwise */ - (BOOL)receivesCredentialSecurely; /*! @method isProxy @abstract Determine if this authenticating protection space is a proxy server @result YES if a proxy, NO otherwise */ - (BOOL)isProxy; /*! @method host @abstract Get the proxy host if this is a proxy authentication, or the host from the URL. @result The host for this protection space. */ - (NSString *)host; /*! @method port @abstract Get the proxy port if this is a proxy authentication, or the port from the URL. @result The port for this protection space, or 0 if not set. */ - (NSInteger)port; /*! @method proxyType @abstract Get the type of this protection space, if a proxy @result The type string, or nil if not a proxy. */ - (NSString *)proxyType; /*! @method protocol @abstract Get the protocol of this protection space, if not a proxy @result The type string, or nil if a proxy. */ - (NSString *)protocol; /*! @method authenticationMethod @abstract Get the authentication method to be used for this protection space @result The authentication method */ - (NSString *)authenticationMethod; @end /*! @class NSURLProtectionSpace(NSClientCertificateSpace) @discussion This category supplies additional information for use when a client certificate is required by the server in order to complete authentication. */ @interface NSURLProtectionSpace(NSClientCertificateSpace) /*! @method distinguishedNames @abstract Returns an array of acceptable certificate issuing authorities for client certification authentication. Issuers are identified by their distinguished name and returned as a DER encoded data. @result An array of NSData objects. (Nil if the authenticationMethod is not NSURLAuthenticationMethodClientCertificate) */ - (NSArray *)distinguishedNames NS_AVAILABLE(10_6, 3_0); @end /*! @class NSURLProtectionSpace(NSServerTrustValidationSpace) @discussion This category supplies additional information for use by the client to evaluate whether to trust a given server during a security handshake. */ @interface NSURLProtectionSpace(NSServerTrustValidationSpace) /*! @method serverTrust @abstract Returns a SecTrustRef which represents the state of the servers SSL transaction state @result A SecTrustRef from Security.framework. (Nil if the authenticationMethod is not NSURLAuthenticationMethodServerTrust) */ - (SecTrustRef)serverTrust NS_AVAILABLE(10_6, 3_0); @end /* NSURLProtocol.h Copyright (c) 2003-2012, Apple Inc. All rights reserved. Public header file. */ #import #import @class NSCachedURLResponse; @class NSError; @class NSMutableURLRequest; @class NSURLAuthenticationChallenge; @class NSURLConnection; @class NSURLProtocol; @class NSURLProtocolInternal; @class NSURLRequest; @class NSURLResponse; /*! @header NSURLProtocol.h This header file describes the constructs used to represent URL protocols, and describes the extensible system by which specific classes can be made to handle the loading of particular URL types or schemes.

NSURLProtocol is an abstract class which provides the basic structure for performing protocol-specific loading of URL data.

The NSURLProtocolClient describes the integration points a protocol implemention can use to hook into the URL loading system. NSURLProtocolClient describes the methods a protocol implementation needs to drive the URL loading system from a NSURLProtocol subclass.

To support customization of protocol-specific requests, protocol implementors are encouraged to provide categories on NSURLRequest and NSMutableURLRequest. Protocol implementors who need to extend the capabilities of NSURLRequest and NSMutableURLRequest in this way can store and retrieve protocol-specific request data by using the +propertyForKey:inRequest: and +setProperty:forKey:inRequest: class methods on NSURLProtocol. See the NSHTTPURLRequest on NSURLRequest and NSMutableHTTPURLRequest on NSMutableURLRequest for examples of such extensions.

An essential responsibility for a protocol implementor is creating a NSURLResponse for each request it processes successfully. A protocol implementor may wish to create a custom, mutable NSURLResponse class to aid in this work. */ /*! @protocol NSURLProtocolClient @discussion NSURLProtocolClient provides the interface to the URL loading system that is intended for use by NSURLProtocol implementors. */ @protocol NSURLProtocolClient /*! @method URLProtocol:wasRedirectedToRequest: @abstract Indicates to an NSURLProtocolClient that a redirect has occurred. @param URLProtocol the NSURLProtocol object sending the message. @param request the NSURLRequest to which the protocol implementation has redirected. */ - (void)URLProtocol:(NSURLProtocol *)protocol wasRedirectedToRequest:(NSURLRequest *)request redirectResponse:(NSURLResponse *)redirectResponse; /*! @method URLProtocol:cachedResponseIsValid: @abstract Indicates to an NSURLProtocolClient that the protocol implementation has examined a cached response and has determined that it is valid. @param URLProtocol the NSURLProtocol object sending the message. @param cachedResponse the NSCachedURLResponse object that has examined and is valid. */ - (void)URLProtocol:(NSURLProtocol *)protocol cachedResponseIsValid:(NSCachedURLResponse *)cachedResponse; /*! @method URLProtocol:didReceiveResponse: @abstract Indicates to an NSURLProtocolClient that the protocol implementation has created an NSURLResponse for the current load. @param URLProtocol the NSURLProtocol object sending the message. @param response the NSURLResponse object the protocol implementation has created. @param cacheStoragePolicy The NSURLCacheStoragePolicy the protocol has determined should be used for the given response if the response is to be stored in a cache. */ - (void)URLProtocol:(NSURLProtocol *)protocol didReceiveResponse:(NSURLResponse *)response cacheStoragePolicy:(NSURLCacheStoragePolicy)policy; /*! @method URLProtocol:didLoadData: @abstract Indicates to an NSURLProtocolClient that the protocol implementation has loaded URL data. @discussion The data object must contain only new data loaded since the previous call to this method (if any), not cumulative data for the entire load. @param URLProtocol the NSURLProtocol object sending the message. @param data URL load data being made available. */ - (void)URLProtocol:(NSURLProtocol *)protocol didLoadData:(NSData *)data; /*! @method URLProtocolDidFinishLoading: @abstract Indicates to an NSURLProtocolClient that the protocol implementation has finished loading successfully. @param URLProtocol the NSURLProtocol object sending the message. */ - (void)URLProtocolDidFinishLoading:(NSURLProtocol *)protocol; /*! @method URLProtocol:didFailWithError: @abstract Indicates to an NSURLProtocolClient that the protocol implementation has failed to load successfully. @param URLProtocol the NSURLProtocol object sending the message. @param error The error that caused the load to fail. */ - (void)URLProtocol:(NSURLProtocol *)protocol didFailWithError:(NSError *)error; /*! @method URLProtocol:didReceiveAuthenticationChallenge: @abstract Start authentication for the specified request @param protocol The protocol object requesting authentication. @param challenge The authentication challenge. @discussion The protocol client guarantees that it will answer the request on the same thread that called this method. It may add a default credential to the challenge it issues to the connection delegate, if the protocol did not provide one. */ - (void)URLProtocol:(NSURLProtocol *)protocol didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge; /*! @method URLProtocol:didCancelAuthenticationChallenge: @abstract Cancel authentication for the specified request @param protocol The protocol object cancelling authentication. @param challenge The authentication challenge. */ - (void)URLProtocol:(NSURLProtocol *)protocol didCancelAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge; @end /*! @class NSURLProtocol @abstract NSURLProtocol is an abstract class which provides the basic structure for performing protocol-specific loading of URL data. Concrete subclasses handle the specifics associated with one or more protocols or URL schemes. */ @interface NSURLProtocol : NSObject { @private NSURLProtocolInternal *_internal; } /*! @method initWithRequest:cachedResponse:client: @abstract Initializes an NSURLProtocol given request, cached response, and client. @param request The request to load. @param cachedResponse A response that has been retrieved from the cache for the given request. The protocol implementation should apply protocol-specific validity checks if such tests are necessary. @param client The NSURLProtocolClient object that serves as the interface the protocol implementation can use to report results back to the URL loading system. */ - (id)initWithRequest:(NSURLRequest *)request cachedResponse:(NSCachedURLResponse *)cachedResponse client:(id )client; /*! @method client @abstract Returns the NSURLProtocolClient of the receiver. @result The NSURLProtocolClient of the receiver. */ - (id )client; /*! @method request @abstract Returns the NSURLRequest of the receiver. @result The NSURLRequest of the receiver. */ - (NSURLRequest *)request; /*! @method cachedResponse @abstract Returns the NSCachedURLResponse of the receiver. @result The NSCachedURLResponse of the receiver. */ - (NSCachedURLResponse *)cachedResponse; /*====================================================================== Begin responsibilities for protocol implementors The methods between this set of begin-end markers must be implemented in order to create a working protocol. ======================================================================*/ /*! @method canInitWithRequest: @abstract This method determines whether this protocol can handle the given request. @discussion A concrete subclass should inspect the given request and determine whether or not the implementation can perform a load with that request. This is an abstract method. Sublasses must provide an implementation. The implementation in this class calls NSRequestConcreteImplementation. @param request A request to inspect. @result YES if the protocol can handle the given request, NO if not. */ + (BOOL)canInitWithRequest:(NSURLRequest *)request; /*! @method canonicalRequestForRequest: @abstract This method returns a canonical version of the given request. @discussion It is up to each concrete protocol implementation to define what "canonical" means. However, a protocol should guarantee that the same input request always yields the same canonical form. Special consideration should be given when implementing this method since the canonical form of a request is used to look up objects in the URL cache, a process which performs equality checks between NSURLRequest objects.

This is an abstract method; sublasses must provide an implementation. The implementation in this class calls NSRequestConcreteImplementation. @param request A request to make canonical. @result The canonical form of the given request. */ + (NSURLRequest *)canonicalRequestForRequest:(NSURLRequest *)request; /*! @method requestIsCacheEquivalent:toRequest: @abstract Compares two requests for equivalence with regard to caching. @discussion Requests are considered euqivalent for cache purposes if and only if they would be handled by the same protocol AND that protocol declares them equivalent after performing implementation-specific checks. @result YES if the two requests are cache-equivalent, NO otherwise. */ + (BOOL)requestIsCacheEquivalent:(NSURLRequest *)a toRequest:(NSURLRequest *)b; /*! @method startLoading @abstract Starts protocol-specific loading of a request. @discussion When this method is called, the protocol implementation should start loading a request. */ - (void)startLoading; /*! @method stopLoading @abstract Stops protocol-specific loading of a request. @discussion When this method is called, the protocol implementation should end the work of loading a request. This could be in response to a cancel operation, so protocol implementations must be able to handle this call while a load is in progress. */ - (void)stopLoading; /*====================================================================== End responsibilities for protocol implementors ======================================================================*/ /*! @method propertyForKey:inRequest: @abstract Returns the property in the given request previously stored with the given key. @discussion The purpose of this method is to provide an interface for protocol implementors to access protocol-specific information associated with NSURLRequest objects. @param key The string to use for the property lookup. @param request The request to use for the property lookup. @result The property stored with the given key, or nil if no property had previously been stored with the given key in the given request. */ + (id)propertyForKey:(NSString *)key inRequest:(NSURLRequest *)request; /*! @method setProperty:forKey:inRequest: @abstract Stores the given property in the given request using the given key. @discussion The purpose of this method is to provide an interface for protocol implementors to customize protocol-specific information associated with NSMutableURLRequest objects. @param value The property to store. @param key The string to use for the property storage. @param request The request in which to store the property. */ + (void)setProperty:(id)value forKey:(NSString *)key inRequest:(NSMutableURLRequest *)request; /*! @method removePropertyForKey:inRequest: @abstract Remove any property stored under the given key @discussion Like setProperty:forKey:inRequest: above, the purpose of this method is to give protocol implementors the ability to store protocol-specific information in an NSURLRequest @param key The key whose value should be removed @param request The request to be modified */ + (void)removePropertyForKey:(NSString *)key inRequest:(NSMutableURLRequest *)request; /*! @method registerClass: @abstract This method registers a protocol class, making it visible to several other NSURLProtocol class methods. @discussion When the URL loading system begins to load a request, each protocol class that has been registered is consulted in turn to see if it can be initialized with a given request. The first protocol handler class to provide a YES answer to +canInitWithRequest: "wins" and that protocol implementation is used to perform the URL load. There is no guarantee that all registered protocol classes will be consulted. Hence, it should be noted that registering a class places it first on the list of classes that will be consulted in calls to +canInitWithRequest:, moving it in front of all classes that had been registered previously.

A similar design governs the process to create the canonical form of a request with the +canonicalRequestForRequest: class method. @param protocolClass the class to register. @result YES if the protocol was registered successfully, NO if not. The only way that failure can occur is if the given class is not a subclass of NSURLProtocol. */ + (BOOL)registerClass:(Class)protocolClass; /*! @method unregisterClass: @abstract This method unregisters a protocol. @discussion After unregistration, a protocol class is no longer consulted in calls to NSURLProtocol class methods. @param protocolClass The class to unregister. */ + (void)unregisterClass:(Class)protocolClass; @end /* NSURLRequest.h Copyright (c) 2003-2012, Apple Inc. All rights reserved. Public header file. */ #import #import @class NSData; @class NSDictionary; @class NSInputStream; @class NSString; @class NSURL; @class NSURLRequestInternal; /*! @header NSURLRequest.h This header file describes the constructs used to represent URL load requests in a manner independent of protocol and URL scheme. Immutable and mutable variants of this URL load request concept are described, named NSURLRequest and NSMutableURLRequest, respectively. A collection of constants is also declared to exercise control over URL content caching policy.

NSURLRequest and NSMutableURLRequest are designed to be customized to support protocol-specific requests. Protocol implementors who need to extend the capabilities of NSURLRequest and NSMutableURLRequest are encouraged to provide categories on these classes as appropriate to support protocol-specific data. To store and retrieve data, category methods can use the +propertyForKey:inRequest: and +setProperty:forKey:inRequest: class methods on NSURLProtocol. See the NSHTTPURLRequest on NSURLRequest and NSMutableHTTPURLRequest on NSMutableURLRequest for examples of such extensions.

The main advantage of this design is that a client of the URL loading library can implement request policies in a standard way without type checking of requests or protocol checks on URLs. Any protocol-specific details that have been set on a URL request will be used if they apply to the particular URL being loaded, and will be ignored if they do not apply. */ /*! @enum NSURLRequestCachePolicy @discussion The NSURLRequestCachePolicy enum defines constants that can be used to specify the type of interactions that take place with the caching system when the URL loading system processes a request. Specifically, these constants cover interactions that have to do with whether already-existing cache data is returned to satisfy a URL load request. @constant NSURLRequestUseProtocolCachePolicy Specifies that the caching logic defined in the protocol implementation, if any, is used for a particular URL load request. This is the default policy for URL load requests. @constant NSURLRequestReloadIgnoringLocalCacheData Specifies that the data for the URL load should be loaded from the origin source. No existing local cache data, regardless of its freshness or validity, should be used to satisfy a URL load request. @constant NSURLRequestReloadIgnoringLocalAndRemoteCacheData Specifies that not only should the local cache data be ignored, but that proxies and other intermediates should be instructed to disregard their caches so far as the protocol allows. Unimplemented. @constant NSURLRequestReloadIgnoringCacheData Older name for NSURLRequestReloadIgnoringLocalCacheData. @constant NSURLRequestReturnCacheDataElseLoad Specifies that the existing cache data should be used to satisfy a URL load request, regardless of its age or expiration date. However, if there is no existing data in the cache corresponding to a URL load request, the URL is loaded from the origin source. @constant NSURLRequestReturnCacheDataDontLoad Specifies that the existing cache data should be used to satisfy a URL load request, regardless of its age or expiration date. However, if there is no existing data in the cache corresponding to a URL load request, no attempt is made to load the URL from the origin source, and the load is considered to have failed. This constant specifies a behavior that is similar to an "offline" mode. @constant NSURLRequestReloadRevalidatingCacheData Specifies that the existing cache data may be used provided the origin source confirms its validity, otherwise the URL is loaded from the origin source. Unimplemented. */ enum { NSURLRequestUseProtocolCachePolicy = 0, NSURLRequestReloadIgnoringLocalCacheData = 1, NSURLRequestReloadIgnoringLocalAndRemoteCacheData = 4, // Unimplemented NSURLRequestReloadIgnoringCacheData = NSURLRequestReloadIgnoringLocalCacheData, NSURLRequestReturnCacheDataElseLoad = 2, NSURLRequestReturnCacheDataDontLoad = 3, NSURLRequestReloadRevalidatingCacheData = 5, // Unimplemented }; typedef NSUInteger NSURLRequestCachePolicy; /*! @enum NSURLRequestNetworkServiceType @discussion The NSURLRequestNetworkServiceType enum defines constants that can be used to specify the service type to associate with this request. The service type is used to provide the networking layers a hint of the purpose of the request. @constant NSURLNetworkServiceTypeDefault Is the default value for an NSURLRequest when created. This value should be left unchanged for the vast majority of requests. @constant NSURLNetworkServiceTypeVoIP Specifies that the request is for voice over IP control traffic. @constant NSURLNetworkServiceTypeVideo Specifies that the request is for video traffic. @constant NSURLNetworkServiceTypeBackground Specifies that the request is for background traffic (such as a file download). @constant NSURLNetworkServiceTypeVoice Specifies that the request is for voice data. */ enum { NSURLNetworkServiceTypeDefault = 0, // Standard internet traffic NSURLNetworkServiceTypeVoIP = 1, // Voice over IP control traffic NSURLNetworkServiceTypeVideo = 2, // Video traffic NSURLNetworkServiceTypeBackground = 3, // Background traffic NSURLNetworkServiceTypeVoice = 4 // Voice data }; typedef NSUInteger NSURLRequestNetworkServiceType; /*! @class NSURLRequest @abstract An NSURLRequest object represents a URL load request in a manner independent of protocol and URL scheme. @discussion NSURLRequest encapsulates two basic data elements about a URL load request:

  • The URL to load.
  • The policy to use when consulting the URL content cache made available by the implementation.
In addition, NSURLRequest is designed to be extended to support protocol-specific data by adding categories to access a property object provided in an interface targeted at protocol implementors.
  • Protocol implementors should direct their attention to the NSURLRequestExtensibility category on NSURLRequest for more information on how to provide extensions on NSURLRequest to support protocol-specific request information.
  • Clients of this API who wish to create NSURLRequest objects to load URL content should consult the protocol-specific NSURLRequest categories that are available. The NSHTTPURLRequest category on NSURLRequest is an example.

Objects of this class are used to create NSURLConnection instances, which can are used to perform the load of a URL, or as input to the NSURLConnection class method which performs synchronous loads. */ @interface NSURLRequest : NSObject { @private NSURLRequestInternal *_internal; } /*! @method requestWithURL: @abstract Allocates and initializes an NSURLRequest with the given URL. @discussion Default values are used for cache policy (NSURLRequestUseProtocolCachePolicy) and timeout interval (60 seconds). @param URL The URL for the request. @result A newly-created and autoreleased NSURLRequest instance. */ + (id)requestWithURL:(NSURL *)URL; /*! @method requestWithURL:cachePolicy:timeoutInterval: @abstract Allocates and initializes a NSURLRequest with the given URL and cache policy. @param URL The URL for the request. @param cachePolicy The cache policy for the request. @param timeoutInterval The timeout interval for the request. See the commentary for the timeoutInterval for more information on timeout intervals. @result A newly-created and autoreleased NSURLRequest instance. */ + (id)requestWithURL:(NSURL *)URL cachePolicy:(NSURLRequestCachePolicy)cachePolicy timeoutInterval:(NSTimeInterval)timeoutInterval; /*! @method initWithURL: @abstract Initializes an NSURLRequest with the given URL. @discussion Default values are used for cache policy (NSURLRequestUseProtocolCachePolicy) and timeout interval (60 seconds). @param URL The URL for the request. @result An initialized NSURLRequest. */ - (id)initWithURL:(NSURL *)URL; /*! @method initWithURL: @abstract Initializes an NSURLRequest with the given URL and cache policy. @discussion This is the designated initializer for the NSURLRequest class. @param URL The URL for the request. @param cachePolicy The cache policy for the request. @param timeoutInterval The timeout interval for the request. See the commentary for the timeoutInterval for more information on timeout intervals. @result An initialized NSURLRequest. */ - (id)initWithURL:(NSURL *)URL cachePolicy:(NSURLRequestCachePolicy)cachePolicy timeoutInterval:(NSTimeInterval)timeoutInterval; /*! @method URL @abstract Returns the URL of the receiver. @result The URL of the receiver. */ - (NSURL *)URL; /*! @method cachePolicy @abstract Returns the cache policy of the receiver. @result The cache policy of the receiver. */ - (NSURLRequestCachePolicy)cachePolicy; /*! @method timeoutInterval @abstract Returns the timeout interval of the receiver. @discussion The timeout interval specifies the limit on the idle interval alloted to a request in the process of loading. The "idle interval" is defined as the period of time that has passed since the last instance of load activity occurred for a request that is in the process of loading. Hence, when an instance of load activity occurs (e.g. bytes are received from the network for a request), the idle interval for a request is reset to 0. If the idle interval ever becomes greater than or equal to the timeout interval, the request is considered to have timed out. This timeout interval is measured in seconds. @result The timeout interval of the receiver. */ - (NSTimeInterval)timeoutInterval; /*! @method mainDocumentURL @abstract The main document URL associated with this load. @discussion This URL is used for the cookie "same domain as main document" policy. There may also be other future uses. See setMainDocumentURL: NOTE: In the current implementation, this value is unused by the framework. A fully functional version of this method will be available in the future. @result The main document URL. */ - (NSURL *)mainDocumentURL; /*! @method networkServiceType @abstract Returns the NSURLRequestNetworkServiceType associated with this request. @discussion This will return NSURLNetworkServiceTypeDefault for requests that have not explicitly set a networkServiceType (using the setNetworkServiceType method). @result The NSURLRequestNetworkServiceType associated with this request. */ - (NSURLRequestNetworkServiceType)networkServiceType NS_AVAILABLE(10_7, 4_0); /*! @method allowsCellularAccess: @abstract returns whether a connection created with this request is allowed to use the built in cellular radios (if present). @result YES if the receiver is allowed to use the built in cellular radios to satify the request, NO otherwise. */ - (BOOL)allowsCellularAccess NS_AVAILABLE(10_8, 6_0); @end /*! @class NSMutableURLRequest @abstract An NSMutableURLRequest object represents a mutable URL load request in a manner independent of protocol and URL scheme. @discussion This specialization of NSURLRequest is provided to aid developers who may find it more convenient to mutate a single request object for a series of URL loads instead of creating an immutable NSURLRequest for each load. This programming model is supported by the following contract stipulation between NSMutableURLRequest and NSURLConnection: NSURLConnection makes a deep copy of each NSMutableURLRequest object passed to one of its initializers.

NSMutableURLRequest is designed to be extended to support protocol-specific data by adding categories to access a property object provided in an interface targeted at protocol implementors.

  • Protocol implementors should direct their attention to the NSMutableURLRequestExtensibility category on NSMutableURLRequest for more information on how to provide extensions on NSMutableURLRequest to support protocol-specific request information.
  • Clients of this API who wish to create NSMutableURLRequest objects to load URL content should consult the protocol-specific NSMutableURLRequest categories that are available. The NSMutableHTTPURLRequest category on NSMutableURLRequest is an example.
*/ @interface NSMutableURLRequest : NSURLRequest /*! @method setURL @abstract Sets the URL of the receiver. @param URL The new URL for the receiver. */ - (void)setURL:(NSURL *)URL; /*! @method setCachePolicy: @abstract Sets the cache policy of the receiver. @param policy The new NSURLRequestCachePolicy for the receiver. */ - (void)setCachePolicy:(NSURLRequestCachePolicy)policy; /*! @method setTimeoutInterval: @abstract Sets the timeout interval of the receiver. @discussion The timeout interval specifies the limit on the idle interval allotted to a request in the process of loading. The "idle interval" is defined as the period of time that has passed since the last instance of load activity occurred for a request that is in the process of loading. Hence, when an instance of load activity occurs (e.g. bytes are received from the network for a request), the idle interval for a request is reset to 0. If the idle interval ever becomes greater than or equal to the timeout interval, the request is considered to have timed out. This timeout interval is measured in seconds. @param seconds The new timeout interval of the receiver. */ - (void)setTimeoutInterval:(NSTimeInterval)seconds; /*! @method setMainDocumentURL: @abstract Sets the main document URL @param URL The main document URL. @discussion The caller should pass the URL for an appropriate main document, if known. For example, when loading a web page, the URL of the main html document for the top-level frame should be passed. This main document will be used to implement the cookie "only from same domain as main document" policy, and possibly other things in the future. NOTE: In the current implementation, the passed-in value is unused by the framework. A fully functional version of this method will be available in the future. */ - (void)setMainDocumentURL:(NSURL *)URL; /*! @method setNetworkServiceType: @abstract Sets the NSURLRequestNetworkServiceType to associate with this request @param networkServiceType The NSURLRequestNetworkServiceType to associate with the request. @discussion This method is used to provide the network layers with a hint as to the purpose of the request. Most clients should not need to use this method. */ - (void)setNetworkServiceType:(NSURLRequestNetworkServiceType)networkServiceType NS_AVAILABLE(10_7, 4_0); /*! @method setAllowsCellularAccess @abstract sets whether a connection created with this request is allowed to use the built in cellular radios (if present). @param allow NO if the receiver should not be allowed to use the built in cellular radios to satisfy the request, YES otherwise. The default is YES. */ - (void)setAllowsCellularAccess:(BOOL)allow NS_AVAILABLE(10_8, 6_0); @end /*! @category NSURLRequest(NSHTTPURLRequest) The NSHTTPURLRequest on NSURLRequest provides methods for accessing information specific to HTTP protocol requests. */ @interface NSURLRequest (NSHTTPURLRequest) /*! @method HTTPMethod @abstract Returns the HTTP request method of the receiver. @result the HTTP request method of the receiver. */ - (NSString *)HTTPMethod; /*! @method allHTTPHeaderFields @abstract Returns a dictionary containing all the HTTP header fields of the receiver. @result a dictionary containing all the HTTP header fields of the receiver. */ - (NSDictionary *)allHTTPHeaderFields; /*! @method valueForHTTPHeaderField: @abstract Returns the value which corresponds to the given header field. Note that, in keeping with the HTTP RFC, HTTP header field names are case-insensitive. @param field the header field name to use for the lookup (case-insensitive). @result the value associated with the given header field, or nil if there is no value associated with the given header field. */ - (NSString *)valueForHTTPHeaderField:(NSString *)field; /*! @method HTTPBody @abstract Returns the request body data of the receiver. @discussion This data is sent as the message body of the request, as in done in an HTTP POST request. @result The request body data of the receiver. */ - (NSData *)HTTPBody; /*! @method HTTPBodyStream @abstract Returns the request body stream of the receiver if any has been set @discussion The stream is returned for examination only; it is not safe for the caller to manipulate the stream in any way. Also note that the HTTPBodyStream and HTTPBody are mutually exclusive - only one can be set on a given request. Also note that the body stream is preserved across copies, but is LOST when the request is coded via the NSCoding protocol @result The request body stream of the receiver. */ - (NSInputStream *)HTTPBodyStream; /*! @method HTTPShouldHandleCookies @abstract Determine whether default cookie handling will happen for this request. @discussion NOTE: This value is not used prior to 10.3 @result YES if cookies will be sent with and set for this request; otherwise NO. */ - (BOOL)HTTPShouldHandleCookies; /*! @method HTTPShouldUsePipelining @abstract Reports whether the receiver is not expected to wait for the previous response before transmitting. @result YES if the receiver should transmit before the previous response is received. NO if the receiver should wait for the previous response before transmitting. */ - (BOOL)HTTPShouldUsePipelining NS_AVAILABLE(10_7, 4_0); @end /*! @category NSMutableURLRequest(NSMutableHTTPURLRequest) The NSMutableHTTPURLRequest on NSMutableURLRequest provides methods for configuring information specific to HTTP protocol requests. */ @interface NSMutableURLRequest (NSMutableHTTPURLRequest) /*! @method setHTTPMethod: @abstract Sets the HTTP request method of the receiver. @param method the new HTTP request method for the receiver. */ - (void)setHTTPMethod:(NSString *)method; /*! @method setAllHTTPHeaderFields: @abstract Sets the HTTP header fields of the receiver to the given dictionary. @discussion This method replaces all header fields that may have existed before this method call.

Since HTTP header fields must be string values, each object and key in the dictionary passed to this method must answer YES when sent an -isKindOfClass:[NSString class] message. If either the key or value for a key-value pair answers NO when sent this message, the key-value pair is skipped. @param headerFields a dictionary containing HTTP header fields. */ - (void)setAllHTTPHeaderFields:(NSDictionary *)headerFields; /*! @method setValue:forHTTPHeaderField: @abstract Sets the value of the given HTTP header field. @discussion If a value was previously set for the given header field, that value is replaced with the given value. Note that, in keeping with the HTTP RFC, HTTP header field names are case-insensitive. @param value the header field value. @param field the header field name (case-insensitive). */ - (void)setValue:(NSString *)value forHTTPHeaderField:(NSString *)field; /*! @method addValue:forHTTPHeaderField: @abstract Adds an HTTP header field in the current header dictionary. @discussion This method provides a way to add values to header fields incrementally. If a value was previously set for the given header field, the given value is appended to the previously-existing value. The appropriate field delimiter, a comma in the case of HTTP, is added by the implementation, and should not be added to the given value by the caller. Note that, in keeping with the HTTP RFC, HTTP header field names are case-insensitive. @param value the header field value. @param field the header field name (case-insensitive). */ - (void)addValue:(NSString *)value forHTTPHeaderField:(NSString *)field; /*! @method setHTTPBody: @abstract Sets the request body data of the receiver. @discussion This data is sent as the message body of the request, as in done in an HTTP POST request. @param data the new request body data for the receiver. */ - (void)setHTTPBody:(NSData *)data; /*! @method setHTTPBodyStream: @abstract Sets the request body to be the contents of the given stream. @discussion The provided stream should be unopened; the request will take over the stream's delegate. The entire stream's contents will be transmitted as the HTTP body of the request. Note that the body stream and the body data (set by setHTTPBody:, above) are mutually exclusive - setting one will clear the other. @param inputStream the new input stream for use by the receiver */ - (void)setHTTPBodyStream:(NSInputStream *)inputStream; /*! @method setHTTPShouldHandleCookies @abstract Decide whether default cookie handling will happen for this request. @param YES if cookies should be sent with and set for this request; otherwise NO. @discussion The default is YES - in other words, cookies are sent from and stored to the cookie manager by default. NOTE: In releases prior to 10.3, this value is ignored */ - (void)setHTTPShouldHandleCookies:(BOOL)should; /*! @method setHTTPShouldUsePipelining @abstract Sets whether the request should not wait for the previous response before transmitting. @param YES if the receiver should transmit before the previous response is received. NO to wait for the previous response before transmitting. @discussion calling this method with a YES value does not guarantee HTTP pipelining behavior. HTTP 1.1 allows the client to send multiple requests to the server without waiting for a response. Though HTTP 1.1 requires support for pipelining, some servers report themselves as being HTTP 1.1 but do not support pipelining. To maintain compatibility with these servers, requests may have to wait for the previous response before transmitting. */ - (void)setHTTPShouldUsePipelining:(BOOL)shouldUsePipelining NS_AVAILABLE(10_7, 4_0); @end /* NSURLResponse.h Copyright (c) 2003-2012, Apple Inc. All rights reserved. Public header file. */ #import @class NSDictionary; @class NSString; @class NSURL; @class NSURLRequest; @class NSURLResponseInternal; #define NSURLResponseUnknownLength ((long long)-1) /*! @class NSURLResponse @abstract An NSURLResponse object represents a URL load response in a manner independent of protocol and URL scheme. @discussion NSURLResponse encapsulates the metadata associated with a URL load. Note that NSURLResponse objects do not contain the actual bytes representing the content of a URL. See NSURLConnection and NSURLConnectionDelegate for more information about receiving the content data for a URL load. */ @interface NSURLResponse : NSObject { @package NSURLResponseInternal *_internal; } /*! @method initWithURL:MIMEType:expectedContentLength:textEncodingName: @abstract Initialize an NSURLResponse with the provided values. @param URL the URL @param MIMETYPE the MIME content type of the response @param expectedContentLength the expected content length of the associated data @param textEncodingName the name of the text encoding for the associated data, if applicable, else nil @result The initialized NSURLResponse. @discussion This is the designated initializer for NSURLResponse. */ - (id)initWithURL:(NSURL *)URL MIMEType:(NSString *)MIMEType expectedContentLength:(NSInteger)length textEncodingName:(NSString *)name; /*! @method URL @abstract Returns the URL of the receiver. @result The URL of the receiver. */ - (NSURL *)URL; /*! @method MIMEType @abstract Returns the MIME type of the receiver. @discussion The MIME type is based on the information provided from an origin source. However, that value may be changed or corrected by a protocol implementation if it can be determined that the origin server or source reported the information incorrectly or imprecisely. An attempt to guess the MIME type may be made if the origin source did not report any such information. @result The MIME type of the receiver. */ - (NSString *)MIMEType; /*! @method expectedContentLength @abstract Returns the expected content length of the receiver. @discussion Some protocol implementations report a content length as part of delivering load metadata, but not all protocols guarantee the amount of data that will be delivered in actuality. Hence, this method returns an expected amount. Clients should use this value as an advisory, and should be prepared to deal with either more or less data. @result The expected content length of the receiver, or -1 if there is no expectation that can be arrived at regarding expected content length. */ - (long long)expectedContentLength; /*! @method textEncodingName @abstract Returns the name of the text encoding of the receiver. @discussion This name will be the actual string reported by the origin source during the course of performing a protocol-specific URL load. Clients can inspect this string and convert it to an NSStringEncoding or CFStringEncoding using the methods and functions made available in the appropriate framework. @result The name of the text encoding of the receiver, or nil if no text encoding was specified. */ - (NSString *)textEncodingName; /*! @method suggestedFilename @abstract Returns a suggested filename if the resource were saved to disk. @discussion The method first checks if the server has specified a filename using the content disposition header. If no valid filename is specified using that mechanism, this method checks the last path component of the URL. If no valid filename can be obtained using the last path component, this method uses the URL's host as the filename. If the URL's host can't be converted to a valid filename, the filename "unknown" is used. In mose cases, this method appends the proper file extension based on the MIME type. This method always returns a valid filename. @result A suggested filename to use if saving the resource to disk. */ - (NSString *)suggestedFilename; @end @class NSHTTPURLResponseInternal; /*! @class NSHTTPURLResponse @abstract An NSHTTPURLResponse object represents a response to an HTTP URL load. It is a specialization of NSURLResponse which provides conveniences for accessing information specific to HTTP protocol responses. */ @interface NSHTTPURLResponse : NSURLResponse { @package NSHTTPURLResponseInternal *_httpInternal; } /*! @method initWithURL:statusCode:HTTPVersion:headerFields: @abstract initializer for NSHTTPURLResponse objects. @param url the URL from which the response was generated. @param statusCode an HTTP status code. @param HTTPVersion The version of the HTTP response as represented by the server. This is typically represented as "HTTP/1.1". @param headerFields A dictionary representing the header keys and values of the server response. @result the instance of the object, or NULL if an error occurred during initialization. @discussion This API was introduced in Mac OS X 10.7.2 and iOS 5.0 and is not available prior to those releases. */ -(id)initWithURL:(NSURL*) url statusCode:(NSInteger) statusCode HTTPVersion:(NSString*) HTTPVersion headerFields:(NSDictionary*) headerFields NS_AVAILABLE(10_7, 5_0); /*! @method statusCode @abstract Returns the HTTP status code of the receiver. @result The HTTP status code of the receiver. */ - (NSInteger)statusCode; /*! @method allHeaderFields @abstract Returns a dictionary containing all the HTTP header fields of the receiver. @discussion By examining this header dictionary, clients can see the "raw" header information which was reported to the protocol implementation by the HTTP server. This may be of use to sophisticated or special-purpose HTTP clients. @result A dictionary containing all the HTTP header fields of the receiver. */ - (NSDictionary *)allHeaderFields; /*! @method localizedStringForStatusCode: @abstract Convenience method which returns a localized string corresponding to the status code for this response. @param the status code to use to produce a localized string. @result A localized string corresponding to the given status code. */ + (NSString *)localizedStringForStatusCode:(NSInteger)statusCode; @end /* NSUUID.h Copyright (c) 2011-2012, Apple Inc. All rights reserved. */ #import #include #include /* Note: NSUUID is not toll-free bridged with CFUUID. Use UUID strings to convert between CFUUID and NSUUID, if needed. NSUUIDs are not guaranteed to be comparable by pointer value (as CFUUIDRef is); use isEqual: to compare two NSUUIDs. */ NS_CLASS_AVAILABLE(10_8, 6_0) @interface NSUUID : NSObject /* Create a new autoreleased NSUUID with RFC 4122 version 4 random bytes */ + (id)UUID; /* Create a new NSUUID with RFC 4122 version 4 random bytes */ - (id)init; /* Create an NSUUID from a string such as "E621E1F8-C36C-495A-93FC-0C247A3E6E5F". Returns nil for invalid strings. */ - (id)initWithUUIDString:(NSString *)string; /* Create an NSUUID with the given bytes */ - (id)initWithUUIDBytes:(const uuid_t)bytes; /* Get the individual bytes of the receiver */ - (void)getUUIDBytes:(uuid_t)uuid; /* Return a string description of the UUID, such as "E621E1F8-C36C-495A-93FC-0C247A3E6E5F" */ - (NSString *)UUIDString; @end /* NSUbiquitousKeyValueStore.h Copyright (c) 2011-2012, Apple Inc. All rights reserved. */ #import @class NSArray, NSDictionary, NSData, NSString; NS_CLASS_AVAILABLE(10_7, 5_0) @interface NSUbiquitousKeyValueStore : NSObject { @private id _private1; id _private2; id _private3; void *_private4; void *_reserved[3]; } + (NSUbiquitousKeyValueStore *)defaultStore; - (id)objectForKey:(NSString *)aKey; - (void)setObject:(id)anObject forKey:(NSString *)aKey; - (void)removeObjectForKey:(NSString *)aKey; - (NSString *)stringForKey:(NSString *)aKey; - (NSArray *)arrayForKey:(NSString *)aKey; - (NSDictionary *)dictionaryForKey:(NSString *)aKey; - (NSData *)dataForKey:(NSString *)aKey; - (long long)longLongForKey:(NSString *)aKey; - (double)doubleForKey:(NSString *)aKey; - (BOOL)boolForKey:(NSString *)aKey; - (void)setString:(NSString *)aString forKey:(NSString *)aKey; - (void)setData:(NSData *)aData forKey:(NSString *)aKey; - (void)setArray:(NSArray *)anArray forKey:(NSString *)aKey; - (void)setDictionary:(NSDictionary *)aDictionary forKey:(NSString *)aKey; - (void)setLongLong:(long long)value forKey:(NSString *)aKey; - (void)setDouble:(double)value forKey:(NSString *)aKey; - (void)setBool:(BOOL)value forKey:(NSString *)aKey; - (NSDictionary *)dictionaryRepresentation; - (BOOL)synchronize; @end FOUNDATION_EXPORT NSString * const NSUbiquitousKeyValueStoreDidChangeExternallyNotification NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString * const NSUbiquitousKeyValueStoreChangeReasonKey NS_AVAILABLE(10_7, 5_0); FOUNDATION_EXPORT NSString * const NSUbiquitousKeyValueStoreChangedKeysKey NS_AVAILABLE(10_7, 5_0); enum { NSUbiquitousKeyValueStoreServerChange NS_ENUM_AVAILABLE(10_7, 5_0), NSUbiquitousKeyValueStoreInitialSyncChange NS_ENUM_AVAILABLE(10_7, 5_0), NSUbiquitousKeyValueStoreQuotaViolationChange NS_ENUM_AVAILABLE(10_7, 5_0), NSUbiquitousKeyValueStoreAccountChange NS_ENUM_AVAILABLE(10_8, 6_0) }; /* NSUndoManager.h Copyright (c) 1995-2012, Apple Inc. All rights reserved. */ // // NSUndoManager is a general-purpose undo stack where clients can register // callbacks to be invoked should an undo be requested. // #import #include @class NSArray; @class NSString; // used with NSRunLoop's performSelector:target:argument:order:modes: enum { NSUndoCloseGroupingRunLoopOrdering = 350000 }; NS_CLASS_AVAILABLE(10_0, 3_0) @interface NSUndoManager : NSObject { @private id _undoStack; id _redoStack; NSArray *_runLoopModes; uint64_t _NSUndoManagerPrivate1; id _target; id _proxy; void *_NSUndoManagerPrivate2; void *_NSUndoManagerPrivate3; } /* Begin/End Grouping */ - (void)beginUndoGrouping; - (void)endUndoGrouping; // These nest. - (NSInteger)groupingLevel; // Zero means no open group. /* Enable/Disable registration */ - (void)disableUndoRegistration; - (void)enableUndoRegistration; - (BOOL)isUndoRegistrationEnabled; /* Groups By Event */ - (BOOL)groupsByEvent; - (void)setGroupsByEvent:(BOOL)groupsByEvent; // If groupsByEvent is enabled, the undoManager automatically groups // all undos registered during a single NSRunLoop event together in // a single top-level group. This featured is enabled by default. /* Undo levels */ - (void)setLevelsOfUndo:(NSUInteger)levels; - (NSUInteger)levelsOfUndo; // Sets the number of complete groups (not operations) that should // be kept my the manager. When limit is reached, oldest undos are // thrown away. 0 means no limit ! /* Run Loop Modes */ - (void)setRunLoopModes:(NSArray *)runLoopModes; - (NSArray *)runLoopModes; /* Undo/Redo */ - (void)undo; // Undo until a matching begin. It terminates a top level undo if // necesary. Useful for undoing when groupByEvents is on (default is // on) - (void)redo; // Will redo last top-level undo. - (void)undoNestedGroup; // Undoes a nested grouping without first trying to close a top level // undo group. - (BOOL)canUndo; - (BOOL)canRedo; // returns whether or not the UndoManager has anything to undo or redo - (BOOL)isUndoing; - (BOOL)isRedoing; // returns whether or not the undo manager is currently in the process // of invoking undo or redo operations. /* remove */ - (void)removeAllActions; - (void)removeAllActionsWithTarget:(id)target; /* Object based Undo */ - (void)registerUndoWithTarget:(id)target selector:(SEL)selector object:(id)anObject; /* Invocation based undo */ - (id)prepareWithInvocationTarget:(id)target; // called as: // [[undoManager prepareWithInvocationTarget:self] setFont:oldFont color:oldColor] // When undo is called, the specified target will be called with // [target setFont:oldFont color:oldColor] - (void)setActionIsDiscardable:(BOOL)discardable NS_AVAILABLE(10_7, 5_0); // Set the latest undo action to discardable if it may be safely discarded when a document can not be saved for any reason. An example might be an undo action that changes the viewable area of a document. To find out if an undo group contains only discardable actions, look for the NSUndoManagerGroupIsDiscardableKey in the userInfo dictionary of the NSUndoManagerDidCloseUndoGroupNotification. // This key is set on the user info dictionary of the NSUndoManagerDidCloseUndoGroupNotification, with a NSNumber boolean value of YES, if the undo group as a whole is discardable. FOUNDATION_EXPORT NSString * const NSUndoManagerGroupIsDiscardableKey NS_AVAILABLE(10_7, 5_0); - (BOOL)undoActionIsDiscardable NS_AVAILABLE(10_7, 5_0); - (BOOL)redoActionIsDiscardable NS_AVAILABLE(10_7, 5_0); // Call to see if the next undo or redo action is discardable. /* Undo/Redo action name */ - (NSString *)undoActionName; - (NSString *)redoActionName; // Call undoActionName or redoActionName to get the name of the next action to be undone or redone. // Returns @"" if there is nothing to undo/redo or no action names were registered. - (void)setActionName:(NSString *)actionName; // Call setActionName: to set the name of an action. // The actionName parameter can not be nil /* Undo/Redo menu item title */ - (NSString *)undoMenuItemTitle; - (NSString *)redoMenuItemTitle; // Call undoMenuItemTitle or redoMenuItemTitle to get the string for the undo or redo menu item. // In English they will return "Undo "/"Redo " or "Undo"/"Redo" if there is // nothing to undo/redo or no action names were set. /* localization hooks */ - (NSString *)undoMenuTitleForUndoActionName:(NSString *)actionName; - (NSString *)redoMenuTitleForUndoActionName:(NSString *)actionName; // The localization of the pattern is usually done by localizing the string patterns in // undo.strings. But undo/redoMenuTitleForUndoActionName can also be overridden if // localizing the pattern happens to not be sufficient. @end FOUNDATION_EXPORT NSString * const NSUndoManagerCheckpointNotification NS_AVAILABLE(10_0, 3_0); // This is called before an undo group is begun or ended so any // clients that need to lazily register undos can do so in the // correct group. FOUNDATION_EXPORT NSString * const NSUndoManagerWillUndoChangeNotification NS_AVAILABLE(10_0, 3_0); FOUNDATION_EXPORT NSString * const NSUndoManagerWillRedoChangeNotification NS_AVAILABLE(10_0, 3_0); FOUNDATION_EXPORT NSString * const NSUndoManagerDidUndoChangeNotification NS_AVAILABLE(10_0, 3_0); FOUNDATION_EXPORT NSString * const NSUndoManagerDidRedoChangeNotification NS_AVAILABLE(10_0, 3_0); FOUNDATION_EXPORT NSString * const NSUndoManagerDidOpenUndoGroupNotification NS_AVAILABLE(10_0, 3_0); FOUNDATION_EXPORT NSString * const NSUndoManagerWillCloseUndoGroupNotification NS_AVAILABLE(10_0, 3_0); // This notification is sent after an undo group closes. It should be safe to undo at this time. FOUNDATION_EXPORT NSString * const NSUndoManagerDidCloseUndoGroupNotification NS_AVAILABLE(10_7, 5_0); /* NSUserDefaults.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import @class NSArray, NSData, NSDictionary, NSMutableDictionary, NSString, NSURL; FOUNDATION_EXPORT NSString * const NSGlobalDomain; FOUNDATION_EXPORT NSString * const NSArgumentDomain; FOUNDATION_EXPORT NSString * const NSRegistrationDomain; @interface NSUserDefaults : NSObject { @private NSInteger _unused; void *_reserved[4]; } + (NSUserDefaults *)standardUserDefaults; + (void)resetStandardUserDefaults; - (id)init; - (id)initWithUser:(NSString *)username; - (id)objectForKey:(NSString *)defaultName; - (void)setObject:(id)value forKey:(NSString *)defaultName; - (void)removeObjectForKey:(NSString *)defaultName; - (NSString *)stringForKey:(NSString *)defaultName; - (NSArray *)arrayForKey:(NSString *)defaultName; - (NSDictionary *)dictionaryForKey:(NSString *)defaultName; - (NSData *)dataForKey:(NSString *)defaultName; - (NSArray *)stringArrayForKey:(NSString *)defaultName; - (NSInteger)integerForKey:(NSString *)defaultName; - (float)floatForKey:(NSString *)defaultName; - (double)doubleForKey:(NSString *)defaultName; - (BOOL)boolForKey:(NSString *)defaultName; - (NSURL *)URLForKey:(NSString *)defaultName NS_AVAILABLE(10_6, 4_0); - (void)setInteger:(NSInteger)value forKey:(NSString *)defaultName; - (void)setFloat:(float)value forKey:(NSString *)defaultName; - (void)setDouble:(double)value forKey:(NSString *)defaultName; - (void)setBool:(BOOL)value forKey:(NSString *)defaultName; - (void)setURL:(NSURL *)url forKey:(NSString *)defaultName NS_AVAILABLE(10_6, 4_0); - (void)registerDefaults:(NSDictionary *)registrationDictionary; - (void)addSuiteNamed:(NSString *)suiteName; - (void)removeSuiteNamed:(NSString *)suiteName; - (NSDictionary *)dictionaryRepresentation; - (NSArray *)volatileDomainNames; - (NSDictionary *)volatileDomainForName:(NSString *)domainName; - (void)setVolatileDomain:(NSDictionary *)domain forName:(NSString *)domainName; - (void)removeVolatileDomainForName:(NSString *)domainName; - (NSArray *)persistentDomainNames; - (NSDictionary *)persistentDomainForName:(NSString *)domainName; - (void)setPersistentDomain:(NSDictionary *)domain forName:(NSString *)domainName; - (void)removePersistentDomainForName:(NSString *)domainName; - (BOOL)synchronize; - (BOOL)objectIsForcedForKey:(NSString *)key; - (BOOL)objectIsForcedForKey:(NSString *)key inDomain:(NSString *)domain; @end FOUNDATION_EXPORT NSString * const NSUserDefaultsDidChangeNotification; #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) || TARGET_OS_WIN32 /* The following keys and their values are deprecated in Mac OS X 10.5 "Leopard". Developers should use NSLocale, NSDateFormatter and NSNumberFormatter to retrieve the values formerly returned by these keys. */ FOUNDATION_EXPORT NSString * const NSWeekDayNameArray NS_DEPRECATED(10_0, 10_5, NA, NA); FOUNDATION_EXPORT NSString * const NSShortWeekDayNameArray NS_DEPRECATED(10_0, 10_5, NA, NA); FOUNDATION_EXPORT NSString * const NSMonthNameArray NS_DEPRECATED(10_0, 10_5, NA, NA); FOUNDATION_EXPORT NSString * const NSShortMonthNameArray NS_DEPRECATED(10_0, 10_5, NA, NA); FOUNDATION_EXPORT NSString * const NSTimeFormatString NS_DEPRECATED(10_0, 10_5, NA, NA); FOUNDATION_EXPORT NSString * const NSDateFormatString NS_DEPRECATED(10_0, 10_5, NA, NA); FOUNDATION_EXPORT NSString * const NSTimeDateFormatString NS_DEPRECATED(10_0, 10_5, NA, NA); FOUNDATION_EXPORT NSString * const NSShortTimeDateFormatString NS_DEPRECATED(10_0, 10_5, NA, NA); FOUNDATION_EXPORT NSString * const NSCurrencySymbol NS_DEPRECATED(10_0, 10_5, NA, NA); FOUNDATION_EXPORT NSString * const NSDecimalSeparator NS_DEPRECATED(10_0, 10_5, NA, NA); FOUNDATION_EXPORT NSString * const NSThousandsSeparator NS_DEPRECATED(10_0, 10_5, NA, NA); FOUNDATION_EXPORT NSString * const NSDecimalDigits NS_DEPRECATED(10_0, 10_5, NA, NA); FOUNDATION_EXPORT NSString * const NSAMPMDesignation NS_DEPRECATED(10_0, 10_5, NA, NA); FOUNDATION_EXPORT NSString * const NSHourNameDesignations NS_DEPRECATED(10_0, 10_5, NA, NA); FOUNDATION_EXPORT NSString * const NSYearMonthWeekDesignations NS_DEPRECATED(10_0, 10_5, NA, NA); FOUNDATION_EXPORT NSString * const NSEarlierTimeDesignations NS_DEPRECATED(10_0, 10_5, NA, NA); FOUNDATION_EXPORT NSString * const NSLaterTimeDesignations NS_DEPRECATED(10_0, 10_5, NA, NA); FOUNDATION_EXPORT NSString * const NSThisDayDesignations NS_DEPRECATED(10_0, 10_5, NA, NA); FOUNDATION_EXPORT NSString * const NSNextDayDesignations NS_DEPRECATED(10_0, 10_5, NA, NA); FOUNDATION_EXPORT NSString * const NSNextNextDayDesignations NS_DEPRECATED(10_0, 10_5, NA, NA); FOUNDATION_EXPORT NSString * const NSPriorDayDesignations NS_DEPRECATED(10_0, 10_5, NA, NA); FOUNDATION_EXPORT NSString * const NSDateTimeOrdering NS_DEPRECATED(10_0, 10_5, NA, NA); FOUNDATION_EXPORT NSString * const NSInternationalCurrencyString NS_DEPRECATED(10_0, 10_5, NA, NA); FOUNDATION_EXPORT NSString * const NSShortDateFormatString NS_DEPRECATED(10_0, 10_5, NA, NA); FOUNDATION_EXPORT NSString * const NSPositiveCurrencyFormatString NS_DEPRECATED(10_0, 10_5, NA, NA); FOUNDATION_EXPORT NSString * const NSNegativeCurrencyFormatString NS_DEPRECATED(10_0, 10_5, NA, NA); #endif /* NSValue.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import @class NSString, NSDictionary; @interface NSValue : NSObject - (void)getValue:(void *)value; - (const char *)objCType NS_RETURNS_INNER_POINTER; @end @interface NSValue (NSValueCreation) - (id)initWithBytes:(const void *)value objCType:(const char *)type; + (NSValue *)valueWithBytes:(const void *)value objCType:(const char *)type; + (NSValue *)value:(const void *)value withObjCType:(const char *)type; @end @interface NSValue (NSValueExtensionMethods) + (NSValue *)valueWithNonretainedObject:(id)anObject; - (id)nonretainedObjectValue; + (NSValue *)valueWithPointer:(const void *)pointer; - (void *)pointerValue; - (BOOL)isEqualToValue:(NSValue *)value; @end @interface NSNumber : NSValue - (char)charValue; - (unsigned char)unsignedCharValue; - (short)shortValue; - (unsigned short)unsignedShortValue; - (int)intValue; - (unsigned int)unsignedIntValue; - (long)longValue; - (unsigned long)unsignedLongValue; - (long long)longLongValue; - (unsigned long long)unsignedLongLongValue; - (float)floatValue; - (double)doubleValue; - (BOOL)boolValue; - (NSInteger)integerValue NS_AVAILABLE(10_5, 2_0); - (NSUInteger)unsignedIntegerValue NS_AVAILABLE(10_5, 2_0); - (NSString *)stringValue; - (NSComparisonResult)compare:(NSNumber *)otherNumber; - (BOOL)isEqualToNumber:(NSNumber *)number; - (NSString *)descriptionWithLocale:(id)locale; @end @interface NSNumber (NSNumberCreation) - (id)initWithChar:(char)value; - (id)initWithUnsignedChar:(unsigned char)value; - (id)initWithShort:(short)value; - (id)initWithUnsignedShort:(unsigned short)value; - (id)initWithInt:(int)value; - (id)initWithUnsignedInt:(unsigned int)value; - (id)initWithLong:(long)value; - (id)initWithUnsignedLong:(unsigned long)value; - (id)initWithLongLong:(long long)value; - (id)initWithUnsignedLongLong:(unsigned long long)value; - (id)initWithFloat:(float)value; - (id)initWithDouble:(double)value; - (id)initWithBool:(BOOL)value; - (id)initWithInteger:(NSInteger)value NS_AVAILABLE(10_5, 2_0); - (id)initWithUnsignedInteger:(NSUInteger)value NS_AVAILABLE(10_5, 2_0); + (NSNumber *)numberWithChar:(char)value; + (NSNumber *)numberWithUnsignedChar:(unsigned char)value; + (NSNumber *)numberWithShort:(short)value; + (NSNumber *)numberWithUnsignedShort:(unsigned short)value; + (NSNumber *)numberWithInt:(int)value; + (NSNumber *)numberWithUnsignedInt:(unsigned int)value; + (NSNumber *)numberWithLong:(long)value; + (NSNumber *)numberWithUnsignedLong:(unsigned long)value; + (NSNumber *)numberWithLongLong:(long long)value; + (NSNumber *)numberWithUnsignedLongLong:(unsigned long long)value; + (NSNumber *)numberWithFloat:(float)value; + (NSNumber *)numberWithDouble:(double)value; + (NSNumber *)numberWithBool:(BOOL)value; + (NSNumber *)numberWithInteger:(NSInteger)value NS_AVAILABLE(10_5, 2_0); + (NSNumber *)numberWithUnsignedInteger:(NSUInteger)value NS_AVAILABLE(10_5, 2_0); @end /* NSValueTransformer.h Copyright (c) 2002-2012, Apple Inc. All rights reserved. */ #import @class NSArray, NSString; FOUNDATION_EXPORT NSString * const NSNegateBooleanTransformerName NS_AVAILABLE(10_3, 3_0); FOUNDATION_EXPORT NSString * const NSIsNilTransformerName NS_AVAILABLE(10_3, 3_0); FOUNDATION_EXPORT NSString * const NSIsNotNilTransformerName NS_AVAILABLE(10_3, 3_0); FOUNDATION_EXPORT NSString * const NSUnarchiveFromDataTransformerName NS_AVAILABLE(10_3, 3_0); FOUNDATION_EXPORT NSString * const NSKeyedUnarchiveFromDataTransformerName NS_AVAILABLE(10_5, 3_0); NS_CLASS_AVAILABLE(10_3, 3_0) @interface NSValueTransformer : NSObject { } // name-based registry for shared objects (especially used when loading nib files with transformers specified by name in Interface Builder) - also useful for localization (developers can register different kind of transformers or differently configured transformers at application startup and refer to them by name from within nib files or other code) // if valueTransformerForName: does not find a registered transformer instance, it will fall back to looking up a class with the specified name - if one is found, it will instantiate a transformer with the default -init method and automatically register it + (void)setValueTransformer:(NSValueTransformer *)transformer forName:(NSString *)name; + (NSValueTransformer *)valueTransformerForName:(NSString *)name; + (NSArray *)valueTransformerNames; // information that can be used to analyze available transformer instances (especially used inside Interface Builder) + (Class)transformedValueClass; // class of the "output" objects, as returned by transformedValue: + (BOOL)allowsReverseTransformation; // flag indicating whether transformation is read-only or not - (id)transformedValue:(id)value; // by default returns value - (id)reverseTransformedValue:(id)value; // by default raises an exception if +allowsReverseTransformation returns NO and otherwise invokes transformedValue: @end /* NSXMLParser.h Copyright (c) 2003-2012, Apple Inc. All rights reserved. */ #import @class NSData, NSDictionary, NSError, NSString, NSURL, NSInputStream; @protocol NSXMLParserDelegate; @interface NSXMLParser : NSObject { @private id _reserved0; id _delegate; id _reserved1; id _reserved2; id _reserved3; } - (id)initWithContentsOfURL:(NSURL *)url; // initializes the parser with the specified URL. - (id)initWithData:(NSData *)data; // create the parser from data - (id)initWithStream:(NSInputStream *)stream NS_AVAILABLE(10_7, 5_0); //create a parser that incrementally pulls data from the specified stream and parses it. // delegate management. The delegate is not retained. - (id )delegate; - (void)setDelegate:(id )delegate; - (void)setShouldProcessNamespaces:(BOOL)shouldProcessNamespaces; - (void)setShouldReportNamespacePrefixes:(BOOL)shouldReportNamespacePrefixes; - (void)setShouldResolveExternalEntities:(BOOL)shouldResolveExternalEntities; - (BOOL)shouldProcessNamespaces; - (BOOL)shouldReportNamespacePrefixes; - (BOOL)shouldResolveExternalEntities; - (BOOL)parse; // called to start the event-driven parse. Returns YES in the event of a successful parse, and NO in case of error. - (void)abortParsing; // called by the delegate to stop the parse. The delegate will get an error message sent to it. - (NSError *)parserError; // can be called after a parse is over to determine parser state. @end // Once a parse has begun, the delegate may be interested in certain parser state. These methods will only return meaningful information during parsing, or after an error has occurred. @interface NSXMLParser (NSXMLParserLocatorAdditions) - (NSString *)publicID; - (NSString *)systemID; - (NSInteger)lineNumber; - (NSInteger)columnNumber; @end /* For the discussion of event methods, assume the following XML: 2920186 API/NSXMLParser: there ought to be an NSXMLParser */ // The parser's delegate is informed of events through the methods in the NSXMLParserDelegateEventAdditions category. @protocol NSXMLParserDelegate @optional // Document handling methods - (void)parserDidStartDocument:(NSXMLParser *)parser; // sent when the parser begins parsing of the document. - (void)parserDidEndDocument:(NSXMLParser *)parser; // sent when the parser has completed parsing. If this is encountered, the parse was successful. // DTD handling methods for various declarations. - (void)parser:(NSXMLParser *)parser foundNotationDeclarationWithName:(NSString *)name publicID:(NSString *)publicID systemID:(NSString *)systemID; - (void)parser:(NSXMLParser *)parser foundUnparsedEntityDeclarationWithName:(NSString *)name publicID:(NSString *)publicID systemID:(NSString *)systemID notationName:(NSString *)notationName; - (void)parser:(NSXMLParser *)parser foundAttributeDeclarationWithName:(NSString *)attributeName forElement:(NSString *)elementName type:(NSString *)type defaultValue:(NSString *)defaultValue; - (void)parser:(NSXMLParser *)parser foundElementDeclarationWithName:(NSString *)elementName model:(NSString *)model; - (void)parser:(NSXMLParser *)parser foundInternalEntityDeclarationWithName:(NSString *)name value:(NSString *)value; - (void)parser:(NSXMLParser *)parser foundExternalEntityDeclarationWithName:(NSString *)name publicID:(NSString *)publicID systemID:(NSString *)systemID; - (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict; // sent when the parser finds an element start tag. // In the case of the cvslog tag, the following is what the delegate receives: // elementName == cvslog, namespaceURI == http://xml.apple.com/cvslog, qualifiedName == cvslog // In the case of the radar tag, the following is what's passed in: // elementName == radar, namespaceURI == http://xml.apple.com/radar, qualifiedName == radar:radar // If namespace processing >isn't< on, the xmlns:radar="http://xml.apple.com/radar" is returned as an attribute pair, the elementName is 'radar:radar' and there is no qualifiedName. - (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName; // sent when an end tag is encountered. The various parameters are supplied as above. - (void)parser:(NSXMLParser *)parser didStartMappingPrefix:(NSString *)prefix toURI:(NSString *)namespaceURI; // sent when the parser first sees a namespace attribute. // In the case of the cvslog tag, before the didStartElement:, you'd get one of these with prefix == @"" and namespaceURI == @"http://xml.apple.com/cvslog" (i.e. the default namespace) // In the case of the radar:radar tag, before the didStartElement: you'd get one of these with prefix == @"radar" and namespaceURI == @"http://xml.apple.com/radar" - (void)parser:(NSXMLParser *)parser didEndMappingPrefix:(NSString *)prefix; // sent when the namespace prefix in question goes out of scope. - (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string; // This returns the string of the characters encountered thus far. You may not necessarily get the longest character run. The parser reserves the right to hand these to the delegate as potentially many calls in a row to -parser:foundCharacters: - (void)parser:(NSXMLParser *)parser foundIgnorableWhitespace:(NSString *)whitespaceString; // The parser reports ignorable whitespace in the same way as characters it's found. - (void)parser:(NSXMLParser *)parser foundProcessingInstructionWithTarget:(NSString *)target data:(NSString *)data; // The parser reports a processing instruction to you using this method. In the case above, target == @"xml-stylesheet" and data == @"type='text/css' href='cvslog.css'" - (void)parser:(NSXMLParser *)parser foundComment:(NSString *)comment; // A comment (Text in a block) is reported to the delegate as a single string - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock; // this reports a CDATA block to the delegate as an NSData. - (NSData *)parser:(NSXMLParser *)parser resolveExternalEntityName:(NSString *)name systemID:(NSString *)systemID; // this gives the delegate an opportunity to resolve an external entity itself and reply with the resulting data. - (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError; // ...and this reports a fatal error to the delegate. The parser will stop parsing. - (void)parser:(NSXMLParser *)parser validationErrorOccurred:(NSError *)validationError; // If validation is on, this will report a fatal validation error to the delegate. The parser will stop parsing. @end FOUNDATION_EXPORT NSString * const NSXMLParserErrorDomain NS_AVAILABLE(10_3, 2_0); // for use with NSError. // Error reporting typedef NS_ENUM(NSInteger, NSXMLParserError) { NSXMLParserInternalError = 1, NSXMLParserOutOfMemoryError = 2, NSXMLParserDocumentStartError = 3, NSXMLParserEmptyDocumentError = 4, NSXMLParserPrematureDocumentEndError = 5, NSXMLParserInvalidHexCharacterRefError = 6, NSXMLParserInvalidDecimalCharacterRefError = 7, NSXMLParserInvalidCharacterRefError = 8, NSXMLParserInvalidCharacterError = 9, NSXMLParserCharacterRefAtEOFError = 10, NSXMLParserCharacterRefInPrologError = 11, NSXMLParserCharacterRefInEpilogError = 12, NSXMLParserCharacterRefInDTDError = 13, NSXMLParserEntityRefAtEOFError = 14, NSXMLParserEntityRefInPrologError = 15, NSXMLParserEntityRefInEpilogError = 16, NSXMLParserEntityRefInDTDError = 17, NSXMLParserParsedEntityRefAtEOFError = 18, NSXMLParserParsedEntityRefInPrologError = 19, NSXMLParserParsedEntityRefInEpilogError = 20, NSXMLParserParsedEntityRefInInternalSubsetError = 21, NSXMLParserEntityReferenceWithoutNameError = 22, NSXMLParserEntityReferenceMissingSemiError = 23, NSXMLParserParsedEntityRefNoNameError = 24, NSXMLParserParsedEntityRefMissingSemiError = 25, NSXMLParserUndeclaredEntityError = 26, NSXMLParserUnparsedEntityError = 28, NSXMLParserEntityIsExternalError = 29, NSXMLParserEntityIsParameterError = 30, NSXMLParserUnknownEncodingError = 31, NSXMLParserEncodingNotSupportedError = 32, NSXMLParserStringNotStartedError = 33, NSXMLParserStringNotClosedError = 34, NSXMLParserNamespaceDeclarationError = 35, NSXMLParserEntityNotStartedError = 36, NSXMLParserEntityNotFinishedError = 37, NSXMLParserLessThanSymbolInAttributeError = 38, NSXMLParserAttributeNotStartedError = 39, NSXMLParserAttributeNotFinishedError = 40, NSXMLParserAttributeHasNoValueError = 41, NSXMLParserAttributeRedefinedError = 42, NSXMLParserLiteralNotStartedError = 43, NSXMLParserLiteralNotFinishedError = 44, NSXMLParserCommentNotFinishedError = 45, NSXMLParserProcessingInstructionNotStartedError = 46, NSXMLParserProcessingInstructionNotFinishedError = 47, NSXMLParserNotationNotStartedError = 48, NSXMLParserNotationNotFinishedError = 49, NSXMLParserAttributeListNotStartedError = 50, NSXMLParserAttributeListNotFinishedError = 51, NSXMLParserMixedContentDeclNotStartedError = 52, NSXMLParserMixedContentDeclNotFinishedError = 53, NSXMLParserElementContentDeclNotStartedError = 54, NSXMLParserElementContentDeclNotFinishedError = 55, NSXMLParserXMLDeclNotStartedError = 56, NSXMLParserXMLDeclNotFinishedError = 57, NSXMLParserConditionalSectionNotStartedError = 58, NSXMLParserConditionalSectionNotFinishedError = 59, NSXMLParserExternalSubsetNotFinishedError = 60, NSXMLParserDOCTYPEDeclNotFinishedError = 61, NSXMLParserMisplacedCDATAEndStringError = 62, NSXMLParserCDATANotFinishedError = 63, NSXMLParserMisplacedXMLDeclarationError = 64, NSXMLParserSpaceRequiredError = 65, NSXMLParserSeparatorRequiredError = 66, NSXMLParserNMTOKENRequiredError = 67, NSXMLParserNAMERequiredError = 68, NSXMLParserPCDATARequiredError = 69, NSXMLParserURIRequiredError = 70, NSXMLParserPublicIdentifierRequiredError = 71, NSXMLParserLTRequiredError = 72, NSXMLParserGTRequiredError = 73, NSXMLParserLTSlashRequiredError = 74, NSXMLParserEqualExpectedError = 75, NSXMLParserTagNameMismatchError = 76, NSXMLParserUnfinishedTagError = 77, NSXMLParserStandaloneValueError = 78, NSXMLParserInvalidEncodingNameError = 79, NSXMLParserCommentContainsDoubleHyphenError = 80, NSXMLParserInvalidEncodingError = 81, NSXMLParserExternalStandaloneEntityError = 82, NSXMLParserInvalidConditionalSectionError = 83, NSXMLParserEntityValueRequiredError = 84, NSXMLParserNotWellBalancedError = 85, NSXMLParserExtraContentError = 86, NSXMLParserInvalidCharacterInEntityError = 87, NSXMLParserParsedEntityRefInInternalError = 88, NSXMLParserEntityRefLoopError = 89, NSXMLParserEntityBoundaryError = 90, NSXMLParserInvalidURIError = 91, NSXMLParserURIFragmentError = 92, NSXMLParserNoDTDError = 94, NSXMLParserDelegateAbortedParseError = 512 }; /* NSZone.h Copyright (c) 1994-2012, Apple Inc. All rights reserved. */ #import #include @class NSString; typedef struct _NSZone NSZone; FOUNDATION_EXPORT NSZone *NSDefaultMallocZone(void); FOUNDATION_EXPORT NSZone *NSCreateZone(NSUInteger startSize, NSUInteger granularity, BOOL canFree); FOUNDATION_EXPORT void NSRecycleZone(NSZone *zone); FOUNDATION_EXPORT void NSSetZoneName(NSZone *zone, NSString *name); FOUNDATION_EXPORT NSString *NSZoneName(NSZone *zone); FOUNDATION_EXPORT NSZone *NSZoneFromPointer(void *ptr); FOUNDATION_EXPORT void *NSZoneMalloc(NSZone *zone, NSUInteger size); FOUNDATION_EXPORT void *NSZoneCalloc(NSZone *zone, NSUInteger numElems, NSUInteger byteSize); FOUNDATION_EXPORT void *NSZoneRealloc(NSZone *zone, void *ptr, NSUInteger size); FOUNDATION_EXPORT void NSZoneFree(NSZone *zone, void *ptr); #if (TARGET_OS_MAC && !(TARGET_OS_EMBEDDED || TARGET_OS_IPHONE)) /* Garbage Collected memory allocation. Raw memory may be directly allocated (and "realloc"ed) from the collector. The default unscanned memory returned by this call should not be used to hold live pointers to garbage collected memory. Use the scanned option. Further, the pointer type of the stored location must be marked with the __strong attribute in order for the write-barrier assignment primitive to be generated. The NSCollectorDisabledOption provides an allocation for use as an external reference. */ enum { NSScannedOption = (1UL << 0), NSCollectorDisabledOption = (1UL << 1), }; FOUNDATION_EXPORT void *__strong NSAllocateCollectable(NSUInteger size, NSUInteger options); FOUNDATION_EXPORT void *__strong NSReallocateCollectable(void *ptr, NSUInteger size, NSUInteger options); #endif #ifndef CF_CONSUMED #if __has_feature(attribute_cf_consumed) #define CF_CONSUMED __attribute__((cf_consumed)) #else #define CF_CONSUMED #endif #endif /* NSMakeCollectable CFTypeRef style objects are garbage collected, yet only sometime after the last CFRelease() is performed. Particulary for fully-bridged CFTypeRef objects such as CFStrings and collections (CFDictionaryRef et alia) it is imperative that either CFMakeCollectable or the more type safe NSMakeCollectable be performed, preferably right upon allocation. Conceptually, this moves them from a "C" style opaque pointer into an "id" style object. This function is unavailable in ARC mode. Use CFBridgingRelease instead. */ NS_INLINE NS_RETURNS_RETAINED id NSMakeCollectable(CFTypeRef CF_CONSUMED cf) NS_AUTOMATED_REFCOUNT_UNAVAILABLE; NS_INLINE NS_RETURNS_RETAINED id NSMakeCollectable(CFTypeRef CF_CONSUMED cf) { #if __has_feature(objc_arc) return nil; #else return (cf ? (id)CFMakeCollectable(cf) : nil); #endif } FOUNDATION_EXPORT NSUInteger NSPageSize(void); FOUNDATION_EXPORT NSUInteger NSLogPageSize(void); FOUNDATION_EXPORT NSUInteger NSRoundUpToMultipleOfPageSize(NSUInteger bytes); FOUNDATION_EXPORT NSUInteger NSRoundDownToMultipleOfPageSize(NSUInteger bytes); FOUNDATION_EXPORT void *NSAllocateMemoryPages(NSUInteger bytes); FOUNDATION_EXPORT void NSDeallocateMemoryPages(void *ptr, NSUInteger bytes); FOUNDATION_EXPORT void NSCopyMemoryPages(const void *source, void *dest, NSUInteger bytes); FOUNDATION_EXPORT NSUInteger NSRealMemoryAvailable(void) NS_DEPRECATED(10_0, 10_8, 2_0, 6_0); // see NSProcessInfo.h instead // // NSAttributedString.h // UIKit // // Copyright (c) 2011-2012 Apple Inc. All rights reserved. // #import #import /* Predefined character attributes for text. If the key is not in the dictionary, then use the default values as described below. */ UIKIT_EXTERN NSString *const NSFontAttributeName NS_AVAILABLE_IOS(6_0); // UIFont, default Helvetica(Neue) 12 UIKIT_EXTERN NSString *const NSParagraphStyleAttributeName NS_AVAILABLE_IOS(6_0); // NSParagraphStyle, default defaultParagraphStyle UIKIT_EXTERN NSString *const NSForegroundColorAttributeName NS_AVAILABLE_IOS(6_0); // UIColor, default blackColor UIKIT_EXTERN NSString *const NSBackgroundColorAttributeName NS_AVAILABLE_IOS(6_0); // UIColor, default nil: no background UIKIT_EXTERN NSString *const NSLigatureAttributeName NS_AVAILABLE_IOS(6_0); // NSNumber containing integer, default 1: default ligatures, 0: no ligatures, 2: all ligatures (Note: 2 is unsupported on iOS) UIKIT_EXTERN NSString *const NSKernAttributeName NS_AVAILABLE_IOS(6_0); // NSNumber containing floating point value, in points; amount to modify default kerning. 0 means kerning is disabled. (note: values other than nil and 0 are unsupported on iOS) UIKIT_EXTERN NSString *const NSStrikethroughStyleAttributeName NS_AVAILABLE_IOS(6_0); // NSNumber containing integer, default 0: no strikethrough UIKIT_EXTERN NSString *const NSUnderlineStyleAttributeName NS_AVAILABLE_IOS(6_0); // NSNumber containing integer, default 0: no underline UIKIT_EXTERN NSString *const NSStrokeColorAttributeName NS_AVAILABLE_IOS(6_0); // UIColor, default nil: same as foreground color UIKIT_EXTERN NSString *const NSStrokeWidthAttributeName NS_AVAILABLE_IOS(6_0); // NSNumber containing floating point value, in percent of font point size, default 0: no stroke; positive for stroke alone, negative for stroke and fill (a typical value for outlined text would be 3.0) UIKIT_EXTERN NSString *const NSShadowAttributeName NS_AVAILABLE_IOS(6_0); // NSShadow, default nil: no shadow /* An NSNumber containing an integer value. 0 means horizontal text. 1 indicates vertical text. If not specified, it could follow higher-level vertical orientation settings. Currently on iOS, it's always horizontal. The behavior for any other value is undefined. */ UIKIT_EXTERN NSString *const NSVerticalGlyphFormAttributeName NS_AVAILABLE_IOS(6_0); /* This defines currently supported values for NSUnderlineStyleAttributeName and NSStrikethroughStyleAttributeName, as of iOS 6.0. */ enum { NSUnderlineStyleNone = 0x00, NSUnderlineStyleSingle = 0x01, } NS_ENUM_AVAILABLE_IOS(6_0); // // NSLayoutConstraint.h // UIKit // // Copyright (c) 2009-2012, Apple Inc. All rights reserved. // #import #import @class NSArray, NSDictionary; typedef NS_ENUM(NSInteger, NSLayoutRelation) { NSLayoutRelationLessThanOrEqual = -1, NSLayoutRelationEqual = 0, NSLayoutRelationGreaterThanOrEqual = 1, }; typedef NS_ENUM(NSInteger, NSLayoutAttribute) { NSLayoutAttributeLeft = 1, NSLayoutAttributeRight, NSLayoutAttributeTop, NSLayoutAttributeBottom, NSLayoutAttributeLeading, NSLayoutAttributeTrailing, NSLayoutAttributeWidth, NSLayoutAttributeHeight, NSLayoutAttributeCenterX, NSLayoutAttributeCenterY, NSLayoutAttributeBaseline, NSLayoutAttributeNotAnAttribute = 0 }; typedef NS_OPTIONS(NSUInteger, NSLayoutFormatOptions) { NSLayoutFormatAlignAllLeft = (1 << NSLayoutAttributeLeft), NSLayoutFormatAlignAllRight = (1 << NSLayoutAttributeRight), NSLayoutFormatAlignAllTop = (1 << NSLayoutAttributeTop), NSLayoutFormatAlignAllBottom = (1 << NSLayoutAttributeBottom), NSLayoutFormatAlignAllLeading = (1 << NSLayoutAttributeLeading), NSLayoutFormatAlignAllTrailing = (1 << NSLayoutAttributeTrailing), NSLayoutFormatAlignAllCenterX = (1 << NSLayoutAttributeCenterX), NSLayoutFormatAlignAllCenterY = (1 << NSLayoutAttributeCenterY), NSLayoutFormatAlignAllBaseline = (1 << NSLayoutAttributeBaseline), NSLayoutFormatAlignmentMask = 0xFFFF, /* choose only one of these three */ NSLayoutFormatDirectionLeadingToTrailing = 0 << 16, // default NSLayoutFormatDirectionLeftToRight = 1 << 16, NSLayoutFormatDirectionRightToLeft = 2 << 16, NSLayoutFormatDirectionMask = 0x3 << 16, }; enum { UILayoutPriorityRequired = 1000, // a required constraint. Do not exceed this. UILayoutPriorityDefaultHigh = 750, // this is the priority level with which a button resists compressing its content. UILayoutPriorityDefaultLow = 250, // this is the priority level at which a button hugs its contents horizontally. UILayoutPriorityFittingSizeLevel = 50, // When you send -[UIView systemLayoutSizeFittingSize:], the size fitting most closely to the target size (the argument) is computed. UILayoutPriorityFittingSizeLevel is the priority level with which the view wants to conform to the target size in that computation. It's quite low. It is generally not appropriate to make a constraint at exactly this priority. You want to be higher or lower. }; typedef float UILayoutPriority; NS_CLASS_AVAILABLE_IOS(6_0) @interface NSLayoutConstraint : NSObject { @private id _container; id _firstItem; id _secondItem; CGFloat _constant; CGFloat _loweredConstant; id _markerAndPositiveExtraVar; id _negativeExtraVar; float _coefficient; UILayoutPriority _priority; uint64_t _layoutConstraintFlags; id _flange; } /* Create an array of constraints using an ASCII art-like visual format string. */ + (NSArray *)constraintsWithVisualFormat:(NSString *)format options:(NSLayoutFormatOptions)opts metrics:(NSDictionary *)metrics views:(NSDictionary *)views; /* This macro is a helper for making view dictionaries for +constraintsWithVisualFormat:options:metrics:views:. NSDictionaryOfVariableBindings(v1, v2, v3) is equivalent to [NSDictionary dictionaryWithObjectsAndKeys:v1, @"v1", v2, @"v2", v3, @"v3", nil]; */ #define NSDictionaryOfVariableBindings(...) _NSDictionaryOfVariableBindings(@"" # __VA_ARGS__, __VA_ARGS__, nil) UIKIT_EXTERN NSDictionary *_NSDictionaryOfVariableBindings(NSString *commaSeparatedKeysString, id firstValue, ...) NS_AVAILABLE_IOS(6_0); // not for direct use /* Create constraints explicitly. Constraints are of the form "view1.attr1 = view2.attr2 * multiplier + constant" If your equation does not have a second view and attribute, use nil and NSLayoutAttributeNotAnAttribute. */ +(id)constraintWithItem:(id)view1 attribute:(NSLayoutAttribute)attr1 relatedBy:(NSLayoutRelation)relation toItem:(id)view2 attribute:(NSLayoutAttribute)attr2 multiplier:(CGFloat)multiplier constant:(CGFloat)c; /* If a constraint's priority level is less than UILayoutPriorityRequired, then it is optional. Higher priority constraints are met before lower priority constraints. Constraint satisfaction is not all or nothing. If a constraint 'a == b' is optional, that means we will attempt to minimize 'abs(a-b)'. This property may only be modified as part of initial set up. An exception will be thrown if it is set after a constraint has been added to a view. */ @property UILayoutPriority priority; /* When a view is archived, it archives some but not all constraints in its -constraints array. The value of shouldBeArchived informs UIView if a particular constraint should be archived by UIView. If a constraint is created at runtime in response to the state of the object, it isn't appropriate to archive the constraint - rather you archive the state that gives rise to the constraint. Since the majority of constraints that should be archived are created in Interface Builder (which is smart enough to set this prop to YES), the default value for this property is NO. */ @property BOOL shouldBeArchived; /* accessors firstItem.firstAttribute {==,<=,>=} secondItem.secondAttribute * multiplier + constant */ @property (readonly, assign) id firstItem; @property (readonly) NSLayoutAttribute firstAttribute; @property (readonly) NSLayoutRelation relation; @property (readonly, assign) id secondItem; @property (readonly) NSLayoutAttribute secondAttribute; @property (readonly) CGFloat multiplier; /* Unlike the other properties, the constant may be modified after constraint creation. Setting the constant on an existing constraint performs much better than removing the constraint and adding a new one that's just like the old but for having a new constant. */ @property CGFloat constant; @end // // NSParagraphStyle.h // UIKit // // Copyright (c) 2011-2012 Apple Inc. All rights reserved. // // NSParagraphStyle and NSMutableParagraphStyle hold paragraph style information // #import #import #import #import #import typedef NS_ENUM(NSInteger, NSLineBreakMode) { /* What to do with long lines */ NSLineBreakByWordWrapping = 0, /* Wrap at word boundaries, default */ NSLineBreakByCharWrapping, /* Wrap at character boundaries */ NSLineBreakByClipping, /* Simply clip */ NSLineBreakByTruncatingHead, /* Truncate at head of line: "...wxyz" */ NSLineBreakByTruncatingTail, /* Truncate at tail of line: "abcd..." */ NSLineBreakByTruncatingMiddle /* Truncate middle of line: "ab...yz" */ } NS_ENUM_AVAILABLE_IOS(6_0); NS_CLASS_AVAILABLE_IOS(6_0) @interface NSParagraphStyle : NSObject + (NSParagraphStyle *)defaultParagraphStyle; + (NSWritingDirection)defaultWritingDirectionForLanguage:(NSString *)languageName; // languageName is in ISO lang region format @property(readonly) CGFloat lineSpacing; /* "Leading": distance between the bottom of one line fragment and top of next (applied between lines in the same container). Can't be negative. This value is included in the line fragment heights in layout manager. */ @property(readonly) CGFloat paragraphSpacing; /* Distance between the bottom of this paragraph and top of next (or the beginning of its paragraphSpacingBefore, if any). */ @property(readonly) NSTextAlignment alignment; /* The following values are relative to the appropriate margin (depending on the paragraph direction) */ @property(readonly) CGFloat headIndent; /* Distance from margin to front edge of paragraph */ @property(readonly) CGFloat tailIndent; /* Distance from margin to back edge of paragraph; if negative or 0, from other margin */ @property(readonly) CGFloat firstLineHeadIndent; /* Distance from margin to edge appropriate for text direction */ @property(readonly) CGFloat minimumLineHeight; /* Line height is the distance from bottom of descenders to top of ascenders; basically the line fragment height. Does not include lineSpacing (which is added after this computation). */ @property(readonly) CGFloat maximumLineHeight; /* 0 implies no maximum. */ @property(readonly) NSLineBreakMode lineBreakMode; @property(readonly) NSWritingDirection baseWritingDirection; @property(readonly) CGFloat lineHeightMultiple; /* Natural line height is multiplied by this factor (if positive) before being constrained by minimum and maximum line height. */ @property(readonly) CGFloat paragraphSpacingBefore; /* Distance between the bottom of the previous paragraph (or the end of its paragraphSpacing, if any) and the top of this paragraph. */ /* Specifies the threshold for hyphenation. Valid values lie between 0.0 and 1.0 inclusive. Hyphenation will be attempted when the ratio of the text width as broken without hyphenation to the width of the line fragment is less than the hyphenation factor. When this takes on its default value of 0.0, the layout manager's hyphenation factor is used instead. When both are 0.0, hyphenation is disabled. NOTE: On iOS, the only supported values are 0.0 and 1.0. */ @property(readonly) float hyphenationFactor; @end NS_CLASS_AVAILABLE_IOS(6_0) @interface NSMutableParagraphStyle : NSParagraphStyle @property(readwrite) CGFloat lineSpacing; @property(readwrite) CGFloat paragraphSpacing; @property(readwrite) NSTextAlignment alignment; @property(readwrite) CGFloat firstLineHeadIndent; @property(readwrite) CGFloat headIndent; @property(readwrite) CGFloat tailIndent; @property(readwrite) NSLineBreakMode lineBreakMode; @property(readwrite) CGFloat minimumLineHeight; @property(readwrite) CGFloat maximumLineHeight; @property(readwrite) NSWritingDirection baseWritingDirection; @property(readwrite) CGFloat lineHeightMultiple; @property(readwrite) CGFloat paragraphSpacingBefore; @property(readwrite) float hyphenationFactor; @end // // NSShadow.h // UIKit // // Copyright (c) 2002-2012, Apple Inc. All rights reserved. // #import #import /* NSShadow stores the properties of a drop shadow for drawing text. To set a shadow on an NSAttributedString use it as a value for NSShadowAttributeName. */ NS_CLASS_AVAILABLE_IOS(6_0) @interface NSShadow : NSObject @property (nonatomic, assign) CGSize shadowOffset; // offset in user space of the shadow from the original drawing @property (nonatomic, assign) CGFloat shadowBlurRadius; // blur radius of the shadow in default user space units @property (nonatomic, retain) id shadowColor; // color used for the shadow (default is black with an alpha value of 1/3) @end // // NSStringDrawing.h // UIKit // // Copyright (c) 2011-2012 Apple Inc. All rights reserved. // #import #import #import #import NS_CLASS_AVAILABLE_IOS(6_0) @interface NSStringDrawingContext : NSObject { @private } // Minimum scale factor for drawWithRect:options:context: and boundingRectWithSize:options:context: methods. If this property is set, the extended string drawing methods will attempt to draw the attributed string in the giv'en bounds by proportionally scaling the font(s) in the attributed string @property(nonatomic) CGFloat minimumScaleFactor; // Minimum tracking adjustment for drawWithRect:options:context: and boundingRectWithSize:options:context: methods. If this property is set, the extended string drawing methods will attempt to draw the attributed string in the given bounds by adjusting the tracking between the glyphs in the attributed string @property(nonatomic) CGFloat minimumTrackingAdjustment; // actual scale factor used by the last drawing call where minimum scale factor was specified @property(nonatomic, readonly) CGFloat actualScaleFactor; // actual tracking adjustment used by the last drawing call where minimum tracking factor was specified @property(nonatomic, readonly) CGFloat actualTrackingAdjustment; // bounds of the string drawn by the previous invocation of drawWithRect:options:context: @property(nonatomic, readonly) CGRect totalBounds; @end @interface NSAttributedString(NSStringDrawing) - (CGSize)size NS_AVAILABLE_IOS(6_0); - (void)drawAtPoint:(CGPoint)point NS_AVAILABLE_IOS(6_0); - (void)drawInRect:(CGRect)rect NS_AVAILABLE_IOS(6_0); @end typedef NS_ENUM(NSInteger, NSStringDrawingOptions) { NSStringDrawingTruncatesLastVisibleLine = 1 << 5, // Truncates and adds the ellipsis character to the last visible line if the text doesn't fit into the bounds specified. Ignored if NSStringDrawingUsesLineFragmentOrigin is not also set. NSStringDrawingUsesLineFragmentOrigin = 1 << 0, // The specified origin is the line fragment origin, not the base line origin NSStringDrawingUsesFontLeading = 1 << 1, // Uses the font leading for calculating line heights NSStringDrawingUsesDeviceMetrics = 1 << 3, // Uses image glyph bounds instead of typographic bounds } NS_ENUM_AVAILABLE_IOS(6_0); @interface NSAttributedString (NSExtendedStringDrawing) - (void)drawWithRect:(CGRect)rect options:(NSStringDrawingOptions)options context:(NSStringDrawingContext *)context NS_AVAILABLE_IOS(6_0); - (CGRect)boundingRectWithSize:(CGSize)size options:(NSStringDrawingOptions)options context:(NSStringDrawingContext *)context NS_AVAILABLE_IOS(6_0); @end // // NSText.h // UIKit // // Copyright (c) 2011-2012 Apple Inc. All rights reserved. // #import #import #import /* Values for NSTextAlignment */ typedef NS_ENUM(NSInteger, NSTextAlignment) { NSTextAlignmentLeft = 0, // Visually left aligned #if TARGET_OS_IPHONE NSTextAlignmentCenter = 1, // Visually centered NSTextAlignmentRight = 2, // Visually right aligned #else /* !TARGET_OS_IPHONE */ NSTextAlignmentRight = 1, // Visually right aligned NSTextAlignmentCenter = 2, // Visually centered #endif NSTextAlignmentJustified = 3, // Fully-justified. The last line in a paragraph is natural-aligned. NSTextAlignmentNatural = 4, // Indicates the default alignment for script } NS_ENUM_AVAILABLE_IOS(6_0); UIKIT_EXTERN CTTextAlignment NSTextAlignmentToCTTextAlignment(NSTextAlignment nsTextAlignment) NS_AVAILABLE_IOS(6_0); UIKIT_EXTERN NSTextAlignment NSTextAlignmentFromCTTextAlignment(CTTextAlignment ctTextAlignment) NS_AVAILABLE_IOS(6_0); /* Values for NSWritingDirection */ typedef NS_ENUM(NSInteger, NSWritingDirection) { NSWritingDirectionNatural = -1, // Determines direction using the Unicode Bidi Algorithm rules P2 and P3 NSWritingDirectionLeftToRight = 0, // Left to right writing direction NSWritingDirectionRightToLeft = 1 // Right to left writing direction } NS_ENUM_AVAILABLE_IOS(6_0); // // UIAccelerometer.h // UIKit // // Copyright (c) 2007-2012, Apple Inc. All rights reserved. // #import #import /* UIAcceleration and UIAccelerometer are deprecated as of iOS 5.0. These classes have been replaced by the Core Motion framework. These classes will be marked with formal deprecation attributes in a future release of iOS. */ typedef double UIAccelerationValue; @protocol UIAccelerometerDelegate; NS_CLASS_AVAILABLE_IOS(2_0) @interface UIAcceleration : NSObject { @private NSTimeInterval timestamp; UIAccelerationValue x, y, z; } @property(nonatomic,readonly) NSTimeInterval timestamp; @property(nonatomic,readonly) UIAccelerationValue x; @property(nonatomic,readonly) UIAccelerationValue y; @property(nonatomic,readonly) UIAccelerationValue z; @end NS_CLASS_AVAILABLE_IOS(2_0) @interface UIAccelerometer : NSObject { @private NSTimeInterval _updateInterval; id _delegate; struct { unsigned int delegateDidAccelerate:1; unsigned int reserved:31; } _accelerometerFlags; } + (UIAccelerometer *)sharedAccelerometer; @property(nonatomic) NSTimeInterval updateInterval; //May be capped at a minimum interval @property(nonatomic,assign) id delegate; @end @protocol UIAccelerometerDelegate @optional - (void)accelerometer:(UIAccelerometer *)accelerometer didAccelerate:(UIAcceleration *)acceleration NS_DEPRECATED_IOS(2_0, 5_0); @end // // UIAccessibility.h // UIKit // // Copyright (c) 2008-2012, Apple Inc. All rights reserved. // #import #import #import #import #import #import #import #import /* UIAccessibility UIAccessibility is implemented on all standard UIKit views and controls so that assistive applications can present them to users with disabilities. Custom items in a user interface should override aspects of UIAccessibility to supply details where the default value is incomplete. For example, a UIImageView subclass may need to override accessibilityLabel, but it does not need to override accessibilityFrame. A completely custom subclass of UIView might need to override all of the UIAccessibility methods except accessibilityFrame. */ @interface NSObject (UIAccessibility) /* Return YES if the receiver should be exposed as an accessibility element. default == NO default on UIKit controls == YES Setting the property to YES will cause the receiver to be visible to assistive applications. */ @property(nonatomic) BOOL isAccessibilityElement; /* Returns the localized label that represents the element. If the element does not display text (an icon for example), this method should return text that best labels the element. For example: "Play" could be used for a button that is used to play music. "Play button" should not be used, since there is a trait that identifies the control is a button. default == nil default on UIKit controls == derived from the title Setting the property will change the label that is returned to the accessibility client. */ @property(nonatomic, copy) NSString *accessibilityLabel; /* Returns a localized string that describes the result of performing an action on the element, when the result is non-obvious. The hint should be a brief phrase. For example: "Purchases the item." or "Downloads the attachment." default == nil Setting the property will change the hint that is returned to the accessibility client. */ @property(nonatomic, copy) NSString *accessibilityHint; /* Returns a localized string that represents the value of the element, such as the value of a slider or the text in a text field. Use only when the label of the element differs from a value. For example: A volume slider has a label of "Volume", but a value of "60%". default == nil default on UIKit controls == values for appropriate controls Setting the property will change the value that is returned to the accessibility client. */ @property(nonatomic, copy) NSString *accessibilityValue; /* Returns a UIAccessibilityTraits mask that is the OR combination of all accessibility traits that best characterize the element. See UIAccessibilityConstants.h for a list of traits. When overriding this method, remember to combine your custom traits with [super accessibilityTraits]. default == UIAccessibilityTraitNone default on UIKit controls == traits that best characterize individual controls. Setting the property will change the traits that are returned to the accessibility client. */ @property(nonatomic) UIAccessibilityTraits accessibilityTraits; /* Returns the frame of the element in screen coordinates. default == CGRectZero default on UIViews == the frame of the view Setting the property will change the frame that is returned to the accessibility client. */ @property(nonatomic) CGRect accessibilityFrame; /* Returns the activation point for an accessible element in screen coordinates. default == Mid-point of the accessibilityFrame. */ @property(nonatomic) CGPoint accessibilityActivationPoint NS_AVAILABLE_IOS(5_0); /* Returns the language code that the element's label, value and hint should be spoken in. If no language is set, the user's language is used. The format for the language code should follow Internet BCP 47 for language tags. For example, en-US specifies U.S. English. default == nil */ @property(nonatomic, retain) NSString *accessibilityLanguage; /* Marks all the accessible elements contained within as hidden. default == NO */ @property(nonatomic) BOOL accessibilityElementsHidden NS_AVAILABLE_IOS(5_0); /* Informs whether the receiving view should be considered modal by accessibility. If YES, then elements outside this view will be ignored. Only elements inside this view will be exposed. default == NO */ @property(nonatomic) BOOL accessibilityViewIsModal NS_AVAILABLE_IOS(5_0); /* Forces children elements to be grouped together regardless of their position on screen. For example, your app may show items that are meant to be grouped together in vertical columns. By default, VoiceOver will navigate those items in horizontal rows. If shouldGroupAccessibilityChildren is set on a parent view of the items in the vertical column, VoiceOver will navigate the order correctly. default == NO */ @property(nonatomic) BOOL shouldGroupAccessibilityChildren NS_AVAILABLE_IOS(6_0); @end /* UIAccessibilityContainer UIAccessibilityContainer methods can be overridden to vend individual elements that are managed by a single UIView. For example, a single UIView might draw several items that (to an end user) have separate meaning and functionality. It is important to vend each item as an individual accessibility element. Sub-elements of a container that are not represented by concrete UIView instances (perhaps painted text or icons) can be represented using instances of UIAccessibilityElement class (see UIAccessibilityElement.h). Accessibility containers MUST return NO to -isAccessibilityElement. */ @interface NSObject (UIAccessibilityContainer) /* Returns the number of accessibility elements in the container. */ - (NSInteger)accessibilityElementCount; /* Returns the accessibility element in order, based on index. default == nil */ - (id)accessibilityElementAtIndex:(NSInteger)index; /* Returns the ordered index for an accessibility element default == NSNotFound */ - (NSInteger)indexOfAccessibilityElement:(id)element; @end /* UIAccessibilityFocus Assistive technologies, like VoiceOver, maintain a virtual focus on an element that allows the user to inspect an element without activating it. */ @interface NSObject (UIAccessibilityFocus) // Override the following methods to know when an assistive technology has set or unset its virtual focus on the element. - (void)accessibilityElementDidBecomeFocused NS_AVAILABLE_IOS(4_0); - (void)accessibilityElementDidLoseFocus NS_AVAILABLE_IOS(4_0); // Returns whether an assistive technology is focused on the element. - (BOOL)accessibilityElementIsFocused NS_AVAILABLE_IOS(4_0); @end /* UIAccessibilityAction An element should implement methods in this category if it supports the action. */ @interface NSObject (UIAccessibilityAction) /* If an element has the UIAccessibilityTraitAdjustable trait, it must also implement the following methods. Incrementing will adjust the element so that it increases its content, while decrementing decreases its content. For example, accessibilityIncrement will increase the value of a UISlider, and accessibilityDecrement will decrease the value. */ - (void)accessibilityIncrement NS_AVAILABLE_IOS(4_0); - (void)accessibilityDecrement NS_AVAILABLE_IOS(4_0); /* If the user interface requires a scrolling action (e.g. turning the page of a book), a view in the view hierarchy should implement the following method. The return result indicates whether the action succeeded for that direction. If the action failed, the method will be called on a view higher in the hierarchy. If the action succeeds, UIAccessibilityPageScrolledNotification must be posted after the scrolling completes. default == NO */ typedef NS_ENUM(NSInteger, UIAccessibilityScrollDirection) { UIAccessibilityScrollDirectionRight = 1, UIAccessibilityScrollDirectionLeft, UIAccessibilityScrollDirectionUp, UIAccessibilityScrollDirectionDown, #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_5_0 UIAccessibilityScrollDirectionNext, UIAccessibilityScrollDirectionPrevious #endif }; - (BOOL)accessibilityScroll:(UIAccessibilityScrollDirection)direction NS_AVAILABLE_IOS(4_2); /* Implement accessibilityPerformEscape on an element or containing view to exit a modal or hierarchical interface view. For example, UIPopoverController implements accessibilityPerformEscape on it's root view, so that when called (as a result of a VoiceOver user action), it dismisses the popover. If your implementation successfully dismisses the current UI, return YES, otherwise return NO. default == NO */ - (BOOL)accessibilityPerformEscape NS_AVAILABLE_IOS(5_0); /* Implement accessibilityPerformMagicTap on an element, or the application, in order to provide a context-sensitive action. For example, a music player can implement this to start and stop playback, or a recording app could start and stop recording. Return YES to indicate that the action was handled. default == NO */ - (BOOL)accessibilityPerformMagicTap NS_AVAILABLE_IOS(6_0); @end /* UIAccessibilityReadingContent Implemented on an element that represents content meant to be read, like a book or periodical. Use in conjuction with UIAccessibilityTraitCausesPageTurn to provide a continuous reading experience with VoiceOver. */ @protocol UIAccessibilityReadingContent @required // Returns the line number given a point in the view's coordinate space. - (NSInteger)accessibilityLineNumberForPoint:(CGPoint)point NS_AVAILABLE_IOS(5_0); // Returns the content associated with a line number as a string. - (NSString *)accessibilityContentForLineNumber:(NSInteger)lineNumber NS_AVAILABLE_IOS(5_0); // Returns the on-screen rectangle for a line number. - (CGRect)accessibilityFrameForLineNumber:(NSInteger)lineNumber NS_AVAILABLE_IOS(5_0); // Returns a string representing the text displayed on the current page. - (NSString *)accessibilityPageContent NS_AVAILABLE_IOS(5_0); @end /* UIAccessibilityPostNotification This function posts a notification to assistive applications. Some notifications specify a required or optional argument. Pass nil for the argument if the notification does not specify otherwise. See UIAccessibilityConstants.h for a list of notifications. */ UIKIT_EXTERN void UIAccessibilityPostNotification(UIAccessibilityNotifications notification, id argument); /* Assistive Technology Use UIAccessibilityIsVoiceOverRunning() to determine if VoiceOver is running. Listen for UIAccessibilityVoiceOverStatusChanged to know when VoiceOver starts or stops. */ UIKIT_EXTERN BOOL UIAccessibilityIsVoiceOverRunning() NS_AVAILABLE_IOS(4_0); UIKIT_EXTERN NSString *const UIAccessibilityVoiceOverStatusChanged NS_AVAILABLE_IOS(4_0); // Returns whether system audio is mixed down from stereo to mono. UIKIT_EXTERN BOOL UIAccessibilityIsMonoAudioEnabled() NS_AVAILABLE_IOS(5_0); UIKIT_EXTERN NSString *const UIAccessibilityMonoAudioStatusDidChangeNotification NS_AVAILABLE_IOS(5_0); // Returns whether the system preference for closed captioning is enabled. UIKIT_EXTERN BOOL UIAccessibilityIsClosedCaptioningEnabled() NS_AVAILABLE_IOS(5_0); UIKIT_EXTERN NSString *const UIAccessibilityClosedCaptioningStatusDidChangeNotification NS_AVAILABLE_IOS(5_0); // Returns whether the system preference for invert colors is enabled. UIKIT_EXTERN BOOL UIAccessibilityIsInvertColorsEnabled() NS_AVAILABLE_IOS(6_0); UIKIT_EXTERN NSString *const UIAccessibilityInvertColorsStatusDidChangeNotification NS_AVAILABLE_IOS(6_0); // Returns whether the app is running under Guided Access mode. UIKIT_EXTERN BOOL UIAccessibilityIsGuidedAccessEnabled() NS_AVAILABLE_IOS(6_0); UIKIT_EXTERN NSString *const UIAccessibilityGuidedAccessStatusDidChangeNotification NS_AVAILABLE_IOS(6_0); // // UIAccessibilityAdditions.h // UIKit // // Copyright (c) 2009-2012, Apple Inc. All rights reserved. // #import #import #import #import /* Optionally implement the following methods in a UIPickerView delegate in order to provide accessibility information per component. See UIAccessibility.h for more information about hints and labels. */ @protocol UIPickerViewAccessibilityDelegate @optional - (NSString *)pickerView:(UIPickerView *)pickerView accessibilityLabelForComponent:(NSInteger)component; - (NSString *)pickerView:(UIPickerView *)pickerView accessibilityHintForComponent:(NSInteger)component; @end /* Provide a custom status string when VoiceOver scrolls with accessibilityScroll: For example, in a bookcase user interface that displays a list of books, you can implement this protocol to announce "Showing books 10 through 20". By default, VoiceOver will announce "Page X of Y" when scrolling. */ @protocol UIScrollViewAccessibilityDelegate @optional - (NSString *)accessibilityScrollStatusForScrollView:(UIScrollView *)scrollView; @end // // UIAccessibilityConstants.h // UIKit // // Copyright (c) 2009-2012, Apple Inc. All rights reserved. // #import #import /* Accessibility Traits Traits are combined in a mask to help assistive applications understand the meaning and intended use of a particular accessibility element. UIKit applies appropriate traits to all standard controls, however the following traits may be used in conjunction with custom controls. When setting accessiblity traits, combine custom traits with [super accessibilityTraits]. An incorrect combination of custom traits will cause accessibility clients to incorrectly interpret the element. Use common sense when combining traits. */ typedef uint64_t UIAccessibilityTraits; // Used when the element has no traits. UIKIT_EXTERN UIAccessibilityTraits UIAccessibilityTraitNone; // Used when the element should be treated as a button. UIKIT_EXTERN UIAccessibilityTraits UIAccessibilityTraitButton; // Used when the element should be treated as a link. UIKIT_EXTERN UIAccessibilityTraits UIAccessibilityTraitLink; // Used when an element acts as a header for a content section (e.g. the title of a navigation bar). UIKIT_EXTERN UIAccessibilityTraits UIAccessibilityTraitHeader NS_AVAILABLE_IOS(6_0); // Used when the text field element should also be treated as a search field. UIKIT_EXTERN UIAccessibilityTraits UIAccessibilityTraitSearchField; // Used when the element should be treated as an image. Can be combined with button or link, for example. UIKIT_EXTERN UIAccessibilityTraits UIAccessibilityTraitImage; /* Used when the element is selected. For example, a selected row in a table or a selected button within a segmented control. */ UIKIT_EXTERN UIAccessibilityTraits UIAccessibilityTraitSelected; // Used when the element plays its own sound when activated. UIKIT_EXTERN UIAccessibilityTraits UIAccessibilityTraitPlaysSound; // Used when the element acts as a keyboard key. UIKIT_EXTERN UIAccessibilityTraits UIAccessibilityTraitKeyboardKey; // Used when the element should be treated as static text that cannot change. UIKIT_EXTERN UIAccessibilityTraits UIAccessibilityTraitStaticText; /* Used when an element can be used to provide a quick summary of current conditions in the app when the app first launches. For example, when Weather first launches, the element with today's weather conditions is marked with this trait. */ UIKIT_EXTERN UIAccessibilityTraits UIAccessibilityTraitSummaryElement; // Used when the control is not enabled and does not respond to user input. UIKIT_EXTERN UIAccessibilityTraits UIAccessibilityTraitNotEnabled; /* Used when the element frequently updates its label or value, but too often to send notifications. Allows an accessibility client to poll for changes. A stopwatch would be an example. */ UIKIT_EXTERN UIAccessibilityTraits UIAccessibilityTraitUpdatesFrequently; /* Used when activating an element starts a media session (e.g. playing a movie, recording audio) that should not be interrupted by output from an assistive technology, like VoiceOver. */ UIKIT_EXTERN UIAccessibilityTraits UIAccessibilityTraitStartsMediaSession NS_AVAILABLE_IOS(4_0); /* Used when an element can be "adjusted" (e.g. a slider). The element must also implement accessibilityIncrement and accessibilityDecrement. */ UIKIT_EXTERN UIAccessibilityTraits UIAccessibilityTraitAdjustable NS_AVAILABLE_IOS(4_0); // Used when an element allows direct touch interaction for VoiceOver users (for example, a view representing a piano keyboard). UIKIT_EXTERN UIAccessibilityTraits UIAccessibilityTraitAllowsDirectInteraction NS_AVAILABLE_IOS(5_0); /* Informs VoiceOver that it should scroll to the next page when it finishes reading the contents of the element. VoiceOver will scroll by calling accessibilityScroll: with UIAccessibilityScrollDirectionNext and will stop scrolling when it detects the content has not changed. */ UIKIT_EXTERN UIAccessibilityTraits UIAccessibilityTraitCausesPageTurn NS_AVAILABLE_IOS(5_0); /* Accessibility Notifications UIKit posts notifications for standard events as appropriate, however the following notifications may be posted to accommodate custom controls and events. */ typedef uint32_t UIAccessibilityNotifications; /* Should be posted when a new view appears that encompasses a major portion of the screen. Optionally, pass the element that VoiceOver should move to after processing the notification. */ UIKIT_EXTERN UIAccessibilityNotifications UIAccessibilityScreenChangedNotification; /* Should be posted when the layout of a screen changes, for example when an individual element appears or disappears. Optionally, pass the element that VoiceOver should move to after processing the notification. */ UIKIT_EXTERN UIAccessibilityNotifications UIAccessibilityLayoutChangedNotification; /* Should be posted when an announcement needs to be conveyed to VoiceOver. VoiceOver will output the announcement string that is used as the argument. The argument is a NSString. */ UIKIT_EXTERN UIAccessibilityNotifications UIAccessibilityAnnouncementNotification NS_AVAILABLE_IOS(4_0); /* Listen for this notification to know when VoiceOver finishes outputting an announcement. The userInfo dictionary contains UIAccessibilityAnnouncementKeyString and UIAccessibilityAnnouncementKeyWasSuccessful. */ UIKIT_EXTERN NSString *const UIAccessibilityAnnouncementDidFinishNotification NS_AVAILABLE_IOS(6_0); // The corresponding value is the string that was used for the announcement. UIKIT_EXTERN NSString *const UIAccessibilityAnnouncementKeyStringValue NS_AVAILABLE_IOS(6_0); // The corresponding value is an NSNumber representing whether VoiceOver successfully outputted the announcement. UIKIT_EXTERN NSString *const UIAccessibilityAnnouncementKeyWasSuccessful NS_AVAILABLE_IOS(6_0); /* Should be posted after accessibilityScroll: is called and the scrolling action has completed. A string representing the status of the new scroll position should be used as the argument (e.g. "Page 2 of 5"). If the same status is used repeatedly, the assistive technology will indicate a border has been reached. The argument is a NSString. */ UIKIT_EXTERN UIAccessibilityNotifications UIAccessibilityPageScrolledNotification NS_AVAILABLE_IOS(4_2); // // UIAccessibilityElement.h // UIAccessibility // // Copyright (c) 2008-2012, Apple Inc. All rights reserved. // #import #import #import /* UIAccessibilityElement Instances of this class can be used as "fake" accessibility elements. An accessibility container (see UIAccessibility.h) can create and vend instances of UIAccessibilityElement to cover for user interface items that are not backed by a UIView (for example: painted text or icon). */ NS_CLASS_AVAILABLE_IOS(3_0) @interface UIAccessibilityElement : NSObject // initialize with the accessibility container that contains this element - (id)initWithAccessibilityContainer:(id)container; @property (nonatomic, assign) id accessibilityContainer; @property (nonatomic, assign) BOOL isAccessibilityElement; @property (nonatomic, retain) NSString *accessibilityLabel; @property (nonatomic, retain) NSString *accessibilityHint; @property (nonatomic, retain) NSString *accessibilityValue; @property (nonatomic, assign) CGRect accessibilityFrame; @property (nonatomic, assign) UIAccessibilityTraits accessibilityTraits; @end // // UIAccessibilityIdentification.h // UIKit // // Copyright 2010-2012, Apple Inc. All rights reserved. // #import #import #import @protocol UIAccessibilityIdentification @required /* A string that identifies the user interface element. default == nil */ @property(nonatomic, copy) NSString *accessibilityIdentifier NS_AVAILABLE_IOS(5_0); @end @interface UIView (UIAccessibility) @end /* Defaults to the filename of the image, if available. The default identifier for a UIImageView will be the identifier of its UIImage. */ @interface UIImage (UIAccessibility) @end // // UIAccessibilityZoom.h // UIKit // // Copyright (c) 2011-2012, Apple Inc. All rights reserved. // /* Use to inform system Zoom that focus has changed to a new location. The frame should be in the coordinate space of the view. */ typedef NS_ENUM(NSInteger, UIAccessibilityZoomType) { UIAccessibilityZoomTypeInsertionPoint, // Used when the text insertion point has moved } NS_ENUM_AVAILABLE_IOS(5_0); UIKIT_EXTERN void UIAccessibilityZoomFocusChanged(UIAccessibilityZoomType type, CGRect frame, UIView *view) NS_AVAILABLE_IOS(5_0); /* If your app uses multi-finger gestures that conflict with system Zoom gestures (by using three fingers), calling this method will warn users of the conflict. */ UIKIT_EXTERN void UIAccessibilityRegisterGestureConflictWithZoom() NS_AVAILABLE_IOS(5_0); // // UIActionSheet.h // UIKit // // Copyright 2010-2012, Apple Inc. All rights reserved. // #import #import #import #import @protocol UIActionSheetDelegate; @class UILabel, UIToolbar, UITabBar, UIWindow, UIBarButtonItem, UIPopoverController; typedef NS_ENUM(NSInteger, UIActionSheetStyle) { UIActionSheetStyleAutomatic = -1, // take appearance from toolbar style otherwise uses 'default' UIActionSheetStyleDefault = UIBarStyleDefault, UIActionSheetStyleBlackTranslucent = UIBarStyleBlackTranslucent, UIActionSheetStyleBlackOpaque = UIBarStyleBlackOpaque, }; NS_CLASS_AVAILABLE_IOS(2_0) @interface UIActionSheet : UIView { @private id _delegate; UILabel *_titleLabel; NSAttributedString *_attributedTitleString; UILabel *_subtitleLabel; UILabel *_bodyTextLabel; UILabel *_taglineTextLabel; CGFloat _startY; id _context; NSInteger _cancelButton; NSInteger _defaultButton; NSInteger _firstOtherButton; UIToolbar *_toolbar; UIWindow *_originalWindow; UIWindow *_dimWindow; NSInteger _suspendTag; NSInteger _dismissButtonIndex; CGFloat _bodyTextHeight; NSMutableArray *_buttons; NSMutableArray *_buttonsInTable; NSMutableArray *_textFields; UIView *_keyboard; UIView *_table; UIView *_buttonTableView; UIView *_dimView; UIPopoverController * _popoverController; CGFloat _fontSizeInTableView; // font size for 'complex' buttons (phone numbers || doc interaction controller) CGFloat _iconOffset; // doc interaction controller app icon CGFloat _labelOffset; // phone numbers layout CGFloat _labelWidth; CGFloat _titleWidth; BOOL _oldIgnoreTapsValue; struct { unsigned int numberOfRows:7; unsigned int delegateAlertSheetButtonClicked:1; unsigned int delegateDidPresentAlertSheet:1; unsigned int delegateDidDismissAlertSheet:1; unsigned int hideButtonBar:1; unsigned int alertStyle:3; unsigned int dontDimBackground:1; unsigned int dismissSuspended:1; unsigned int dontBlockInteraction:1; unsigned int sheetWasPoppedUp:1; unsigned int sheetWasShown:1; unsigned int animating:1; unsigned int hideWhenDoneAnimating:1; unsigned int layoutWhenDoneAnimating:1; unsigned int titleMaxLineCount:2; unsigned int bodyTextMaxLineCount:3; unsigned int runsModal:1; unsigned int runningModal:1; unsigned int addedTextView:1; unsigned int addedTableShadows:1; unsigned int showOverSBAlerts:1; unsigned int showMinTableContent:1; unsigned int bodyTextTruncated:1; unsigned int orientation:3; unsigned int popupFromPoint:1; unsigned int inPopover:1; unsigned int delegateBodyTextAlignment:1; unsigned int delegateClickedButtonAtIndex:1; unsigned int delegateClickedButtonAtIndex2:1; unsigned int delegateCancel:1; unsigned int delegateCancel2:1; unsigned int delegateWillPresent:1; unsigned int delegateWillPresent2:1; unsigned int delegateDidPresent:1; unsigned int delegateDidPresent2:1; unsigned int delegateWillDismiss:1; unsigned int delegateWillDismiss2:1; unsigned int delegateDidDismiss:1; unsigned int delegateDidDismiss2:1; unsigned int dontCallDismissDelegate:1; unsigned int useAutomaticKB:1; unsigned int twoColumnsLayoutMode:7; // one column || even width (leaves empty space) || first button wider || last button wider unsigned int threeColumnsLayoutMode:7; // one column || even width (leaves empty space) || first button wider || last button wider unsigned int shouldHandleFirstKeyUpEvent:1; // when presenting with hardware KB we have to handle the first key up event we get so we don't end up repeating the last key unsigned int cancelWhenDoneAnimating:1; unsigned int useThreePartButtons:1; // phone numbers layout unsigned int useTwoPartButtons:1; // doc interaction layout unsigned int displaySelectedButtonGlyph:1; int indexOfSelectedButton:7; // default -1 (no checkmark) otherwise will display a checkbox (this for the airtunes action sheet) unsigned int useCustomSelectedButtonGlyph:1; } _modalViewFlags; UIActionSheetStyle _actionSheetStyle; UIImage *_selectedButtonGlyphImage; UIImage *_selectedButtonGlyphHighlightedImage; UIImageView *_shadowImageView; } - (id)initWithTitle:(NSString *)title delegate:(id)delegate cancelButtonTitle:(NSString *)cancelButtonTitle destructiveButtonTitle:(NSString *)destructiveButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION; @property(nonatomic,assign) id delegate; // weak reference @property(nonatomic,copy) NSString *title; @property(nonatomic) UIActionSheetStyle actionSheetStyle; // default is UIActionSheetStyleAutomatic. ignored if alert is visible // adds a button with the title. returns the index (0 based) of where it was added. buttons are displayed in the order added except for the // destructive and cancel button which will be positioned based on HI requirements. buttons cannot be customized. - (NSInteger)addButtonWithTitle:(NSString *)title; // returns index of button. 0 based. - (NSString *)buttonTitleAtIndex:(NSInteger)buttonIndex; @property(nonatomic,readonly) NSInteger numberOfButtons; @property(nonatomic) NSInteger cancelButtonIndex; // if the delegate does not implement -actionSheetCancel:, we pretend this button was clicked on. default is -1 @property(nonatomic) NSInteger destructiveButtonIndex; // sets destructive (red) button. -1 means none set. default is -1. ignored if only one button @property(nonatomic,readonly) NSInteger firstOtherButtonIndex; // -1 if no otherButtonTitles or initWithTitle:... not used @property(nonatomic,readonly,getter=isVisible) BOOL visible; // show a sheet animated. you can specify either a toolbar, a tab bar, a bar butto item or a plain view. We do a special animation if the sheet rises from // a toolbar, tab bar or bar button item and we will automatically select the correct style based on the bar style. if not from a bar, we use // UIActionSheetStyleDefault if automatic style set - (void)showFromToolbar:(UIToolbar *)view; - (void)showFromTabBar:(UITabBar *)view; - (void)showFromBarButtonItem:(UIBarButtonItem *)item animated:(BOOL)animated NS_AVAILABLE_IOS(3_2); - (void)showFromRect:(CGRect)rect inView:(UIView *)view animated:(BOOL)animated NS_AVAILABLE_IOS(3_2); - (void)showInView:(UIView *)view; // hides alert sheet or popup. use this method when you need to explicitly dismiss the alert. // it does not need to be called if the user presses on a button - (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated; @end @protocol UIActionSheetDelegate @optional // Called when a button is clicked. The view will be automatically dismissed after this call returns - (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex; // Called when we cancel a view (eg. the user clicks the Home button). This is not called when the user clicks the cancel button. // If not defined in the delegate, we simulate a click in the cancel button - (void)actionSheetCancel:(UIActionSheet *)actionSheet; - (void)willPresentActionSheet:(UIActionSheet *)actionSheet; // before animation and showing view - (void)didPresentActionSheet:(UIActionSheet *)actionSheet; // after animation - (void)actionSheet:(UIActionSheet *)actionSheet willDismissWithButtonIndex:(NSInteger)buttonIndex; // before animation and hiding view - (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex; // after animation @end // // UIActivity.h // UIKit // // Copyright 2012 Apple, Inc. All rights reserved. // #import #import @class UIImage, UIViewController; UIKIT_EXTERN NSString *const UIActivityTypePostToFacebook NS_AVAILABLE_IOS(6_0); // text, images, URLs UIKIT_EXTERN NSString *const UIActivityTypePostToTwitter NS_AVAILABLE_IOS(6_0); // text, images, URLs UIKIT_EXTERN NSString *const UIActivityTypePostToWeibo NS_AVAILABLE_IOS(6_0); // text, images, URLs UIKIT_EXTERN NSString *const UIActivityTypeMessage NS_AVAILABLE_IOS(6_0); // text UIKIT_EXTERN NSString *const UIActivityTypeMail NS_AVAILABLE_IOS(6_0); // text, image, file:// URLs UIKIT_EXTERN NSString *const UIActivityTypePrint NS_AVAILABLE_IOS(6_0); // image, NSData, file:// URL, UIPrintPageRenderer, UIPrintFormatter, UIPrintInfo UIKIT_EXTERN NSString *const UIActivityTypeCopyToPasteboard NS_AVAILABLE_IOS(6_0); // text, image, NSURL, UIColor, NSDictionary UIKIT_EXTERN NSString *const UIActivityTypeAssignToContact NS_AVAILABLE_IOS(6_0); // image UIKIT_EXTERN NSString *const UIActivityTypeSaveToCameraRoll NS_AVAILABLE_IOS(6_0); // image, video NS_CLASS_AVAILABLE_IOS(6_0) @interface UIActivity : NSObject // override methods - (NSString *)activityType; // default returns nil. subclass may override to return custom activity type that is reported to completion handler - (NSString *)activityTitle; // default returns nil. subclass must override and must return non-nil value - (UIImage *)activityImage; // default returns nil. subclass must override and must return non-nil value - (BOOL)canPerformWithActivityItems:(NSArray *)activityItems; // override this to return availability of activity based on items. default returns NO - (void)prepareWithActivityItems:(NSArray *)activityItems; // override to extract items and set up your HI. default does nothing - (UIViewController *)activityViewController; // return non-nil to have vC presented modally. call activityDidFinish at end. default returns nil - (void)performActivity; // if no view controller, this method is called. call activityDidFinish when done. default calls [self activityDidFinish:NO] // state method - (void)activityDidFinish:(BOOL)completed; // activity must call this when activity is finished. can be called on any thread @end // // UIActivityIndicator.h // UIKit // // Copyright (c) 2005-2012, Apple Inc. All rights reserved. // #import #import typedef NS_ENUM(NSInteger, UIActivityIndicatorViewStyle) { UIActivityIndicatorViewStyleWhiteLarge, UIActivityIndicatorViewStyleWhite, UIActivityIndicatorViewStyleGray, }; NS_CLASS_AVAILABLE_IOS(2_0) @interface UIActivityIndicatorView : UIView { @package CFTimeInterval _duration; BOOL _animating; UIActivityIndicatorViewStyle _activityIndicatorViewStyle; UIActivityIndicatorViewStyle _actualActivityIndicatorViewStyle; BOOL _hidesWhenStopped; } - (id)initWithActivityIndicatorStyle:(UIActivityIndicatorViewStyle)style; // sizes the view according to the style @property(nonatomic) UIActivityIndicatorViewStyle activityIndicatorViewStyle; // default is UIActivityIndicatorViewStyleWhite @property(nonatomic) BOOL hidesWhenStopped; // default is YES. calls -setHidden when animating gets set to NO @property (readwrite, nonatomic, retain) UIColor *color NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; - (void)startAnimating; - (void)stopAnimating; - (BOOL)isAnimating; @end // // UIActivityItemProvider.h // UIKit // // Copyright 2012 Apple, Inc. All rights reserved. // #import #import #import @class UIActivityViewController; @protocol UIActivityItemSource @required - (id)activityViewControllerPlaceholderItem:(UIActivityViewController *)activityViewController; // called to determine data type - (id)activityViewController:(UIActivityViewController *)activityViewController itemForActivityType:(NSString *)activityType; // called to fetch data @end NS_CLASS_AVAILABLE_IOS(6_0) @interface UIActivityItemProvider : NSOperation - (id)initWithPlaceholderItem:(id)placeholderItem; @property(nonatomic,retain,readonly) id placeholderItem; // return item from init @property(nonatomic,readonly) NSString *activityType; // Activity type available when -item is called. nil at other times. - (id)item; // called by -main when data is needed. default returns nil. Subclass to override and call status/progress. called on secondary thread @end // // UIActivityViewController.h // UIKit // // Copyright 2012 Apple, Inc. All rights reserved. // #import #import #import typedef void (^UIActivityViewControllerCompletionHandler)(NSString *activityType, BOOL completed); NS_CLASS_AVAILABLE_IOS(6_0) @interface UIActivityViewController : UIViewController - (id)initWithActivityItems:(NSArray *)activityItems applicationActivities:(NSArray *)applicationActivities; @property(nonatomic,copy) UIActivityViewControllerCompletionHandler completionHandler; // set to nil after call @property(nonatomic,copy) NSArray *excludedActivityTypes; // default is nil. activity types listed will not be displayed @end // // UIAlert.h // UIKit // // Copyright (c) 2005-2012, Apple Inc. All rights reserved. // #import #import // // UIAlertView.h // UIKit // // Copyright 2010-2012, Apple Inc. All rights reserved. // #import #import #import #import typedef NS_ENUM(NSInteger, UIAlertViewStyle) { UIAlertViewStyleDefault = 0, UIAlertViewStyleSecureTextInput, UIAlertViewStylePlainTextInput, UIAlertViewStyleLoginAndPasswordInput }; @protocol UIAlertViewDelegate; @class UILabel, UIToolbar, UITabBar, UIWindow, UIBarButtonItem, UIPopoverController; NS_CLASS_AVAILABLE_IOS(2_0) @interface UIAlertView : UIView { @private id _delegate; UILabel *_titleLabel; UILabel *_subtitleLabel; UILabel *_bodyTextLabel; UILabel *_taglineTextLabel; CGFloat _startY; CGPoint _center; id _context; NSInteger _cancelButton; NSInteger _defaultButton; NSInteger _firstOtherButton; UIToolbar *_toolbar; UIWindow *_originalWindow; UIWindow *_dimWindow; NSInteger _suspendTag; NSInteger _dismissButtonIndex; CGFloat _bodyTextHeight; NSMutableArray *_buttons; NSMutableArray *_textFields; UIView *_keyboard; UIView *_table; UIView *_dimView; UIView *_backgroundImageView; struct { unsigned int numberOfRows:7; unsigned int delegateAlertSheetButtonClicked:1; unsigned int delegateDidPresentAlertSheet:1; unsigned int delegateDidDismissAlertSheet:1; unsigned int hideButtonBar:1; unsigned int alertStyle:3; unsigned int dontDimBackground:1; unsigned int dismissSuspended:1; unsigned int dontBlockInteraction:1; unsigned int sheetWasPoppedUp:1; unsigned int animating:1; unsigned int hideWhenDoneAnimating:1; unsigned int layoutWhenDoneAnimating:1; unsigned int titleMaxLineCount:2; unsigned int bodyTextMaxLineCount:3; unsigned int runsModal:1; unsigned int runningModal:1; unsigned int addedTextView:1; unsigned int addedTableShadows:1; unsigned int showOverSBAlerts:1; unsigned int showMinTableContent:1; unsigned int bodyTextTruncated:1; unsigned int orientation:3; unsigned int groupsTextFields:1; unsigned int includesCancel:1; unsigned int useUndoStyle:1; unsigned int delegateBodyTextAlignment:1; unsigned int delegateClickedButtonAtIndex:1; unsigned int delegateClickedButtonAtIndex2:1; unsigned int delegateCancel:1; unsigned int delegateCancel2:1; unsigned int delegateWillPresent:1; unsigned int delegateWillPresent2:1; unsigned int delegateDidPresent:1; unsigned int delegateDidPresent2:1; unsigned int delegateWillDismiss:1; unsigned int delegateWillDismiss2:1; unsigned int delegateDidDismiss:1; unsigned int delegateDidDismiss2:1; unsigned int delegateShouldEnableFirstOtherButton:1; unsigned int forceHorizontalButtonsLayout:1; unsigned int suppressKeyboardOnPopup:1; // the folder creation alert has text fields but we need to pop up without the keyboard unsigned int keyboardShowing:1; unsigned int dontCallDismissDelegate:1; unsigned int useAutomaticKB:1; unsigned int manualKeyboardVisible:1; unsigned int rotatingManualKeybaord:1; unsigned int shouldHandleFirstKeyUpEvent:1; // when presenting with hardware KB we have to handle the first key up event we get so we don't end up repeating the last key unsigned int forceKeyboardUse:1; unsigned int cancelWhenDoneAnimating:1; unsigned int alertViewStyle:3; unsigned int isSBAlert:1; unsigned int isBeingDismissed:1; } _modalViewFlags; } - (id)initWithTitle:(NSString *)title message:(NSString *)message delegate:(id /**/)delegate cancelButtonTitle:(NSString *)cancelButtonTitle otherButtonTitles:(NSString *)otherButtonTitles, ... NS_REQUIRES_NIL_TERMINATION; @property(nonatomic,assign) id /**/ delegate; // weak reference @property(nonatomic,copy) NSString *title; @property(nonatomic,copy) NSString *message; // secondary explanation text // adds a button with the title. returns the index (0 based) of where it was added. buttons are displayed in the order added except for the // cancel button which will be positioned based on HI requirements. buttons cannot be customized. - (NSInteger)addButtonWithTitle:(NSString *)title; // returns index of button. 0 based. - (NSString *)buttonTitleAtIndex:(NSInteger)buttonIndex; @property(nonatomic,readonly) NSInteger numberOfButtons; @property(nonatomic) NSInteger cancelButtonIndex; // if the delegate does not implement -alertViewCancel:, we pretend this button was clicked on. default is -1 @property(nonatomic,readonly) NSInteger firstOtherButtonIndex; // -1 if no otherButtonTitles or initWithTitle:... not used @property(nonatomic,readonly,getter=isVisible) BOOL visible; // shows popup alert animated. - (void)show; // hides alert sheet or popup. use this method when you need to explicitly dismiss the alert. // it does not need to be called if the user presses on a button - (void)dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(BOOL)animated; // Alert view style - defaults to UIAlertViewStyleDefault @property(nonatomic,assign) UIAlertViewStyle alertViewStyle NS_AVAILABLE_IOS(5_0); /* Retrieve a text field at an index - raises NSRangeException when textFieldIndex is out-of-bounds. The field at index 0 will be the first text field (the single field or the login field), the field at index 1 will be the password field. */ - (UITextField *)textFieldAtIndex:(NSInteger)textFieldIndex NS_AVAILABLE_IOS(5_0); @end @protocol UIAlertViewDelegate @optional // Called when a button is clicked. The view will be automatically dismissed after this call returns - (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex; // Called when we cancel a view (eg. the user clicks the Home button). This is not called when the user clicks the cancel button. // If not defined in the delegate, we simulate a click in the cancel button - (void)alertViewCancel:(UIAlertView *)alertView; - (void)willPresentAlertView:(UIAlertView *)alertView; // before animation and showing view - (void)didPresentAlertView:(UIAlertView *)alertView; // after animation - (void)alertView:(UIAlertView *)alertView willDismissWithButtonIndex:(NSInteger)buttonIndex; // before animation and hiding view - (void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex; // after animation // Called after edits in any of the default fields added by the style - (BOOL)alertViewShouldEnableFirstOtherButton:(UIAlertView *)alertView; @end // // UIAppearance.h // UIKit // // Copyright 2011-2012, Apple Inc. All rights reserved. // #import /* To participate in the appearance proxy API, tag your appearance property selectors in your header with UI_APPEARANCE_SELECTOR. Appearance property selectors must be of the form: - (void)setProperty:(PropertyType)property forAxis1:(IntegerType)axis1 axis2:(IntegerType)axis2 axisN:(IntegerType)axisN; - (PropertyType)propertyForAxis1:(IntegerType)axis1 axis2:(IntegerType)axis2 axisN:(IntegerType)axisN; You may have no axes or as many as you like for any property. PropertyType may be any standard iOS type: id, NSInteger, NSUInteger, CGFloat, CGPoint, CGSize, CGRect, UIEdgeInsets or UIOffset. IntegerType must be either NSInteger or NSUInteger; we will throw an exception if other types are used in the axes. */ #define UI_APPEARANCE_SELECTOR @protocol UIAppearanceContainer @end @protocol UIAppearance /* To customize the appearance of all instances of a class, send the relevant appearance modification messages to the appearance proxy for the class. For example, to modify the tint color for all UINavigationBar instances: [[UINavigationBar appearance] setTintColor:myColor]; */ + (id)appearance; /* To customize the appearances for instances of a class contained within an instance of a container class, or instances in a hierarchy, use +appearanceWhenContainedIn: for the appropriate appearance proxy. For example: [[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], nil] setTintColor:myNavBarColor]; [[UIBarButtonItem appearanceWhenContainedIn:[UINavigationBar class], [UIPopoverController class], nil] setTintColor:myPopoverNavBarColor]; [[UIBarButtonItem appearanceWhenContainedIn:[UIToolbar class], nil] setTintColor:myToolbarColor]; [[UIBarButtonItem appearanceWhenContainedIn:[UIToolbar class], [UIPopoverController class], nil] setTintColor:myPopoverToolbarColor]; In any given view hierarchy the outermost appearance proxy wins. Specificity (depth of the chain) is the tie-breaker. In other words, the containment statement is treated as a partial ordering. Given a concrete ordering (actual subview hierarchy), we select the partial ordering that is the first unique match when reading the actual hierarchy from the window down. This method will throw an exception for anything in the var-args list that is not a Class . */ + (id)appearanceWhenContainedIn:(Class )ContainerClass, ... NS_REQUIRES_NIL_TERMINATION; @end // // UIApplication.h // UIKit // // Copyright (c) 2005-2012, Apple Inc. All rights reserved. // #import #import #import #import #import #import #import typedef NS_ENUM(NSInteger, UIStatusBarStyle) { UIStatusBarStyleDefault, UIStatusBarStyleBlackTranslucent, UIStatusBarStyleBlackOpaque }; typedef NS_ENUM(NSInteger, UIStatusBarAnimation) { UIStatusBarAnimationNone, #if __IPHONE_3_2 <= __IPHONE_OS_VERSION_MAX_ALLOWED UIStatusBarAnimationFade, UIStatusBarAnimationSlide, #endif }; // Note that UIInterfaceOrientationLandscapeLeft is equal to UIDeviceOrientationLandscapeRight (and vice versa). // This is because rotating the device to the left requires rotating the content to the right. typedef NS_ENUM(NSInteger, UIInterfaceOrientation) { UIInterfaceOrientationPortrait = UIDeviceOrientationPortrait, UIInterfaceOrientationPortraitUpsideDown = UIDeviceOrientationPortraitUpsideDown, UIInterfaceOrientationLandscapeLeft = UIDeviceOrientationLandscapeRight, UIInterfaceOrientationLandscapeRight = UIDeviceOrientationLandscapeLeft }; /* This exception is raised if supportedInterfaceOrientations returns 0, or if preferredInterfaceOrientationForPresentation returns an orientation that is not supported. */ UIKIT_EXTERN NSString *const UIApplicationInvalidInterfaceOrientationException NS_AVAILABLE_IOS(6_0); typedef NS_OPTIONS(NSUInteger, UIInterfaceOrientationMask) { UIInterfaceOrientationMaskPortrait = (1 << UIInterfaceOrientationPortrait), UIInterfaceOrientationMaskLandscapeLeft = (1 << UIInterfaceOrientationLandscapeLeft), UIInterfaceOrientationMaskLandscapeRight = (1 << UIInterfaceOrientationLandscapeRight), UIInterfaceOrientationMaskPortraitUpsideDown = (1 << UIInterfaceOrientationPortraitUpsideDown), UIInterfaceOrientationMaskLandscape = (UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight), UIInterfaceOrientationMaskAll = (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight | UIInterfaceOrientationMaskPortraitUpsideDown), UIInterfaceOrientationMaskAllButUpsideDown = (UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft | UIInterfaceOrientationMaskLandscapeRight), }; #define UIDeviceOrientationIsValidInterfaceOrientation(orientation) ((orientation) == UIDeviceOrientationPortrait || (orientation) == UIDeviceOrientationPortraitUpsideDown || (orientation) == UIDeviceOrientationLandscapeLeft || (orientation) == UIDeviceOrientationLandscapeRight) #define UIInterfaceOrientationIsPortrait(orientation) ((orientation) == UIInterfaceOrientationPortrait || (orientation) == UIInterfaceOrientationPortraitUpsideDown) #define UIInterfaceOrientationIsLandscape(orientation) ((orientation) == UIInterfaceOrientationLandscapeLeft || (orientation) == UIInterfaceOrientationLandscapeRight) typedef NS_OPTIONS(NSUInteger, UIRemoteNotificationType) { UIRemoteNotificationTypeNone = 0, UIRemoteNotificationTypeBadge = 1 << 0, UIRemoteNotificationTypeSound = 1 << 1, UIRemoteNotificationTypeAlert = 1 << 2, UIRemoteNotificationTypeNewsstandContentAvailability = 1 << 3, } NS_ENUM_AVAILABLE_IOS(3_0); typedef NS_ENUM(NSInteger, UIApplicationState) { UIApplicationStateActive, UIApplicationStateInactive, UIApplicationStateBackground } NS_ENUM_AVAILABLE_IOS(4_0); typedef NSUInteger UIBackgroundTaskIdentifier; UIKIT_EXTERN const UIBackgroundTaskIdentifier UIBackgroundTaskInvalid NS_AVAILABLE_IOS(4_0); UIKIT_EXTERN const NSTimeInterval UIMinimumKeepAliveTimeout NS_AVAILABLE_IOS(4_0); typedef NS_ENUM(NSInteger, UIUserInterfaceLayoutDirection) { UIUserInterfaceLayoutDirectionLeftToRight, UIUserInterfaceLayoutDirectionRightToLeft, } NS_ENUM_AVAILABLE_IOS(5_0); @class UIView, UIWindow, UIStatusBar, UIStatusBarWindow, UILocalNotification; @protocol UIApplicationDelegate; NS_CLASS_AVAILABLE_IOS(2_0) @interface UIApplication : UIResponder { @package id _delegate; CFMutableDictionaryRef _touchMap; NSMutableSet *_exclusiveTouchWindows; UIEvent *_event; UIEvent *_touchesEvent; UIEvent *_motionEvent; UIEvent *_remoteControlEvent; NSInteger _remoteControlEventObservers; NSArray *_topLevelNibObjects; NSInteger _networkResourcesCurrentlyLoadingCount; NSTimer *_hideNetworkActivityIndicatorTimer; UIAlertView *_editAlertView; UIStatusBar *_statusBar; UIStatusBarStyle _statusBarRequestedStyle; UIStatusBarWindow *_statusBarWindow; NSMutableArray *_observerBlocks; NSMutableArray *_deferredAnimationBlocks; NSString *_mainStoryboardName; NSMutableArray *_tintViewDurationStack; NSMutableArray *_statusBarTintColorLockingControllers; NSInteger _statusBarTintColorLockingCount; struct { unsigned int deactivatingReasonFlags:8; unsigned int isSuspended:1; unsigned int isSuspendedEventsOnly:1; unsigned int isLaunchedSuspended:1; unsigned int calledNonSuspendedLaunchDelegate:1; unsigned int isHandlingURL:1; unsigned int isHandlingRemoteNotification:1; unsigned int isHandlingLocalNotification:1; unsigned int statusBarShowsProgress:1; unsigned int statusBarHidden:1; unsigned int blockInteractionEvents:4; unsigned int receivesMemoryWarnings:1; unsigned int showingProgress:1; unsigned int receivesPowerMessages:1; unsigned int launchEventReceived:1; unsigned int systemIsAnimatingApplicationLifecycleEvent:1; // suspension, resumption, or system gesture unsigned int isResuming:1; unsigned int isSuspendedUnderLock:1; unsigned int shouldExitAfterSendSuspend:1; unsigned int terminating:1; unsigned int isHandlingShortCutURL:1; unsigned int idleTimerDisabled:1; unsigned int deviceOrientation:3; unsigned int delegateShouldBeReleasedUponSet:1; unsigned int delegateHandleOpenURL:1; unsigned int delegateOpenURL:1; unsigned int delegateDidReceiveMemoryWarning:1; unsigned int delegateWillTerminate:1; unsigned int delegateSignificantTimeChange:1; unsigned int delegateWillChangeInterfaceOrientation:1; unsigned int delegateDidChangeInterfaceOrientation:1; unsigned int delegateWillChangeStatusBarFrame:1; unsigned int delegateDidChangeStatusBarFrame:1; unsigned int delegateDeviceAccelerated:1; unsigned int delegateDeviceChangedOrientation:1; unsigned int delegateDidBecomeActive:1; unsigned int delegateWillResignActive:1; unsigned int delegateDidEnterBackground:1; unsigned int delegateDidEnterBackgroundWasSent:1; unsigned int delegateWillEnterForeground:1; unsigned int delegateWillSuspend:1; unsigned int delegateDidResume:1; unsigned int delegateSupportsStateRestoration:1; unsigned int delegateSupportedInterfaceOrientations:1; unsigned int userDefaultsSyncDisabled:1; unsigned int headsetButtonClickCount:4; unsigned int isHeadsetButtonDown:1; unsigned int isFastForwardActive:1; unsigned int isRewindActive:1; unsigned int shakeToEdit:1; unsigned int isClassic:1; unsigned int zoomInClassicMode:1; unsigned int ignoreHeadsetClicks:1; unsigned int touchRotationDisabled:1; unsigned int taskSuspendingUnsupported:1; unsigned int taskSuspendingOnLockUnsupported:1; unsigned int isUnitTests:1; unsigned int requiresHighResolution:1; unsigned int disableViewContentScaling:1; unsigned int singleUseLaunchOrientation:3; unsigned int defaultInterfaceOrientation:3; unsigned int supportedInterfaceOrientationsMask:5; unsigned int delegateWantsNextResponder:1; unsigned int isRunningInApplicationSwitcher:1; unsigned int isSendingEventForProgrammaticTouchCancellation:1; unsigned int delegateWantsStatusBarTouchesEnded:1; unsigned int interfaceLayoutDirectionIsValid:1; unsigned int interfaceLayoutDirection:3; unsigned int restorationExtended:1; unsigned int normalRestorationInProgress:1; unsigned int normalRestorationCompleted:1; unsigned int isDelayingTintViewChange:1; unsigned int isUpdatingTintViewColor:1; unsigned int isHandlingMemoryWarning:1; unsigned int forceStatusBarTintColorChanges:1; unsigned int disableLegacyAutorotation:1; } _applicationFlags; } + (UIApplication *)sharedApplication; @property(nonatomic,assign) id delegate; - (void)beginIgnoringInteractionEvents; // nested. set should be set during animations & transitions to ignore touch and other events - (void)endIgnoringInteractionEvents; - (BOOL)isIgnoringInteractionEvents; // returns YES if we are at least one deep in ignoring events @property(nonatomic,getter=isIdleTimerDisabled) BOOL idleTimerDisabled; // default is NO - (BOOL)openURL:(NSURL*)url; - (BOOL)canOpenURL:(NSURL *)url NS_AVAILABLE_IOS(3_0); - (void)sendEvent:(UIEvent *)event; @property(nonatomic,readonly) UIWindow *keyWindow; @property(nonatomic,readonly) NSArray *windows; - (BOOL)sendAction:(SEL)action to:(id)target from:(id)sender forEvent:(UIEvent *)event; @property(nonatomic,getter=isNetworkActivityIndicatorVisible) BOOL networkActivityIndicatorVisible; // showing network spinning gear in status bar. default is NO @property(nonatomic) UIStatusBarStyle statusBarStyle; // default is UIStatusBarStyleDefault - (void)setStatusBarStyle:(UIStatusBarStyle)statusBarStyle animated:(BOOL)animated; @property(nonatomic,getter=isStatusBarHidden) BOOL statusBarHidden; - (void)setStatusBarHidden:(BOOL)hidden withAnimation:(UIStatusBarAnimation)animation NS_AVAILABLE_IOS(3_2); // Rotate to a specific orientation. This only rotates the status bar and updates the statusBarOrientation property. // This does not change automatically if the device changes orientation. // Explicit setting of the status bar orientation is more limited in iOS 6.0 and later. @property(nonatomic) UIInterfaceOrientation statusBarOrientation; - (void)setStatusBarOrientation:(UIInterfaceOrientation)interfaceOrientation animated:(BOOL)animated; // The system only calls this method if the application delegate has not // implemented the delegate equivalent. It returns the orientations specified by // the application's info.plist. If no supported interface orientations were // specified it will return UIInterfaceOrientationMaskAll on an iPad and // UIInterfaceOrientationMaskAllButUpsideDown on a phone. The return value // should be one of the UIInterfaceOrientationMask values which indicates the // orientations supported by this application. - (NSUInteger)supportedInterfaceOrientationsForWindow:(UIWindow *)window NS_AVAILABLE_IOS(6_0); @property(nonatomic,readonly) NSTimeInterval statusBarOrientationAnimationDuration; // Returns the animation duration for the status bar during a 90 degree orientation change. It should be doubled for a 180 degree orientation change. @property(nonatomic,readonly) CGRect statusBarFrame; // returns CGRectZero if the status bar is hidden @property(nonatomic) NSInteger applicationIconBadgeNumber; // set to 0 to hide. default is 0 @property(nonatomic) BOOL applicationSupportsShakeToEdit NS_AVAILABLE_IOS(3_0); @property(nonatomic,readonly) UIApplicationState applicationState NS_AVAILABLE_IOS(4_0); @property(nonatomic,readonly) NSTimeInterval backgroundTimeRemaining NS_AVAILABLE_IOS(4_0); - (UIBackgroundTaskIdentifier)beginBackgroundTaskWithExpirationHandler:(void(^)(void))handler NS_AVAILABLE_IOS(4_0); - (void)endBackgroundTask:(UIBackgroundTaskIdentifier)identifier NS_AVAILABLE_IOS(4_0); - (BOOL)setKeepAliveTimeout:(NSTimeInterval)timeout handler:(void(^)(void))keepAliveHandler NS_AVAILABLE_IOS(4_0); - (void)clearKeepAliveTimeout NS_AVAILABLE_IOS(4_0); @property(nonatomic,readonly,getter=isProtectedDataAvailable) BOOL protectedDataAvailable NS_AVAILABLE_IOS(4_0); @property(nonatomic,readonly) UIUserInterfaceLayoutDirection userInterfaceLayoutDirection NS_AVAILABLE_IOS(5_0); @end @interface UIApplication (UIRemoteNotifications) - (void)registerForRemoteNotificationTypes:(UIRemoteNotificationType)types NS_AVAILABLE_IOS(3_0); - (void)unregisterForRemoteNotifications NS_AVAILABLE_IOS(3_0); // calls -registerForRemoteNotificationTypes with UIRemoteNotificationTypeNone // returns the enabled types, also taking into account any systemwide settings; doesn't relate to connectivity - (UIRemoteNotificationType)enabledRemoteNotificationTypes NS_AVAILABLE_IOS(3_0); @end @interface UIApplication (UILocalNotifications) - (void)presentLocalNotificationNow:(UILocalNotification *)notification NS_AVAILABLE_IOS(4_0); - (void)scheduleLocalNotification:(UILocalNotification *)notification NS_AVAILABLE_IOS(4_0); // copies notification - (void)cancelLocalNotification:(UILocalNotification *)notification NS_AVAILABLE_IOS(4_0); - (void)cancelAllLocalNotifications NS_AVAILABLE_IOS(4_0); @property(nonatomic,copy) NSArray *scheduledLocalNotifications NS_AVAILABLE_IOS(4_0); // setter added in iOS 4.2 @end @interface UIApplication (UIRemoteControlEvents) - (void)beginReceivingRemoteControlEvents NS_AVAILABLE_IOS(4_0); - (void)endReceivingRemoteControlEvents NS_AVAILABLE_IOS(4_0); @end @interface UIApplication (UINewsstand) - (void)setNewsstandIconImage:(UIImage *)image; @end @interface UIApplication (UIStateRestoration) // These methods are used to inform the system that state restoration is occuring asynchronously after the application // has processed its restoration archive on launch. In the even of a crash, the system will be able to detect that it may // have been caused by a bad restoration archive and arrange to ignore it on a subsequent application launch. - (void)extendStateRestoration NS_AVAILABLE_IOS(6_0); - (void)completeStateRestoration NS_AVAILABLE_IOS(6_0); @end @protocol UIApplicationDelegate @optional - (void)applicationDidFinishLaunching:(UIApplication *)application; - (BOOL)application:(UIApplication *)application willFinishLaunchingWithOptions:(NSDictionary *)launchOptions NS_AVAILABLE_IOS(6_0); - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions NS_AVAILABLE_IOS(3_0); - (void)applicationDidBecomeActive:(UIApplication *)application; - (void)applicationWillResignActive:(UIApplication *)application; - (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url; // Will be deprecated at some point, please replace with application:openURL:sourceApplication:annotation: - (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation NS_AVAILABLE_IOS(4_2); // no equiv. notification. return NO if the application can't open for some reason - (void)applicationDidReceiveMemoryWarning:(UIApplication *)application; // try to clean up as much memory as possible. next step is to terminate app - (void)applicationWillTerminate:(UIApplication *)application; - (void)applicationSignificantTimeChange:(UIApplication *)application; // midnight, carrier time update, daylight savings time change - (void)application:(UIApplication *)application willChangeStatusBarOrientation:(UIInterfaceOrientation)newStatusBarOrientation duration:(NSTimeInterval)duration; - (void)application:(UIApplication *)application didChangeStatusBarOrientation:(UIInterfaceOrientation)oldStatusBarOrientation; - (void)application:(UIApplication *)application willChangeStatusBarFrame:(CGRect)newStatusBarFrame; // in screen coordinates - (void)application:(UIApplication *)application didChangeStatusBarFrame:(CGRect)oldStatusBarFrame; // one of these will be called after calling -registerForRemoteNotifications - (void)application:(UIApplication *)application didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken NS_AVAILABLE_IOS(3_0); - (void)application:(UIApplication *)application didFailToRegisterForRemoteNotificationsWithError:(NSError *)error NS_AVAILABLE_IOS(3_0); - (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo NS_AVAILABLE_IOS(3_0); - (void)application:(UIApplication *)application didReceiveLocalNotification:(UILocalNotification *)notification NS_AVAILABLE_IOS(4_0); - (void)applicationDidEnterBackground:(UIApplication *)application NS_AVAILABLE_IOS(4_0); - (void)applicationWillEnterForeground:(UIApplication *)application NS_AVAILABLE_IOS(4_0); - (void)applicationProtectedDataWillBecomeUnavailable:(UIApplication *)application NS_AVAILABLE_IOS(4_0); - (void)applicationProtectedDataDidBecomeAvailable:(UIApplication *)application NS_AVAILABLE_IOS(4_0); @property (nonatomic, retain) UIWindow *window NS_AVAILABLE_IOS(5_0); - (NSUInteger)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window NS_AVAILABLE_IOS(6_0); #pragma mark -- State Restoration protocol adopted by UIApplication delegate -- - (UIViewController *) application:(UIApplication *)application viewControllerWithRestorationIdentifierPath:(NSArray *)identifierComponents coder:(NSCoder *)coder NS_AVAILABLE_IOS(6_0); - (BOOL) application:(UIApplication *)application shouldSaveApplicationState:(NSCoder *)coder NS_AVAILABLE_IOS(6_0); - (BOOL) application:(UIApplication *)application shouldRestoreApplicationState:(NSCoder *)coder NS_AVAILABLE_IOS(6_0); - (void) application:(UIApplication *)application willEncodeRestorableStateWithCoder:(NSCoder *)coder NS_AVAILABLE_IOS(6_0); - (void) application:(UIApplication *)application didDecodeRestorableStateWithCoder:(NSCoder *)coder NS_AVAILABLE_IOS(6_0); @end @interface UIApplication(UIApplicationDeprecated) @property(nonatomic,getter=isProximitySensingEnabled) BOOL proximitySensingEnabled NS_DEPRECATED_IOS(2_0, 3_0); // default is NO. see UIDevice for replacement - (void)setStatusBarHidden:(BOOL)hidden animated:(BOOL)animated NS_DEPRECATED_IOS(2_0, 3_2); // use -setStatusBarHidden:withAnimation: @end // If nil is specified for principalClassName, the value for NSPrincipalClass from the Info.plist is used. If there is no // NSPrincipalClass key specified, the UIApplication class is used. The delegate class will be instantiated using init. UIKIT_EXTERN int UIApplicationMain(int argc, char *argv[], NSString *principalClassName, NSString *delegateClassName); UIKIT_EXTERN NSString *const UITrackingRunLoopMode; // These notifications are sent out after the equivalent delegate message is called UIKIT_EXTERN NSString *const UIApplicationDidEnterBackgroundNotification NS_AVAILABLE_IOS(4_0); UIKIT_EXTERN NSString *const UIApplicationWillEnterForegroundNotification NS_AVAILABLE_IOS(4_0); UIKIT_EXTERN NSString *const UIApplicationDidFinishLaunchingNotification; UIKIT_EXTERN NSString *const UIApplicationDidBecomeActiveNotification; UIKIT_EXTERN NSString *const UIApplicationWillResignActiveNotification; UIKIT_EXTERN NSString *const UIApplicationDidReceiveMemoryWarningNotification; UIKIT_EXTERN NSString *const UIApplicationWillTerminateNotification; UIKIT_EXTERN NSString *const UIApplicationSignificantTimeChangeNotification; UIKIT_EXTERN NSString *const UIApplicationWillChangeStatusBarOrientationNotification; // userInfo contains NSNumber with new orientation UIKIT_EXTERN NSString *const UIApplicationDidChangeStatusBarOrientationNotification; // userInfo contains NSNumber with old orientation UIKIT_EXTERN NSString *const UIApplicationStatusBarOrientationUserInfoKey; // userInfo dictionary key for status bar orientation UIKIT_EXTERN NSString *const UIApplicationWillChangeStatusBarFrameNotification; // userInfo contains NSValue with new frame UIKIT_EXTERN NSString *const UIApplicationDidChangeStatusBarFrameNotification; // userInfo contains NSValue with old frame UIKIT_EXTERN NSString *const UIApplicationStatusBarFrameUserInfoKey; // userInfo dictionary key for status bar frame UIKIT_EXTERN NSString *const UIApplicationLaunchOptionsURLKey NS_AVAILABLE_IOS(3_0); // userInfo contains NSURL with launch URL UIKIT_EXTERN NSString *const UIApplicationLaunchOptionsSourceApplicationKey NS_AVAILABLE_IOS(3_0); // userInfo contains NSString with launch app bundle ID UIKIT_EXTERN NSString *const UIApplicationLaunchOptionsRemoteNotificationKey NS_AVAILABLE_IOS(3_0); // userInfo contains NSDictionary with payload UIKIT_EXTERN NSString *const UIApplicationLaunchOptionsLocalNotificationKey NS_AVAILABLE_IOS(4_0); // userInfo contains a UILocalNotification UIKIT_EXTERN NSString *const UIApplicationLaunchOptionsAnnotationKey NS_AVAILABLE_IOS(3_2); // userInfo contains object with annotation property list UIKIT_EXTERN NSString *const UIApplicationProtectedDataWillBecomeUnavailable NS_AVAILABLE_IOS(4_0); UIKIT_EXTERN NSString *const UIApplicationProtectedDataDidBecomeAvailable NS_AVAILABLE_IOS(4_0); UIKIT_EXTERN NSString *const UIApplicationLaunchOptionsLocationKey NS_AVAILABLE_IOS(4_0); // app was launched in response to a CoreLocation event. UIKIT_EXTERN NSString *const UIApplicationLaunchOptionsNewsstandDownloadsKey NS_AVAILABLE_IOS(5_0); // userInfo contains an NSArray of NKAssetDownload identifiers // // UIBarButtonItem.h // UIKit // // Copyright (c) 2008-2012, Apple Inc. All rights reserved. // #import #import #import #import #import #import typedef NS_ENUM(NSInteger, UIBarMetrics) { UIBarMetricsDefault, UIBarMetricsLandscapePhone, }; typedef NS_ENUM(NSInteger, UIBarButtonItemStyle) { UIBarButtonItemStylePlain, // shows glow when pressed UIBarButtonItemStyleBordered, UIBarButtonItemStyleDone, }; typedef NS_ENUM(NSInteger, UIBarButtonSystemItem) { UIBarButtonSystemItemDone, UIBarButtonSystemItemCancel, UIBarButtonSystemItemEdit, UIBarButtonSystemItemSave, UIBarButtonSystemItemAdd, UIBarButtonSystemItemFlexibleSpace, UIBarButtonSystemItemFixedSpace, UIBarButtonSystemItemCompose, UIBarButtonSystemItemReply, UIBarButtonSystemItemAction, UIBarButtonSystemItemOrganize, UIBarButtonSystemItemBookmarks, UIBarButtonSystemItemSearch, UIBarButtonSystemItemRefresh, UIBarButtonSystemItemStop, UIBarButtonSystemItemCamera, UIBarButtonSystemItemTrash, UIBarButtonSystemItemPlay, UIBarButtonSystemItemPause, UIBarButtonSystemItemRewind, UIBarButtonSystemItemFastForward, #if __IPHONE_3_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED UIBarButtonSystemItemUndo, UIBarButtonSystemItemRedo, #endif #if __IPHONE_4_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED UIBarButtonSystemItemPageCurl, #endif }; @class UIImage, UIView; NS_CLASS_AVAILABLE_IOS(2_0) @interface UIBarButtonItem : UIBarItem { @private NSString *_title; NSSet *_possibleTitles; SEL _action; id _target; UIImage *_image; UIImage *_landscapeImagePhone; UIEdgeInsets _imageInsets; UIEdgeInsets _landscapeImagePhoneInsets; CGFloat _width; UIView *_view; NSInteger _tag; id _appearanceStorage; struct { unsigned int enabled:1; unsigned int style:3; unsigned int isSystemItem:1; unsigned int systemItem:7; unsigned int viewIsCustom:1; unsigned int isMinibarView:1; unsigned int disableAutosizing:1; unsigned int selected:1; unsigned int imageHasEffects:1; } _barButtonItemFlags; } - (id)initWithImage:(UIImage *)image style:(UIBarButtonItemStyle)style target:(id)target action:(SEL)action; - (id)initWithImage:(UIImage *)image landscapeImagePhone:(UIImage *)landscapeImagePhone style:(UIBarButtonItemStyle)style target:(id)target action:(SEL)action NS_AVAILABLE_IOS(5_0); // landscapeImagePhone will be used for the bar button image in landscape bars in UIUserInterfaceIdiomPhone only - (id)initWithTitle:(NSString *)title style:(UIBarButtonItemStyle)style target:(id)target action:(SEL)action; - (id)initWithBarButtonSystemItem:(UIBarButtonSystemItem)systemItem target:(id)target action:(SEL)action; - (id)initWithCustomView:(UIView *)customView; @property(nonatomic) UIBarButtonItemStyle style; // default is UIBarButtonItemStylePlain @property(nonatomic) CGFloat width; // default is 0.0 @property(nonatomic,copy) NSSet *possibleTitles; // default is nil @property(nonatomic,retain) UIView *customView; // default is nil @property(nonatomic) SEL action; // default is NULL @property(nonatomic,assign) id target; // default is nil // // Appearance modifiers // /* Send these messages to the [UIBarButtonItem appearance] proxy to customize all buttons, or, to customize a specific button, send them to a specific UIBarButtonItem instance, which may be used in all the usual places in a UINavigationItem (backBarButtonItem, leftBarButtonItem, rightBarButtonItem) or a UIToolbar. */ /* In general, you should specify a value for the normal state to be used by other states which don't have a custom value set. Similarly, when a property is dependent on the bar metrics (on the iPhone in landscape orientation, bars have a different height from standard), be sure to specify a value for UIBarMetricsDefault. This sets the background image for buttons of any style. */ - (void)setBackgroundImage:(UIImage *)backgroundImage forState:(UIControlState)state barMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; - (UIImage *)backgroundImageForState:(UIControlState)state barMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; /* This sets the background image for buttons with a specific style. When calling this on a UIBarButtonItem instance, the style argument must match the button's style; when calling on the UIAppearance proxy, any style may be passed. */ - (void)setBackgroundImage:(UIImage *)backgroundImage forState:(UIControlState)state style:(UIBarButtonItemStyle)style barMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR; - (UIImage *)backgroundImageForState:(UIControlState)state style:(UIBarButtonItemStyle)style barMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR; @property(nonatomic,retain) UIColor *tintColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; /* For adjusting the vertical centering of bordered bar buttons within the bar */ - (void)setBackgroundVerticalPositionAdjustment:(CGFloat)adjustment forBarMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; - (CGFloat)backgroundVerticalPositionAdjustmentForBarMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; /* For adjusting the position of a title (if any) within a bordered bar button */ - (void)setTitlePositionAdjustment:(UIOffset)adjustment forBarMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; - (UIOffset)titlePositionAdjustmentForBarMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; /* The remaining appearance modifiers apply solely to UINavigationBar back buttons and are ignored by other buttons. */ /* backgroundImage must be a resizable image for good results. */ - (void)setBackButtonBackgroundImage:(UIImage *)backgroundImage forState:(UIControlState)state barMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; - (UIImage *)backButtonBackgroundImageForState:(UIControlState)state barMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; - (void)setBackButtonTitlePositionAdjustment:(UIOffset)adjustment forBarMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; - (UIOffset)backButtonTitlePositionAdjustmentForBarMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; /* For adjusting the vertical centering of bordered bar buttons within the bar */ - (void)setBackButtonBackgroundVerticalPositionAdjustment:(CGFloat)adjustment forBarMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; - (CGFloat)backButtonBackgroundVerticalPositionAdjustmentForBarMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; @end // // UIBarItem.h // UIKit // // Copyright (c) 2008-2012, Apple Inc. All rights reserved. // #import #import #import #import #import @class UIImage; NS_CLASS_AVAILABLE_IOS(2_0) @interface UIBarItem : NSObject { @private } @property(nonatomic,getter=isEnabled) BOOL enabled; // default is YES @property(nonatomic,copy) NSString *title; // default is nil @property(nonatomic,retain) UIImage *image; // default is nil @property(nonatomic,retain) UIImage *landscapeImagePhone NS_AVAILABLE_IOS(5_0); // default is nil @property(nonatomic) UIEdgeInsets imageInsets; // default is UIEdgeInsetsZero @property(nonatomic) UIEdgeInsets landscapeImagePhoneInsets NS_AVAILABLE_IOS(5_0); // default is UIEdgeInsetsZero. These insets apply only when the landscapeImagePhone property is set. @property(nonatomic) NSInteger tag; // default is 0 /* You may specify the font, text color, text shadow color, and text shadow offset for the title in the text attributes dictionary, using the keys found in UIStringDrawing.h. */ - (void)setTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; - (NSDictionary *)titleTextAttributesForState:(UIControlState)state NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; @end // // UIBezierPath.h // UIKit // // Copyright (c) 2009-2012, Apple Inc. All rights reserved. // #import #import #import typedef NS_OPTIONS(NSUInteger, UIRectCorner) { UIRectCornerTopLeft = 1 << 0, UIRectCornerTopRight = 1 << 1, UIRectCornerBottomLeft = 1 << 2, UIRectCornerBottomRight = 1 << 3, UIRectCornerAllCorners = ~0UL }; NS_CLASS_AVAILABLE_IOS(3_2) @interface UIBezierPath : NSObject { @private CGPathRef _path; CGFloat *_lineDashPattern; NSUInteger _lineDashPatternCount; CGFloat _lineWidth, _miterLimit, _flatness, _lineDashPhase; CGLineCap _lineCapStyle; CGLineJoin _lineJoinStyle; BOOL _usesEvenOddFillRule; CGPathRef _immutablePath; BOOL _immutablePathIsValid; } + (UIBezierPath *)bezierPath; + (UIBezierPath *)bezierPathWithRect:(CGRect)rect; + (UIBezierPath *)bezierPathWithOvalInRect:(CGRect)rect; + (UIBezierPath *)bezierPathWithRoundedRect:(CGRect)rect cornerRadius:(CGFloat)cornerRadius; // rounds all corners with the same horizontal and vertical radius + (UIBezierPath *)bezierPathWithRoundedRect:(CGRect)rect byRoundingCorners:(UIRectCorner)corners cornerRadii:(CGSize)cornerRadii; + (UIBezierPath *)bezierPathWithArcCenter:(CGPoint)center radius:(CGFloat)radius startAngle:(CGFloat)startAngle endAngle:(CGFloat)endAngle clockwise:(BOOL)clockwise; + (UIBezierPath *)bezierPathWithCGPath:(CGPathRef)CGPath; // Returns an immutable CGPathRef which is only valid until the UIBezierPath is further mutated. // Setting the path will create an immutable copy of the provided CGPathRef, so any further mutations on a provided CGMutablePathRef will be ignored. @property(nonatomic) CGPathRef CGPath; // Path construction - (void)moveToPoint:(CGPoint)point; - (void)addLineToPoint:(CGPoint)point; - (void)addCurveToPoint:(CGPoint)endPoint controlPoint1:(CGPoint)controlPoint1 controlPoint2:(CGPoint)controlPoint2; - (void)addQuadCurveToPoint:(CGPoint)endPoint controlPoint:(CGPoint)controlPoint; - (void)addArcWithCenter:(CGPoint)center radius:(CGFloat)radius startAngle:(CGFloat)startAngle endAngle:(CGFloat)endAngle clockwise:(BOOL)clockwise NS_AVAILABLE_IOS(4_0); - (void)closePath; - (void)removeAllPoints; // Appending paths - (void)appendPath:(UIBezierPath *)bezierPath; // Modified paths - (UIBezierPath *)bezierPathByReversingPath NS_AVAILABLE_IOS(6_0); // Transforming paths - (void)applyTransform:(CGAffineTransform)transform; // Path info @property(readonly,getter=isEmpty) BOOL empty; @property(nonatomic,readonly) CGRect bounds; @property(nonatomic,readonly) CGPoint currentPoint; - (BOOL)containsPoint:(CGPoint)point; // Drawing properties @property(nonatomic) CGFloat lineWidth; @property(nonatomic) CGLineCap lineCapStyle; @property(nonatomic) CGLineJoin lineJoinStyle; @property(nonatomic) CGFloat miterLimit; // Used when lineJoinStyle is kCGLineJoinMiter @property(nonatomic) CGFloat flatness; @property(nonatomic) BOOL usesEvenOddFillRule; // Default is NO. When YES, the even-odd fill rule is used for drawing, clipping, and hit testing. - (void)setLineDash:(const CGFloat *)pattern count:(NSInteger)count phase:(CGFloat)phase; - (void)getLineDash:(CGFloat *)pattern count:(NSInteger *)count phase:(CGFloat *)phase; // Path operations on the current graphics context - (void)fill; - (void)stroke; // These methods do not affect the blend mode or alpha of the current graphics context - (void)fillWithBlendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha; - (void)strokeWithBlendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha; - (void)addClip; @end // // UIButton.h // UIKit // // Copyright (c) 2005-2012, Apple Inc. All rights reserved. // #import #import #import #import #import @class UIImage, UIFont, UIColor, UIImageView, UILabel; typedef NS_ENUM(NSInteger, UIButtonType) { UIButtonTypeCustom = 0, // no button type UIButtonTypeRoundedRect, // rounded rect, flat white button, like in address card UIButtonTypeDetailDisclosure, UIButtonTypeInfoLight, UIButtonTypeInfoDark, UIButtonTypeContactAdd, }; NS_CLASS_AVAILABLE_IOS(2_0) @interface UIButton : UIControl { @private CFMutableDictionaryRef _contentLookup; UIEdgeInsets _contentEdgeInsets; UIEdgeInsets _titleEdgeInsets; UIEdgeInsets _imageEdgeInsets; UIImageView *_backgroundView; UIImageView *_imageView; UILabel *_titleView; BOOL _initialized; struct { unsigned int reversesTitleShadowWhenHighlighted:1; unsigned int adjustsImageWhenHighlighted:1; unsigned int adjustsImageWhenDisabled:1; unsigned int autosizeToFit:1; unsigned int disabledDimsImage:1; unsigned int showsTouchWhenHighlighted:1; unsigned int buttonType:8; unsigned int shouldHandleScrollerMouseEvent:1; } _buttonFlags; } + (id)buttonWithType:(UIButtonType)buttonType; @property(nonatomic) UIEdgeInsets contentEdgeInsets; // default is UIEdgeInsetsZero @property(nonatomic) UIEdgeInsets titleEdgeInsets; // default is UIEdgeInsetsZero @property(nonatomic) BOOL reversesTitleShadowWhenHighlighted; // default is NO. if YES, shadow reverses to shift between engrave and emboss appearance @property(nonatomic) UIEdgeInsets imageEdgeInsets; // default is UIEdgeInsetsZero @property(nonatomic) BOOL adjustsImageWhenHighlighted; // default is YES. if YES, image is drawn darker when highlighted(pressed) @property(nonatomic) BOOL adjustsImageWhenDisabled; // default is YES. if YES, image is drawn lighter when disabled @property(nonatomic) BOOL showsTouchWhenHighlighted; // default is NO. if YES, show a simple feedback (currently a glow) while highlighted @property(nonatomic,retain) UIColor *tintColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; // default is nil. only valid for some button types @property(nonatomic,readonly) UIButtonType buttonType; // you can set the image, title color, title shadow color, and background image to use for each state. you can specify data // for a combined state by using the flags added together. in general, you should specify a value for the normal state to be used // by other states which don't have a custom value set - (void)setTitle:(NSString *)title forState:(UIControlState)state; // default is nil. title is assumed to be single line - (void)setTitleColor:(UIColor *)color forState:(UIControlState)state; // default if nil. use opaque white - (void)setTitleShadowColor:(UIColor *)color forState:(UIControlState)state; // default is nil. use 50% black - (void)setImage:(UIImage *)image forState:(UIControlState)state; // default is nil. should be same size if different for different states - (void)setBackgroundImage:(UIImage *)image forState:(UIControlState)state; // default is nil - (void)setAttributedTitle:(NSAttributedString *)title forState:(UIControlState)state NS_AVAILABLE_IOS(6_0); // default is nil. title is assumed to be single line - (NSString *)titleForState:(UIControlState)state; // these getters only take a single state value - (UIColor *)titleColorForState:(UIControlState)state; - (UIColor *)titleShadowColorForState:(UIControlState)state; - (UIImage *)imageForState:(UIControlState)state; - (UIImage *)backgroundImageForState:(UIControlState)state; - (NSAttributedString *)attributedTitleForState:(UIControlState)state NS_AVAILABLE_IOS(6_0); // these are the values that will be used for the current state. you can also use these for overrides. a heuristic will be used to // determine what image to choose based on the explict states set. For example, the 'normal' state value will be used for all states // that don't have their own image defined. @property(nonatomic,readonly,retain) NSString *currentTitle; // normal/highlighted/selected/disabled. can return nil @property(nonatomic,readonly,retain) UIColor *currentTitleColor; // normal/highlighted/selected/disabled. always returns non-nil. default is white(1,1) @property(nonatomic,readonly,retain) UIColor *currentTitleShadowColor; // normal/highlighted/selected/disabled. default is white(0,0.5). @property(nonatomic,readonly,retain) UIImage *currentImage; // normal/highlighted/selected/disabled. can return nil @property(nonatomic,readonly,retain) UIImage *currentBackgroundImage; // normal/highlighted/selected/disabled. can return nil @property(nonatomic,readonly,retain) NSAttributedString *currentAttributedTitle NS_AVAILABLE_IOS(6_0); // normal/highlighted/selected/disabled. can return nil // return title and image views. will always create them if necessary. always returns nil for system buttons @property(nonatomic,readonly,retain) UILabel *titleLabel NS_AVAILABLE_IOS(3_0); @property(nonatomic,readonly,retain) UIImageView *imageView NS_AVAILABLE_IOS(3_0); // these return the rectangle for the background (assumes bounds), the content (image + title) and for the image and title separately. the content rect is calculated based // on the title and image size and padding and then adjusted based on the control content alignment. there are no draw methods since the contents // are rendered in separate subviews (UIImageView, UILabel) - (CGRect)backgroundRectForBounds:(CGRect)bounds; - (CGRect)contentRectForBounds:(CGRect)bounds; - (CGRect)titleRectForContentRect:(CGRect)contentRect; - (CGRect)imageRectForContentRect:(CGRect)contentRect; @end @interface UIButton(UIButtonDeprecated) @property(nonatomic,retain) UIFont *font NS_DEPRECATED_IOS(2_0, 3_0); @property(nonatomic) NSLineBreakMode lineBreakMode NS_DEPRECATED_IOS(2_0, 3_0); @property(nonatomic) CGSize titleShadowOffset NS_DEPRECATED_IOS(2_0, 3_0); @end // // UICollectionView.h // UIKit // // Copyright (c) 2011 Apple Inc. All rights reserved. // #import #import #import typedef NS_OPTIONS(NSUInteger, UICollectionViewScrollPosition) { UICollectionViewScrollPositionNone = 0, // The vertical positions are mutually exclusive to each other, but are bitwise or-able with the horizontal scroll positions. // Combining positions from the same grouping (horizontal or vertical) will result in an NSInvalidArgumentException. UICollectionViewScrollPositionTop = 1 << 0, UICollectionViewScrollPositionCenteredVertically = 1 << 1, UICollectionViewScrollPositionBottom = 1 << 2, // Likewise, the horizontal positions are mutually exclusive to each other. UICollectionViewScrollPositionLeft = 1 << 3, UICollectionViewScrollPositionCenteredHorizontally = 1 << 4, UICollectionViewScrollPositionRight = 1 << 5 }; @class UICollectionView; @class UICollectionViewCell; @class UICollectionViewLayout; @class UICollectionViewLayoutAttributes; @class UITouch; @class UINib; @class UICollectionReusableView; @protocol UICollectionViewDataSource @required - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section; // The cell that is returned must be retrieved from a call to -dequeueReusableCellWithReuseIdentifier:forIndexPath: - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath; @optional - (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView; // The view that is returned must be retrieved from a call to -dequeueReusableSupplementaryViewOfKind:withReuseIdentifier:forIndexPath: - (UICollectionReusableView *)collectionView:(UICollectionView *)collectionView viewForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath; @end @protocol UICollectionViewDelegate @optional // Methods for notification of selection/deselection and highlight/unhighlight events. // The sequence of calls leading to selection from a user touch is: // // (when the touch begins) // 1. -collectionView:shouldHighlightItemAtIndexPath: // 2. -collectionView:didHighlightItemAtIndexPath: // // (when the touch lifts) // 3. -collectionView:shouldSelectItemAtIndexPath: or -collectionView:shouldDeselectItemAtIndexPath: // 4. -collectionView:didSelectItemAtIndexPath: or -collectionView:didDeselectItemAtIndexPath: // 5. -collectionView:didUnhighlightItemAtIndexPath: - (BOOL)collectionView:(UICollectionView *)collectionView shouldHighlightItemAtIndexPath:(NSIndexPath *)indexPath; - (void)collectionView:(UICollectionView *)collectionView didHighlightItemAtIndexPath:(NSIndexPath *)indexPath; - (void)collectionView:(UICollectionView *)collectionView didUnhighlightItemAtIndexPath:(NSIndexPath *)indexPath; - (BOOL)collectionView:(UICollectionView *)collectionView shouldSelectItemAtIndexPath:(NSIndexPath *)indexPath; - (BOOL)collectionView:(UICollectionView *)collectionView shouldDeselectItemAtIndexPath:(NSIndexPath *)indexPath; // called when the user taps on an already-selected item in multi-select mode - (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath; - (void)collectionView:(UICollectionView *)collectionView didDeselectItemAtIndexPath:(NSIndexPath *)indexPath; - (void)collectionView:(UICollectionView *)collectionView didEndDisplayingCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath; - (void)collectionView:(UICollectionView *)collectionView didEndDisplayingSupplementaryView:(UICollectionReusableView *)view forElementOfKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)indexPath; // These methods provide support for copy/paste actions on cells. // All three should be implemented if any are. - (BOOL)collectionView:(UICollectionView *)collectionView shouldShowMenuForItemAtIndexPath:(NSIndexPath *)indexPath; - (BOOL)collectionView:(UICollectionView *)collectionView canPerformAction:(SEL)action forItemAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender; - (void)collectionView:(UICollectionView *)collectionView performAction:(SEL)action forItemAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender; @end NS_CLASS_AVAILABLE_IOS(6_0) @interface UICollectionView : UIScrollView - (id)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout; // the designated initializer @property (nonatomic, retain) UICollectionViewLayout *collectionViewLayout; @property (nonatomic, assign) id delegate; @property (nonatomic, assign) id dataSource; @property (nonatomic, retain) UIView *backgroundView; // will be automatically resized to track the size of the collection view and placed behind all cells and supplementary views. // For each reuse identifier that the collection view will use, register either a class or a nib from which to instantiate a cell. // If a nib is registered, it must contain exactly 1 top level object which is a UICollectionViewCell. // If a class is registered, it will be instantiated via alloc/initWithFrame: - (void)registerClass:(Class)cellClass forCellWithReuseIdentifier:(NSString *)identifier; - (void)registerNib:(UINib *)nib forCellWithReuseIdentifier:(NSString *)identifier; - (void)registerClass:(Class)viewClass forSupplementaryViewOfKind:(NSString *)elementKind withReuseIdentifier:(NSString *)identifier; - (void)registerNib:(UINib *)nib forSupplementaryViewOfKind:(NSString *)kind withReuseIdentifier:(NSString *)identifier; - (id)dequeueReusableCellWithReuseIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath*)indexPath; - (id)dequeueReusableSupplementaryViewOfKind:(NSString*)elementKind withReuseIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath*)indexPath; // These properties control whether items can be selected, and if so, whether multiple items can be simultaneously selected. @property (nonatomic) BOOL allowsSelection; // default is YES @property (nonatomic) BOOL allowsMultipleSelection; // default is NO - (NSArray *)indexPathsForSelectedItems; // returns nil or an array of selected index paths - (void)selectItemAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UICollectionViewScrollPosition)scrollPosition; - (void)deselectItemAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated; - (void)reloadData; // discard the dataSource and delegate data and requery as necessary - (void)setCollectionViewLayout:(UICollectionViewLayout *)layout animated:(BOOL)animated; // transition from one layout to another // Information about the current state of the collection view. - (NSInteger)numberOfSections; - (NSInteger)numberOfItemsInSection:(NSInteger)section; - (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath; - (UICollectionViewLayoutAttributes *)layoutAttributesForSupplementaryElementOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath; - (NSIndexPath *)indexPathForItemAtPoint:(CGPoint)point; - (NSIndexPath *)indexPathForCell:(UICollectionViewCell *)cell; - (UICollectionViewCell *)cellForItemAtIndexPath:(NSIndexPath *)indexPath; - (NSArray *)visibleCells; - (NSArray *)indexPathsForVisibleItems; // Interacting with the collection view. - (void)scrollToItemAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UICollectionViewScrollPosition)scrollPosition animated:(BOOL)animated; // These methods allow dynamic modification of the current set of items in the collection view - (void)insertSections:(NSIndexSet *)sections; - (void)deleteSections:(NSIndexSet *)sections; - (void)reloadSections:(NSIndexSet *)sections; - (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection; - (void)insertItemsAtIndexPaths:(NSArray *)indexPaths; - (void)deleteItemsAtIndexPaths:(NSArray *)indexPaths; - (void)reloadItemsAtIndexPaths:(NSArray *)indexPaths; - (void)moveItemAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath; - (void)performBatchUpdates:(void (^)(void))updates completion:(void (^)(BOOL finished))completion; // allows multiple insert/delete/reload/move calls to be animated simultaneously. Nestable. @end @interface NSIndexPath (UICollectionViewAdditions) + (NSIndexPath *)indexPathForItem:(NSInteger)item inSection:(NSInteger)section; @property (nonatomic, readonly) NSInteger item; @end // // UICollectionViewCell.h // UIKit // // Copyright (c) 2011 Apple Inc. All rights reserved. // #import #import #import @class UICollectionViewLayout; @class UICollectionView; @class UICollectionViewLayoutAttributes; @class UILongPressGestureRecognizer; NS_CLASS_AVAILABLE_IOS(6_0) @interface UICollectionReusableView : UIView @property (nonatomic, readonly, copy) NSString *reuseIdentifier; // Override point. // Called by the collection view before the instance is returned from the reuse queue. // Subclassers must call super. - (void)prepareForReuse; // Classes that want to support custom layout attributes specific to a given UICollectionViewLayout subclass can apply them here. // This allows the view to work in conjunction with a layout class that returns a custom subclass of UICollectionViewLayoutAttributes from -layoutAttributesForItem: or the corresponding layoutAttributesForHeader/Footer methods. // -applyLayoutAttributes: is then called after the view is added to the collection view and just before the view is sent to the delegate in the appropriate collectionView:configureXXX method. - (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes; // Override these methods to provide custom UI for specific layouts. - (void)willTransitionFromLayout:(UICollectionViewLayout *)oldLayout toLayout:(UICollectionViewLayout *)newLayout; - (void)didTransitionFromLayout:(UICollectionViewLayout *)oldLayout toLayout:(UICollectionViewLayout *)newLayout; @end NS_CLASS_AVAILABLE_IOS(6_0) @interface UICollectionViewCell : UICollectionReusableView @property (nonatomic, readonly) UIView *contentView; // add custom subviews to the cell's contentView // Cells become highlighted when the user touches them. // The selected state is toggled when the user lifts up from a highlighted cell. // Override these methods to provide custom UI for a selected or highlighted state. // The collection view may call the setters inside an animation block. @property (nonatomic, getter=isSelected) BOOL selected; @property (nonatomic, getter=isHighlighted) BOOL highlighted; // The background view is a subview behind all other views. // If selectedBackgroundView is different than backgroundView, it will be placed above the background view and animated in on selection. @property (nonatomic, retain) UIView *backgroundView; @property (nonatomic, retain) UIView *selectedBackgroundView; @end // // UICollectionViewController.h // UIKit // // Copyright (c) 2011 Apple Inc. All rights reserved. // #import #import #import @class UICollectionViewLayout; @class UICollectionViewController; NS_CLASS_AVAILABLE_IOS(6_0) @interface UICollectionViewController : UIViewController - (id)initWithCollectionViewLayout:(UICollectionViewLayout *)layout; @property (nonatomic, retain) UICollectionView *collectionView; @property (nonatomic) BOOL clearsSelectionOnViewWillAppear; // defaults to YES, and if YES, any selection is cleared in viewWillAppear: @end // // UICollectionViewFlowLayout.h // UIKit // // Copyright (c) 2011 Apple Inc. All rights reserved. // #import #import #import #import UIKIT_EXTERN NSString *const UICollectionElementKindSectionHeader; UIKIT_EXTERN NSString *const UICollectionElementKindSectionFooter; typedef NS_ENUM(NSInteger, UICollectionViewScrollDirection) { UICollectionViewScrollDirectionVertical, UICollectionViewScrollDirectionHorizontal }; @protocol UICollectionViewDelegateFlowLayout @optional - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath; - (UIEdgeInsets)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout insetForSectionAtIndex:(NSInteger)section; - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section; - (CGFloat)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section; - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForHeaderInSection:(NSInteger)section; - (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout referenceSizeForFooterInSection:(NSInteger)section; @end NS_CLASS_AVAILABLE_IOS(6_0) @interface UICollectionViewFlowLayout : UICollectionViewLayout @property (nonatomic) CGFloat minimumLineSpacing; @property (nonatomic) CGFloat minimumInteritemSpacing; @property (nonatomic) CGSize itemSize; @property (nonatomic) UICollectionViewScrollDirection scrollDirection; // default is UICollectionViewScrollDirectionVertical @property (nonatomic) CGSize headerReferenceSize; @property (nonatomic) CGSize footerReferenceSize; @property (nonatomic) UIEdgeInsets sectionInset; @end // // UICollectionViewLayout.h // UIKit // // Copyright (c) 2011 Apple Inc. All rights reserved. // #import #import #import #import // The UICollectionViewLayout class is provided as an abstract class for subclassing to define custom collection layouts. // Defining a custom layout is an advanced operation intended for applications with complex needs. typedef NS_ENUM(NSUInteger, UICollectionElementCategory) { UICollectionElementCategoryCell, UICollectionElementCategorySupplementaryView, UICollectionElementCategoryDecorationView }; @class UICollectionViewLayoutAttributes; @class UICollectionView; @class UINib; NS_CLASS_AVAILABLE_IOS(6_0) @interface UICollectionViewLayoutAttributes : NSObject @property (nonatomic) CGRect frame; @property (nonatomic) CGPoint center; @property (nonatomic) CGSize size; @property (nonatomic) CATransform3D transform3D; @property (nonatomic) CGFloat alpha; @property (nonatomic) NSInteger zIndex; // default is 0 @property (nonatomic, getter=isHidden) BOOL hidden; // As an optimization, UICollectionView might not create a view for items whose hidden attribute is YES @property (nonatomic, retain) NSIndexPath *indexPath; @property (nonatomic, readonly) UICollectionElementCategory representedElementCategory; @property (nonatomic, readonly) NSString *representedElementKind; // nil when representedElementCategory is UICollectionElementCategoryCell + (instancetype)layoutAttributesForCellWithIndexPath:(NSIndexPath *)indexPath; + (instancetype)layoutAttributesForSupplementaryViewOfKind:(NSString *)elementKind withIndexPath:(NSIndexPath *)indexPath; + (instancetype)layoutAttributesForDecorationViewOfKind:(NSString *)decorationViewKind withIndexPath:(NSIndexPath*)indexPath; @end typedef NS_ENUM(NSInteger, UICollectionUpdateAction) { UICollectionUpdateActionInsert, UICollectionUpdateActionDelete, UICollectionUpdateActionReload, UICollectionUpdateActionMove, UICollectionUpdateActionNone }; NS_CLASS_AVAILABLE_IOS(6_0) @interface UICollectionViewUpdateItem : NSObject @property (nonatomic, readonly) NSIndexPath *indexPathBeforeUpdate; // nil for UICollectionUpdateActionInsert @property (nonatomic, readonly) NSIndexPath *indexPathAfterUpdate; // nil for UICollectionUpdateActionDelete @property (nonatomic, readonly) UICollectionUpdateAction updateAction; @end NS_CLASS_AVAILABLE_IOS(6_0) @interface UICollectionViewLayout : NSObject // Methods in this class are meant to be overridden and will be called by its collection view to gather layout information. // To get the truth on the current state of the collection view, call methods on UICollectionView rather than these. @property (nonatomic, readonly) UICollectionView *collectionView; // Call -invalidateLayout to indicate that the collection view needs to requery the layout information. // Subclasses must always call super if they override. - (void)invalidateLayout; - (void)registerClass:(Class)viewClass forDecorationViewOfKind:(NSString *)decorationViewKind; - (void)registerNib:(UINib *)nib forDecorationViewOfKind:(NSString *)decorationViewKind; @end @interface UICollectionViewLayout (SubclassingHooks) + (Class)layoutAttributesClass; // override this method to provide a custom class to be used when instantiating instances of UICollectionViewLayoutAttributes // The collection view calls -prepareLayout once at its first layout as the first message to the layout instance. // The collection view calls -prepareLayout again after layout is invalidated and before requerying the layout information. // Subclasses should always call super if they override. - (void)prepareLayout; // UICollectionView calls these four methods to determine the layout information. // Implement -layoutAttributesForElementsInRect: to return layout attributes for for supplementary or decoration views, or to perform layout in an as-needed-on-screen fashion. // Additionally, all layout subclasses should implement -layoutAttributesForItemAtIndexPath: to return layout attributes instances on demand for specific index paths. // If the layout supports any supplementary or decoration view types, it should also implement the respective atIndexPath: methods for those types. - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect; // return an array layout attributes instances for all the views in the given rect - (UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath; - (UICollectionViewLayoutAttributes *)layoutAttributesForSupplementaryViewOfKind:(NSString *)kind atIndexPath:(NSIndexPath *)indexPath; - (UICollectionViewLayoutAttributes *)layoutAttributesForDecorationViewOfKind:(NSString*)decorationViewKind atIndexPath:(NSIndexPath *)indexPath; - (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds; // return YES to cause the collection view to requery the layout for geometry information - (CGPoint)targetContentOffsetForProposedContentOffset:(CGPoint)proposedContentOffset withScrollingVelocity:(CGPoint)velocity; // return a point at which to rest after scrolling - for layouts that want snap-to-point scrolling behavior - (CGSize)collectionViewContentSize; // Subclasses must override this method and use it to return the width and height of the collection view’s content. These values represent the width and height of all the content, not just the content that is currently visible. The collection view uses this information to configure its own content size to facilitate scrolling. @end @interface UICollectionViewLayout (UpdateSupportHooks) // This method is called when there is an update with deletes/inserts to the collection view. // It will be called prior to calling the initial/final layout attribute methods below to give the layout an opportunity to do batch computations for the insertion and deletion layout attributes. // The updateItems parameter is an array of UICollectionViewUpdateItem instances for each element that is moving to a new index path. - (void)prepareForCollectionViewUpdates:(NSArray *)updateItems; - (void)finalizeCollectionViewUpdates; // called inside an animation block after the update - (void)prepareForAnimatedBoundsChange:(CGRect)oldBounds; // UICollectionView calls this when its bounds have changed inside an animation block before displaying cells in its new bounds - (void)finalizeAnimatedBoundsChange; // also called inside the animation block // This set of methods is called when the collection view undergoes an animated transition such as a batch update block or an animated bounds change. // For each element on screen before the invalidation, finalLayoutAttributesForDisappearingXXX will be called and an animation setup from what is on screen to those final attributes. // For each element on screen after the invalidation, initialLayoutAttributesForAppearingXXX will be called an an animation setup from those initial attributes to what ends up on screen. - (UICollectionViewLayoutAttributes *)initialLayoutAttributesForAppearingItemAtIndexPath:(NSIndexPath *)itemIndexPath; - (UICollectionViewLayoutAttributes *)finalLayoutAttributesForDisappearingItemAtIndexPath:(NSIndexPath *)itemIndexPath; - (UICollectionViewLayoutAttributes *)initialLayoutAttributesForAppearingSupplementaryElementOfKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)elementIndexPath; - (UICollectionViewLayoutAttributes *)finalLayoutAttributesForDisappearingSupplementaryElementOfKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)elementIndexPath; - (UICollectionViewLayoutAttributes *)initialLayoutAttributesForAppearingDecorationElementOfKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)decorationIndexPath; - (UICollectionViewLayoutAttributes *)finalLayoutAttributesForDisappearingDecorationElementOfKind:(NSString *)elementKind atIndexPath:(NSIndexPath *)decorationIndexPath; @end // // UIColor.h // UIKit // // Copyright (c) 2005-2012, Apple Inc. All rights reserved. // #import #import #import #import @class UIImage; NS_CLASS_AVAILABLE_IOS(2_0) @interface UIColor : NSObject { @private } // Convenience methods for creating autoreleased colors + (UIColor *)colorWithWhite:(CGFloat)white alpha:(CGFloat)alpha; + (UIColor *)colorWithHue:(CGFloat)hue saturation:(CGFloat)saturation brightness:(CGFloat)brightness alpha:(CGFloat)alpha; + (UIColor *)colorWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha; + (UIColor *)colorWithCGColor:(CGColorRef)cgColor; + (UIColor *)colorWithPatternImage:(UIImage *)image; + (UIColor *)colorWithCIColor:(CIColor *)ciColor NS_AVAILABLE_IOS(5_0); // Initializers for creating non-autoreleased colors - (UIColor *)initWithWhite:(CGFloat)white alpha:(CGFloat)alpha; - (UIColor *)initWithHue:(CGFloat)hue saturation:(CGFloat)saturation brightness:(CGFloat)brightness alpha:(CGFloat)alpha; - (UIColor *)initWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue alpha:(CGFloat)alpha; - (UIColor *)initWithCGColor:(CGColorRef)cgColor; - (UIColor *)initWithPatternImage:(UIImage*)image; - (UIColor *)initWithCIColor:(CIColor *)ciColor NS_AVAILABLE_IOS(5_0); // Some convenience methods to create colors. These colors will be as calibrated as possible. // These colors are cached. + (UIColor *)blackColor; // 0.0 white + (UIColor *)darkGrayColor; // 0.333 white + (UIColor *)lightGrayColor; // 0.667 white + (UIColor *)whiteColor; // 1.0 white + (UIColor *)grayColor; // 0.5 white + (UIColor *)redColor; // 1.0, 0.0, 0.0 RGB + (UIColor *)greenColor; // 0.0, 1.0, 0.0 RGB + (UIColor *)blueColor; // 0.0, 0.0, 1.0 RGB + (UIColor *)cyanColor; // 0.0, 1.0, 1.0 RGB + (UIColor *)yellowColor; // 1.0, 1.0, 0.0 RGB + (UIColor *)magentaColor; // 1.0, 0.0, 1.0 RGB + (UIColor *)orangeColor; // 1.0, 0.5, 0.0 RGB + (UIColor *)purpleColor; // 0.5, 0.0, 0.5 RGB + (UIColor *)brownColor; // 0.6, 0.4, 0.2 RGB + (UIColor *)clearColor; // 0.0 white, 0.0 alpha // Set the color: Sets the fill and stroke colors in the current drawing context. Should be implemented by subclassers. - (void)set; // Set the fill or stroke colors individually. These should be implemented by subclassers. - (void)setFill; - (void)setStroke; // Convenience methods for getting components. // If the receiver is of a compatible color space, any non-NULL parameters are populated and 'YES' is returned. Otherwise, the parameters are left unchanged and 'NO' is returned. - (BOOL)getWhite:(CGFloat *)white alpha:(CGFloat *)alpha NS_AVAILABLE_IOS(5_0); - (BOOL)getHue:(CGFloat *)hue saturation:(CGFloat *)saturation brightness:(CGFloat *)brightness alpha:(CGFloat *)alpha NS_AVAILABLE_IOS(5_0); - (BOOL)getRed:(CGFloat *)red green:(CGFloat *)green blue:(CGFloat *)blue alpha:(CGFloat *)alpha NS_AVAILABLE_IOS(5_0); // Returns a color in the same color space as the receiver with the specified alpha component. - (UIColor *)colorWithAlphaComponent:(CGFloat)alpha; // Access the underlying CGColor or CIColor. @property(nonatomic,readonly) CGColorRef CGColor; @property(nonatomic,readonly) CIColor *CIColor; @end @interface CIColor(UIKitAdditions) - (id)initWithColor:(UIColor *)color NS_AVAILABLE_IOS(5_0); @end // // UIControl.h // UIKit // // Copyright (c) 2005-2012, Apple Inc. All rights reserved. // #import #import #import typedef NS_OPTIONS(NSUInteger, UIControlEvents) { UIControlEventTouchDown = 1 << 0, // on all touch downs UIControlEventTouchDownRepeat = 1 << 1, // on multiple touchdowns (tap count > 1) UIControlEventTouchDragInside = 1 << 2, UIControlEventTouchDragOutside = 1 << 3, UIControlEventTouchDragEnter = 1 << 4, UIControlEventTouchDragExit = 1 << 5, UIControlEventTouchUpInside = 1 << 6, UIControlEventTouchUpOutside = 1 << 7, UIControlEventTouchCancel = 1 << 8, UIControlEventValueChanged = 1 << 12, // sliders, etc. UIControlEventEditingDidBegin = 1 << 16, // UITextField UIControlEventEditingChanged = 1 << 17, UIControlEventEditingDidEnd = 1 << 18, UIControlEventEditingDidEndOnExit = 1 << 19, // 'return key' ending editing UIControlEventAllTouchEvents = 0x00000FFF, // for touch events UIControlEventAllEditingEvents = 0x000F0000, // for UITextField UIControlEventApplicationReserved = 0x0F000000, // range available for application use UIControlEventSystemReserved = 0xF0000000, // range reserved for internal framework use UIControlEventAllEvents = 0xFFFFFFFF }; typedef NS_ENUM(NSInteger, UIControlContentVerticalAlignment) { UIControlContentVerticalAlignmentCenter = 0, UIControlContentVerticalAlignmentTop = 1, UIControlContentVerticalAlignmentBottom = 2, UIControlContentVerticalAlignmentFill = 3, }; typedef NS_ENUM(NSInteger, UIControlContentHorizontalAlignment) { UIControlContentHorizontalAlignmentCenter = 0, UIControlContentHorizontalAlignmentLeft = 1, UIControlContentHorizontalAlignmentRight = 2, UIControlContentHorizontalAlignmentFill = 3, }; typedef NS_OPTIONS(NSUInteger, UIControlState) { UIControlStateNormal = 0, UIControlStateHighlighted = 1 << 0, // used when UIControl isHighlighted is set UIControlStateDisabled = 1 << 1, UIControlStateSelected = 1 << 2, // flag usable by app (see below) UIControlStateApplication = 0x00FF0000, // additional flags available for application use UIControlStateReserved = 0xFF000000 // flags reserved for internal framework use }; @class UITouch; @class UIEvent; //______________________________________________________ NS_CLASS_AVAILABLE_IOS(2_0) @interface UIControl : UIView { @package NSMutableArray* _targetActions; CGPoint _previousPoint; CFAbsoluteTime _downTime; struct { unsigned int disabled:1; unsigned int tracking:1; unsigned int touchInside:1; unsigned int touchDragged:1; unsigned int requiresDisplayOnTracking:1; unsigned int highlighted:1; unsigned int dontHighlightOnTouchDown:1; unsigned int delayActions:1; unsigned int allowActionsToQueue:1; unsigned int pendingUnhighlight:1; unsigned int selected:1; unsigned int verticalAlignment:2; unsigned int horizontalAlignment:2; } _controlFlags; } @property(nonatomic,getter=isEnabled) BOOL enabled; // default is YES. if NO, ignores touch events and subclasses may draw differently @property(nonatomic,getter=isSelected) BOOL selected; // default is NO may be used by some subclasses or by application @property(nonatomic,getter=isHighlighted) BOOL highlighted; // default is NO. this gets set/cleared automatically when touch enters/exits during tracking and cleared on up @property(nonatomic) UIControlContentVerticalAlignment contentVerticalAlignment; // how to position content vertically inside control. default is center @property(nonatomic) UIControlContentHorizontalAlignment contentHorizontalAlignment; // how to position content hozontally inside control. default is center @property(nonatomic,readonly) UIControlState state; // could be more than one state (e.g. disabled|selected). synthesized from other flags. @property(nonatomic,readonly,getter=isTracking) BOOL tracking; @property(nonatomic,readonly,getter=isTouchInside) BOOL touchInside; // valid during tracking only - (BOOL)beginTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event; - (BOOL)continueTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event; - (void)endTrackingWithTouch:(UITouch *)touch withEvent:(UIEvent *)event; - (void)cancelTrackingWithEvent:(UIEvent *)event; // event may be nil if cancelled for non-event reasons, e.g. removed from window // add target/action for particular event. you can call this multiple times and you can specify multiple target/actions for a particular event. // passing in nil as the target goes up the responder chain. The action may optionally include the sender and the event in that order // the action cannot be NULL. Note that the target is not retained. - (void)addTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents; // remove the target/action for a set of events. pass in NULL for the action to remove all actions for that target - (void)removeTarget:(id)target action:(SEL)action forControlEvents:(UIControlEvents)controlEvents; // get info about target & actions. this makes it possible to enumerate all target/actions by checking for each event kind - (NSSet *)allTargets; // set may include NSNull to indicate at least one nil target - (UIControlEvents)allControlEvents; // list of all events that have at least one action - (NSArray *)actionsForTarget:(id)target forControlEvent:(UIControlEvents)controlEvent; // single event. returns NSArray of NSString selector names. returns nil if none // send the action. the first method is called for the event and is a point at which you can observe or override behavior. it is called repeately by the second. - (void)sendAction:(SEL)action to:(id)target forEvent:(UIEvent *)event; - (void)sendActionsForControlEvents:(UIControlEvents)controlEvents; // send all actions associated with events @end // // UIDataDetectors.h // UIKit // // Copyright (c) 2009-2012, Apple Inc. All rights reserved. // typedef NS_OPTIONS(NSUInteger, UIDataDetectorTypes) { UIDataDetectorTypePhoneNumber = 1 << 0, // Phone number detection UIDataDetectorTypeLink = 1 << 1, // URL detection #if __IPHONE_4_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED UIDataDetectorTypeAddress = 1 << 2, // Street address detection UIDataDetectorTypeCalendarEvent = 1 << 3, // Event detection #endif UIDataDetectorTypeNone = 0, // No detection at all UIDataDetectorTypeAll = NSUIntegerMax // All types }; // // UIDatePicker.h // UIKit // // Copyright (c) 2006-2012, Apple Inc. All rights reserved. // #import #import #import typedef NS_ENUM(NSInteger, UIDatePickerMode) { UIDatePickerModeTime, // Displays hour, minute, and optionally AM/PM designation depending on the locale setting (e.g. 6 | 53 | PM) UIDatePickerModeDate, // Displays month, day, and year depending on the locale setting (e.g. November | 15 | 2007) UIDatePickerModeDateAndTime, // Displays date, hour, minute, and optionally AM/PM designation depending on the locale setting (e.g. Wed Nov 15 | 6 | 53 | PM) UIDatePickerModeCountDownTimer // Displays hour and minute (e.g. 1 | 53) }; NS_CLASS_AVAILABLE_IOS(2_0) @interface UIDatePicker : UIControl @property(nonatomic) UIDatePickerMode datePickerMode; // default is UIDatePickerModeDateAndTime @property(nonatomic,retain) NSLocale *locale; // default is [NSLocale currentLocale]. setting nil returns to default @property(nonatomic,copy) NSCalendar *calendar; // default is [NSCalendar currentCalendar]. setting nil returns to default @property(nonatomic,retain) NSTimeZone *timeZone; // default is nil. use current time zone or time zone from calendar @property(nonatomic,retain) NSDate *date; // default is current date when picker created. Ignored in countdown timer mode. for that mode, picker starts at 0:00 @property(nonatomic,retain) NSDate *minimumDate; // specify min/max date range. default is nil. When min > max, the values are ignored. Ignored in countdown timer mode @property(nonatomic,retain) NSDate *maximumDate; // default is nil @property(nonatomic) NSTimeInterval countDownDuration; // for UIDatePickerModeCountDownTimer, ignored otherwise. default is 0.0. limit is 23:59 (86,399 seconds) @property(nonatomic) NSInteger minuteInterval; // display minutes wheel with interval. interval must be evenly divided into 60. default is 1. min is 1, max is 30 - (void)setDate:(NSDate *)date animated:(BOOL)animated; // if animated is YES, animate the wheels of time to display the new date @end // // UIDevice.h // UIKit // // Copyright (c) 2007-2012, Apple Inc. All rights reserved. // #import #import typedef NS_ENUM(NSInteger, UIDeviceOrientation) { UIDeviceOrientationUnknown, UIDeviceOrientationPortrait, // Device oriented vertically, home button on the bottom UIDeviceOrientationPortraitUpsideDown, // Device oriented vertically, home button on the top UIDeviceOrientationLandscapeLeft, // Device oriented horizontally, home button on the right UIDeviceOrientationLandscapeRight, // Device oriented horizontally, home button on the left UIDeviceOrientationFaceUp, // Device oriented flat, face up UIDeviceOrientationFaceDown // Device oriented flat, face down }; typedef NS_ENUM(NSInteger, UIDeviceBatteryState) { UIDeviceBatteryStateUnknown, UIDeviceBatteryStateUnplugged, // on battery, discharging UIDeviceBatteryStateCharging, // plugged in, less than 100% UIDeviceBatteryStateFull, // plugged in, at 100% }; // available in iPhone 3.0 typedef NS_ENUM(NSInteger, UIUserInterfaceIdiom) { #if __IPHONE_3_2 <= __IPHONE_OS_VERSION_MAX_ALLOWED UIUserInterfaceIdiomPhone, // iPhone and iPod touch style UI UIUserInterfaceIdiomPad, // iPad style UI #endif }; /* The UI_USER_INTERFACE_IDIOM() macro is provided for use when deploying to a version of the iOS less than 3.2. If the earliest version of iPhone/iOS that you will be deploying for is 3.2 or greater, you may use -[UIDevice userInterfaceIdiom] directly. */ #define UI_USER_INTERFACE_IDIOM() ([[UIDevice currentDevice] respondsToSelector:@selector(userInterfaceIdiom)] ? [[UIDevice currentDevice] userInterfaceIdiom] : UIUserInterfaceIdiomPhone) #define UIDeviceOrientationIsPortrait(orientation) ((orientation) == UIDeviceOrientationPortrait || (orientation) == UIDeviceOrientationPortraitUpsideDown) #define UIDeviceOrientationIsLandscape(orientation) ((orientation) == UIDeviceOrientationLandscapeLeft || (orientation) == UIDeviceOrientationLandscapeRight) NS_CLASS_AVAILABLE_IOS(2_0) @interface UIDevice : NSObject { @private NSInteger _numDeviceOrientationObservers; float _batteryLevel; struct { unsigned int batteryMonitoringEnabled:1; unsigned int proximityMonitoringEnabled:1; unsigned int expectsFaceContactInLandscape:1; unsigned int orientation:3; unsigned int batteryState:2; unsigned int proximityState:1; } _deviceFlags; } + (UIDevice *)currentDevice; @property(nonatomic,readonly,retain) NSString *name; // e.g. "My iPhone" @property(nonatomic,readonly,retain) NSString *model; // e.g. @"iPhone", @"iPod touch" @property(nonatomic,readonly,retain) NSString *localizedModel; // localized version of model @property(nonatomic,readonly,retain) NSString *systemName; // e.g. @"iOS" @property(nonatomic,readonly,retain) NSString *systemVersion; // e.g. @"4.0" @property(nonatomic,readonly) UIDeviceOrientation orientation; // return current device orientation. this will return UIDeviceOrientationUnknown unless device orientation notifications are being generated. @property(nonatomic,readonly,retain) NSString *uniqueIdentifier NS_DEPRECATED_IOS(2_0, 5_0); // a string unique to each device based on various hardware info. @property(nonatomic,readonly,retain) NSUUID *identifierForVendor NS_AVAILABLE_IOS(6_0); // a UUID that may be used to uniquely identify the device, same across apps from a single vendor. @property(nonatomic,readonly,getter=isGeneratingDeviceOrientationNotifications) BOOL generatesDeviceOrientationNotifications; - (void)beginGeneratingDeviceOrientationNotifications; // nestable - (void)endGeneratingDeviceOrientationNotifications; @property(nonatomic,getter=isBatteryMonitoringEnabled) BOOL batteryMonitoringEnabled NS_AVAILABLE_IOS(3_0); // default is NO @property(nonatomic,readonly) UIDeviceBatteryState batteryState NS_AVAILABLE_IOS(3_0); // UIDeviceBatteryStateUnknown if monitoring disabled @property(nonatomic,readonly) float batteryLevel NS_AVAILABLE_IOS(3_0); // 0 .. 1.0. -1.0 if UIDeviceBatteryStateUnknown @property(nonatomic,getter=isProximityMonitoringEnabled) BOOL proximityMonitoringEnabled NS_AVAILABLE_IOS(3_0); // default is NO @property(nonatomic,readonly) BOOL proximityState NS_AVAILABLE_IOS(3_0); // always returns NO if no proximity detector @property(nonatomic,readonly,getter=isMultitaskingSupported) BOOL multitaskingSupported NS_AVAILABLE_IOS(4_0); @property(nonatomic,readonly) UIUserInterfaceIdiom userInterfaceIdiom NS_AVAILABLE_IOS(3_2); - (void)playInputClick NS_AVAILABLE_IOS(4_2); // Plays a click only if an enabling input view is on-screen and user has enabled input clicks. @end @protocol UIInputViewAudioFeedback @optional @property (nonatomic, readonly) BOOL enableInputClicksWhenVisible; // If YES, an input view will enable playInputClick. @end UIKIT_EXTERN NSString *const UIDeviceOrientationDidChangeNotification; UIKIT_EXTERN NSString *const UIDeviceBatteryStateDidChangeNotification NS_AVAILABLE_IOS(3_0); UIKIT_EXTERN NSString *const UIDeviceBatteryLevelDidChangeNotification NS_AVAILABLE_IOS(3_0); UIKIT_EXTERN NSString *const UIDeviceProximityStateDidChangeNotification NS_AVAILABLE_IOS(3_0); // // UIDocument.h // UIKit // // Copyright (c) 1997-2012, Apple Inc. All rights reserved. // #import #import typedef NS_ENUM(NSInteger, UIDocumentChangeKind) { UIDocumentChangeDone, UIDocumentChangeUndone, UIDocumentChangeRedone, UIDocumentChangeCleared }; typedef NS_ENUM(NSInteger, UIDocumentSaveOperation) { UIDocumentSaveForCreating, UIDocumentSaveForOverwriting }; typedef NS_OPTIONS(NSUInteger, UIDocumentState) { UIDocumentStateNormal = 0, UIDocumentStateClosed = 1 << 0, // The document has either not been successfully opened, or has been since closed. Document properties may not be valid. UIDocumentStateInConflict = 1 << 1, // Conflicts exist for the document's fileURL. They can be accessed through +[NSFileVersion otherVersionsOfItemAtURL:]. UIDocumentStateSavingError = 1 << 2, // An error has occurred that prevents the document from saving. UIDocumentStateEditingDisabled = 1 << 3 // Set before calling -disableEditing. The document is is busy and it is not currently safe to allow user edits. -enableEditing will be called when it becomes safe to edit again. }; UIKIT_EXTERN NSString *const UIDocumentStateChangedNotification NS_AVAILABLE_IOS(5_0); NS_CLASS_AVAILABLE_IOS(5_0) @interface UIDocument : NSObject { @private NSURL *_fileURL; NSString *_fileType; NSString* _localizedName; NSUndoManager *_undoManager; NSDate *_fileModificationDate; dispatch_queue_t _fileAccessQueue; dispatch_queue_t _openingQueue; dispatch_semaphore_t _fileAccessSemaphore; NSOperationQueue *_filePresenterQueue; id _differenceDueToRecentChanges; id _differenceSincePreservingPreviousVersion; id _differenceSinceSaving; NSTimer *_autosavingTimer; CFAbsoluteTime _lastSaveTime; NSUInteger _fileContentsPreservationReason; CFAbsoluteTime _lastPreservationTime; id _versionWithoutRecentChanges; NSMutableArray *_versions; void *_conflictObserver; NSLock* _documentPropertyLock; id _alertPresenter; struct __docFlags { unsigned int inClose:1; unsigned int isOpen:1; unsigned int inOpen:1; unsigned int isAutosavingBecauseOfTimer:1; unsigned int versionWithoutRecentChangesIsNotLastOpened:1; unsigned int ignoreUndoAndRedoNotifications:1; unsigned int editingDisabled:1; unsigned int isRegisteredAsFilePresenter:1; unsigned int movingFile:1; unsigned int savingError:1; unsigned int inConflict:1; } _docFlags; } #pragma mark *** Initialization *** // The designated initializer. Passing an empty URL will cause this method to throw an NSInvalidArgumentException. - (id)initWithFileURL:(NSURL *)url; #pragma mark *** Attributes Applicable to Every Kind of Document *** // UIKit may call these methods on background threads, so subclasses that override them must have thread safe implementations. // These values will be set by UIKit before the completion handlers to the opening, reverting, and saving methods are called. // Clients that wish to access these properties outside of an open, save, or revert completion handler and wait for any pending file operations should wrap the accesses in -performAsynchronousFileAccessUsingBlock: @property(readonly) NSURL *fileURL; @property(readonly, copy) NSString *localizedName; // The default implementation derives the name from the URL. Subclasses may override to provide a custom name for presentation to the user, such as in error strings. @property(readonly, copy) NSString *fileType; // The file's UTI. Derived from the fileURL by default. @property(copy) NSDate *fileModificationDate; // The last known modification date of the document's on-disk representation. Updated by openWithCompletionHandler:, revertToContentsOfURL:, and saveToURL: and will return nil if none of these has completed successfully at least once. @property(readonly) UIDocumentState documentState; #pragma mark *** Opening and Closing *** // Subclassing this method without calling super should be avoided. Subclassers who don't call super must use NSFileCoordinator for coordinated reading themselves. // Open the document located by the fileURL. This will call readFromURL:error: on a background queue and then invoke the completionHandler on the current dispatch queue when openWithCompletionHandler: is invoked. - (void)openWithCompletionHandler:(void (^)(BOOL success))completionHandler; // Close the document. The default implementation calls [self autosaveWithCompletionHandler:completionHandler] which will save if [self hasUnsavedChanges] returns YES. - (void)closeWithCompletionHandler:(void (^)(BOOL success))completionHandler; #pragma mark *** Simple Reading and Writing *** // These methods will be all most apps need to access files. Applications with complex reading and writing needs should see the Advanced Reading and Writing section below. // Typical subclasses will implement this method to do reading. UIKit will pass NSData typed contents for flat files and NSFileWrapper typed contents for file packages. // typeName is the UTI of the loaded file. - (BOOL)loadFromContents:(id)contents ofType:(NSString *)typeName error:(NSError **)outError; // Typical subclasses will implement this method and return an NSFileWrapper or NSData encapsulating a snapshot of their data to be written to disk during saving. // Subclasses that return something other than a valid NSFileWrapper or NSData instance, or don't override this method must override one of the writing methods in the Advanced Saving section to write data to disk. - (id)contentsForType:(NSString *)typeName error:(NSError **)outError; #pragma mark *** Disabling and Enabling Editing // Subclasses should override these methods so that they do not allow the user to edit the document between calls to -disableEditing and -enableEditing. // UIKit will call -disableEditing when it is unsafe to make changes to the document, such as during a close or revert, and call -enableEditing when it is safe again. // The default implementation of these methods do nothing. - (void)disableEditing; - (void)enableEditing; #pragma mark *** Change Management *** // The document's undo manager. Setting the undo manager also registers the document as an observer of various NSUndoManager notifications so that -updateChangeCount: is invoked as undoable changes are made to the document. // Asking for the undo manager creates a default one if one is not already set. // Typically, when a subclass sets the undoManager, it does not need to override -hasUnsavedChanges or call updateChangeCount: manually. @property(retain) NSUndoManager *undoManager; // Subclasses should generally not need to override this. Instead they should use the undoManager or call -updateChangeCount: every time they get a change and UIKit will calculate -hasUnsavedChanges automatically. // The default implementation of -autosaveWithCompletionHandler: initiates a save if [self hasUnsavedChanges] is YES. - (BOOL)hasUnsavedChanges; // Record the fact that a change affecting the value returned by -hasUnsavedChanges has occurred. Subclasses should not need to call this if they set the undoManager. - (void)updateChangeCount:(UIDocumentChangeKind)change; // Change count tokens can be used to encapsulate the record of document changes being made in a particular save. // Subclasses that don't register changes via -updateChangeCount: or by using the undoManager should implement these methods to determine if the model has new unsaved changes at the end of a save. // -changeCountTokenForSaveOperation: is called at the beginning of a save operation and the token returned is passed to -updateChangeCountWithToken:forSaveOperation: at the conclusion of a save. // The default implementation of updateChangeCountWithToken:forSaveOperation: calls [self updateChangeCount:UIDocumentChangeCleared] if no changes are made during the save. - (id)changeCountTokenForSaveOperation:(UIDocumentSaveOperation)saveOperation; - (void)updateChangeCountWithToken:(id)changeCountToken forSaveOperation:(UIDocumentSaveOperation)saveOperation; #pragma mark *** Advanced Reading and Writing *** // Subclassing this method without calling super should be avoided. Subclassers who don't call super must use NSFileCoordinator for coordinated writing themselves. // The default implementation of this method invokes [self contentsOfType:error:] synchronously on the calling queue, and then invokes [self writeContents:andAttributes:safelyToURL:ForSaveOperation:completionHandler:] on a background queue. // The completion handler is executed on the calling queue. - (void)saveToURL:(NSURL *)url forSaveOperation:(UIDocumentSaveOperation)saveOperation completionHandler:(void (^)(BOOL success))completionHandler; // Clients should not need to call this method directly. It exists as an override point for subclasses that want to do special things with autosaving. // The default implementation of this method invokes [self hasUnsavedChanges] and, if that returns YES, invokes [self saveToURL:[self fileURL] forSaveOperation:UIDocumentSaveForOverwriting completionHandler:completionHandler]. - (void)autosaveWithCompletionHandler:(void (^)(BOOL success))completionHandler; - (NSString *)savingFileType; // The default implementation returns the current file type. saveToURL: will save to an extension based on this type so subclasses can override this to allow moving the document to a new type. - (NSString *)fileNameExtensionForType:(NSString *)typeName saveOperation:(UIDocumentSaveOperation)saveOperation; // For a specified type, and a particular kind of save operation, return a file name extension that can be appended to a base file name. // This method is responsible for doing document writing in a way that minimizes the danger of leaving the disk to which writing is being done in an inconsistent state in the event of an application crash, system crash, hardware failure, power outage, etc. // Because it does several different things, and because the things are likely to change in future releases of iOS, it's probably not a good idea to override this method without invoking super. - (BOOL)writeContents:(id)contents andAttributes:(NSDictionary *)additionalFileAttributes safelyToURL:(NSURL *)url forSaveOperation:(UIDocumentSaveOperation)saveOperation error:(NSError **)outError; // Called by -writeContents:andAttributes:safelyToURL:forSaveOperation:error: to write the data to disk. Override point for subclasses that need access to the on-disk representation of the document while saving. - (BOOL)writeContents:(id)contents toURL:(NSURL *)url forSaveOperation:(UIDocumentSaveOperation)saveOperation originalContentsURL:(NSURL *)originalContentsURL error:(NSError **)outError; // Called by -saveToURL: before executing asynchronous writing to get a dictionary of attributes understood by NSFileManager for writing to the file. // The attributes are passed to -writeContents:andAttributes:safelyToURL:forSaveOperation:error: for writing to the file - (NSDictionary *)fileAttributesToWriteToURL:(NSURL *)url forSaveOperation:(UIDocumentSaveOperation)saveOperation error:(NSError **)outError; // Direct calls to this method should not be necessary for typical subclasses where the entire file is read during opening. // If direct calls are used, the client must use NSFileCoordinator API to ensure coordinated reads and performAsynchronousFileAccessUsingBlock: to serialize with any active writes. // Default implementation calls [self loadFromContents:ofType:error:] on the queue that called openWithCompletionHandler:, or the main queue if called directly, with NSData or NSFileWrapper contents. - (BOOL)readFromURL:(NSURL *)url error:(NSError **)outError; #pragma mark *** File Access Serialization *** // The default implementations of saveToURL: and openWithCompletionHandler: both use this to serialize file access. Direct calls to reading and writing methods should use this method to serialize file access on a background queue. - (void)performAsynchronousFileAccessUsingBlock:(void (^)(void))block; #pragma mark *** Error Presentation *** // These are advanced methods for dealing with errors in UIDocument. // Most clients should not need to override or call them. // Instead, they should respond to the UIDocumentStateChangedNotification to give the user the proper feedback when the document is in UIDocumentStateSavingError. // Called by the default implementations of -openWithCompletionHandler: and -saveToURL:forSaveOperation:completionHandler:. // Subclasses should call -handleError:userInteractionPermitted: with any errors that arise from direct calls to the advanced reading and writing methods that return NSErrors by indirection. // Notes for overriding: // 1. Subclasses that do not call super are responsible for calling -finishedHandlingError: when done with the error (i.e. when the app will not require any additional user feedback from the error). // 2. Subclasses that do not call super are also responsible for implementing -userInteractionNoLongerPermittedForError: to wrap up error handling immediately when required. // 3. If the userInteractionPermitted flag is NO, you should immediately handle the error and call [self finishedHandlingError:] within the context of -handleError:userInteractionPermitted: - (void)handleError:(NSError *)error userInteractionPermitted:(BOOL)userInteractionPermitted; // Called when handling of an error (including any user interaction) is complete. // Subclasses only need to call this method if they override -handleError:userInteractionPermitted: and do not call super. // If overridden, subclasses must call super - (void)finishedHandlingError:(NSError *)error recovered:(BOOL)recovered; // UIKit calls this method when it is no longer safe to proceed without immediately handling the error, such as when the app is being suspended. // Subclasses must immediately wrap up error handling (including dismissing any interactive UI) and call [self finishedHandlingError:] before returning. // It is only necessary to override this method if you override -handleError:userInteractionPermitted: without calling super - (void)userInteractionNoLongerPermittedForError:(NSError *)error; #pragma mark *** Reverting *** // Discard all unsaved document modifications and replace the document's contents by reading a file or file package located by a URL. // Default implementation calls [self disableEditing] in the beginning and [self enableEditing] on completion to indicate that the document should not accept changes from the user while this is happening. // The default implementation also calls [self openWithCompletionHandler:] after updating the fileURL. // Subclasses that override this method must call super or use NSFileCoordinator directly to initiate a coordinated read. - (void)revertToContentsOfURL:(NSURL *)url completionHandler:(void (^)(BOOL success))completionHandler; @end // // UIDocumentInteractionController.h // UIKit // // Copyright (c) 2009-2012, Apple Inc. All rights reserved. // #import #import #import #import @protocol UIDocumentInteractionControllerDelegate; @class UIImage, UIView, UIPopoverController; NS_CLASS_AVAILABLE_IOS(3_2) @interface UIDocumentInteractionController : NSObject + (UIDocumentInteractionController *)interactionControllerWithURL:(NSURL *)url; // use file to determine UTI. assumes file is complete @property(nonatomic,assign) id delegate; // default is nil @property(retain) NSURL *URL; // default is nil. if set, updates UTI, icon and name @property(nonatomic,copy) NSString *UTI; // determined from name if set, URL otherwise, override if the name or URL uses a custom scheme and the UTI can't be determined automatically @property(copy) NSString *name; // determined from URL, override if the URL uses a custom scheme and the name can't be determined automatically @property(nonatomic,readonly) NSArray *icons; // determined from name if set, URL otherwise. will return a generic document icon if an icon cannot be determined. returns an array of icons sorted from smallest to largest. @property(nonatomic,retain) id annotation; // additional plist information for application to pass to receiver (must be a plist object). default is nil. // This is the default method you should call to give your users the option to quick look, open, or copy the document. // Presents a menu allowing the user to Quick Look, open, or copy the item specified by URL. // This automatically determines the correct application or applications that can open the item at URL. // Returns NO if the options menu contained no options and was not opened. // Note that you must implement the delegate method documentInteractionControllerViewControllerForPreview: to get the Quick Look menu item. - (BOOL)presentOptionsMenuFromRect:(CGRect)rect inView:(UIView *)view animated:(BOOL)animated; - (BOOL)presentOptionsMenuFromBarButtonItem:(UIBarButtonItem *)item animated:(BOOL)animated; // Bypasses the menu and opens the full screen preview window for the item at URL. Returns NO if the item could not be previewed. // Note that you must implement the delegate method documentInteractionControllerViewControllerForPreview: to preview the document. - (BOOL)presentPreviewAnimated:(BOOL)animated; // Presents a menu allowing the user to open the document in another application. The menu // will contain all applications that can open the item at URL. // Returns NO if there are no applications that can open the item at URL. - (BOOL)presentOpenInMenuFromRect:(CGRect)rect inView:(UIView *)view animated:(BOOL)animated; - (BOOL)presentOpenInMenuFromBarButtonItem:(UIBarButtonItem *)item animated:(BOOL)animated; // Dismiss the full screen quick look window if it is visible. - (void)dismissPreviewAnimated:(BOOL)animated; // Dismiss any visible menus. - (void)dismissMenuAnimated:(BOOL)animated; // Returns an array of gesture recognizers preconfigured to manage the quick look and options menu. // These gesture recognizers should only be installed on your view when the file has been copied locally and is present at URL. @property(nonatomic,readonly) NSArray *gestureRecognizers; @end @protocol UIDocumentInteractionControllerDelegate @optional // If preview is supported, this provides the view controller on which the preview will be presented. // This method is required if preview is supported. // If presenting atop a navigation stack, provide the navigation controller in order to animate in a manner consistent with the rest of the platform. - (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller; // If preview is supported, these provide the view and rect that will be used as the starting point for the animation to the full screen preview. // The actual animation that is performed depends upon the platform and other factors. // If documentInteractionControllerRectForPreview is not implemented, the specified view's bounds will be used. // If documentInteractionControllerViewForPreview is not implemented, the preview controller will simply fade in instead of scaling up. - (CGRect)documentInteractionControllerRectForPreview:(UIDocumentInteractionController *)controller; - (UIView *)documentInteractionControllerViewForPreview:(UIDocumentInteractionController *)controller; // Preview presented/dismissed on document. Use to set up any HI underneath. - (void)documentInteractionControllerWillBeginPreview:(UIDocumentInteractionController *)controller; - (void)documentInteractionControllerDidEndPreview:(UIDocumentInteractionController *)controller; // Options menu presented/dismissed on document. Use to set up any HI underneath. - (void)documentInteractionControllerWillPresentOptionsMenu:(UIDocumentInteractionController *)controller; - (void)documentInteractionControllerDidDismissOptionsMenu:(UIDocumentInteractionController *)controller; // Open in menu presented/dismissed on document. Use to set up any HI underneath. - (void)documentInteractionControllerWillPresentOpenInMenu:(UIDocumentInteractionController *)controller; - (void)documentInteractionControllerDidDismissOpenInMenu:(UIDocumentInteractionController *)controller; // Synchronous. May be called when inside preview. Usually followed by app termination. Can use willBegin... to set annotation. - (void)documentInteractionController:(UIDocumentInteractionController *)controller willBeginSendingToApplication:(NSString *)application; // bundle ID - (void)documentInteractionController:(UIDocumentInteractionController *)controller didEndSendingToApplication:(NSString *)application; // Used to handle additional menu items that can be performed on the item specified by URL. Currently only supports the "copy:", "print:" and "saveToCameraRoll:" actions. - (BOOL)documentInteractionController:(UIDocumentInteractionController *)controller canPerformAction:(SEL)action NS_DEPRECATED_IOS(3_2, 6_0); - (BOOL)documentInteractionController:(UIDocumentInteractionController *)controller performAction:(SEL)action NS_DEPRECATED_IOS(3_2, 6_0); @end // // UIEvent.h // UIKit // // Copyright (c) 2005-2012, Apple Inc. All rights reserved. // #import #import #import @class UIWindow, UIView, UIGestureRecognizer; typedef NS_ENUM(NSInteger, UIEventType) { UIEventTypeTouches, UIEventTypeMotion, UIEventTypeRemoteControl, }; typedef NS_ENUM(NSInteger, UIEventSubtype) { // available in iPhone OS 3.0 UIEventSubtypeNone = 0, // for UIEventTypeMotion, available in iPhone OS 3.0 UIEventSubtypeMotionShake = 1, // for UIEventTypeRemoteControl, available in iOS 4.0 UIEventSubtypeRemoteControlPlay = 100, UIEventSubtypeRemoteControlPause = 101, UIEventSubtypeRemoteControlStop = 102, UIEventSubtypeRemoteControlTogglePlayPause = 103, UIEventSubtypeRemoteControlNextTrack = 104, UIEventSubtypeRemoteControlPreviousTrack = 105, UIEventSubtypeRemoteControlBeginSeekingBackward = 106, UIEventSubtypeRemoteControlEndSeekingBackward = 107, UIEventSubtypeRemoteControlBeginSeekingForward = 108, UIEventSubtypeRemoteControlEndSeekingForward = 109, }; NS_CLASS_AVAILABLE_IOS(2_0) @interface UIEvent : NSObject { @private NSTimeInterval _timestamp; } @property(nonatomic,readonly) UIEventType type NS_AVAILABLE_IOS(3_0); @property(nonatomic,readonly) UIEventSubtype subtype NS_AVAILABLE_IOS(3_0); @property(nonatomic,readonly) NSTimeInterval timestamp; - (NSSet *)allTouches; - (NSSet *)touchesForWindow:(UIWindow *)window; - (NSSet *)touchesForView:(UIView *)view; - (NSSet *)touchesForGestureRecognizer:(UIGestureRecognizer *)gesture NS_AVAILABLE_IOS(3_2); @end // // UIFont.h // UIKit // // Copyright (c) 2007-2012, Apple Inc. All rights reserved. // #import #import #import NS_CLASS_AVAILABLE_IOS(2_0) @interface UIFont : NSObject { @private } + (UIFont *)fontWithName:(NSString *)fontName size:(CGFloat)fontSize; // Returns an array of font family names for all installed fonts + (NSArray *)familyNames; // Returns an array of font names for the specified family name + (NSArray *)fontNamesForFamilyName:(NSString *)familyName; // Some convenience methods to create system fonts + (UIFont *)systemFontOfSize:(CGFloat)fontSize; + (UIFont *)boldSystemFontOfSize:(CGFloat)fontSize; + (UIFont *)italicSystemFontOfSize:(CGFloat)fontSize; // Font attributes @property(nonatomic,readonly,retain) NSString *familyName; @property(nonatomic,readonly,retain) NSString *fontName; @property(nonatomic,readonly) CGFloat pointSize; @property(nonatomic,readonly) CGFloat ascender; @property(nonatomic,readonly) CGFloat descender; @property(nonatomic,readonly) CGFloat capHeight; @property(nonatomic,readonly) CGFloat xHeight; @property(nonatomic,readonly) CGFloat lineHeight NS_AVAILABLE_IOS(4_0); // Create a new font that is identical to the current font except the specified size - (UIFont *)fontWithSize:(CGFloat)fontSize; @end @interface UIFont (UIFontDeprecated) @property(nonatomic,readonly) CGFloat leading; // use lineHeight. does not return actual leading. will be formally deprecated in future @end // // UIGeometry.h // UIKit // // Copyright (c) 2005-2012, Apple Inc. All rights reserved. // #import #import #import typedef struct UIEdgeInsets { CGFloat top, left, bottom, right; // specify amount to inset (positive) for each of the edges. values can be negative to 'outset' } UIEdgeInsets; typedef struct UIOffset { CGFloat horizontal, vertical; // specify amount to offset a position, positive for right or down, negative for left or up } UIOffset; UIKIT_STATIC_INLINE UIEdgeInsets UIEdgeInsetsMake(CGFloat top, CGFloat left, CGFloat bottom, CGFloat right) { UIEdgeInsets insets = {top, left, bottom, right}; return insets; } UIKIT_STATIC_INLINE CGRect UIEdgeInsetsInsetRect(CGRect rect, UIEdgeInsets insets) { rect.origin.x += insets.left; rect.origin.y += insets.top; rect.size.width -= (insets.left + insets.right); rect.size.height -= (insets.top + insets.bottom); return rect; } UIKIT_STATIC_INLINE UIOffset UIOffsetMake(CGFloat horizontal, CGFloat vertical) { UIOffset offset = {horizontal, vertical}; return offset; } UIKIT_STATIC_INLINE BOOL UIEdgeInsetsEqualToEdgeInsets(UIEdgeInsets insets1, UIEdgeInsets insets2) { return insets1.left == insets2.left && insets1.top == insets2.top && insets1.right == insets2.right && insets1.bottom == insets2.bottom; } UIKIT_STATIC_INLINE BOOL UIOffsetEqualToOffset(UIOffset offset1, UIOffset offset2) { return offset1.horizontal == offset2.horizontal && offset1.vertical == offset2.vertical; } UIKIT_EXTERN const UIEdgeInsets UIEdgeInsetsZero; UIKIT_EXTERN const UIOffset UIOffsetZero; UIKIT_EXTERN NSString *NSStringFromCGPoint(CGPoint point); UIKIT_EXTERN NSString *NSStringFromCGSize(CGSize size); UIKIT_EXTERN NSString *NSStringFromCGRect(CGRect rect); UIKIT_EXTERN NSString *NSStringFromCGAffineTransform(CGAffineTransform transform); UIKIT_EXTERN NSString *NSStringFromUIEdgeInsets(UIEdgeInsets insets); UIKIT_EXTERN NSString *NSStringFromUIOffset(UIOffset offset); UIKIT_EXTERN CGPoint CGPointFromString(NSString *string); UIKIT_EXTERN CGSize CGSizeFromString(NSString *string); UIKIT_EXTERN CGRect CGRectFromString(NSString *string); UIKIT_EXTERN CGAffineTransform CGAffineTransformFromString(NSString *string); UIKIT_EXTERN UIEdgeInsets UIEdgeInsetsFromString(NSString *string); UIKIT_EXTERN UIOffset UIOffsetFromString(NSString *string); @interface NSValue (NSValueUIGeometryExtensions) + (NSValue *)valueWithCGPoint:(CGPoint)point; + (NSValue *)valueWithCGSize:(CGSize)size; + (NSValue *)valueWithCGRect:(CGRect)rect; + (NSValue *)valueWithCGAffineTransform:(CGAffineTransform)transform; + (NSValue *)valueWithUIEdgeInsets:(UIEdgeInsets)insets; + (NSValue *)valueWithUIOffset:(UIOffset)insets NS_AVAILABLE_IOS(5_0); - (CGPoint)CGPointValue; - (CGSize)CGSizeValue; - (CGRect)CGRectValue; - (CGAffineTransform)CGAffineTransformValue; - (UIEdgeInsets)UIEdgeInsetsValue; - (UIOffset)UIOffsetValue NS_AVAILABLE_IOS(5_0); @end @interface NSCoder (UIGeometryKeyedCoding) - (void)encodeCGPoint:(CGPoint)point forKey:(NSString *)key; - (void)encodeCGSize:(CGSize)size forKey:(NSString *)key; - (void)encodeCGRect:(CGRect)rect forKey:(NSString *)key; - (void)encodeCGAffineTransform:(CGAffineTransform)transform forKey:(NSString *)key; - (void)encodeUIEdgeInsets:(UIEdgeInsets)insets forKey:(NSString *)key; - (void)encodeUIOffset:(UIOffset)offset forKey:(NSString *)key NS_AVAILABLE_IOS(5_0); - (CGPoint)decodeCGPointForKey:(NSString *)key; - (CGSize)decodeCGSizeForKey:(NSString *)key; - (CGRect)decodeCGRectForKey:(NSString *)key; - (CGAffineTransform)decodeCGAffineTransformForKey:(NSString *)key; - (UIEdgeInsets)decodeUIEdgeInsetsForKey:(NSString *)key; - (UIOffset)decodeUIOffsetForKey:(NSString *)key NS_AVAILABLE_IOS(5_0); @end // // UIGestureRecognizer.h // UIKit // // Copyright (c) 2008-2012, Apple Inc. All rights reserved. // #import #import #import @protocol UIGestureRecognizerDelegate; @class UIView, UIEvent, UITouch; typedef NS_ENUM(NSInteger, UIGestureRecognizerState) { UIGestureRecognizerStatePossible, // the recognizer has not yet recognized its gesture, but may be evaluating touch events. this is the default state UIGestureRecognizerStateBegan, // the recognizer has received touches recognized as the gesture. the action method will be called at the next turn of the run loop UIGestureRecognizerStateChanged, // the recognizer has received touches recognized as a change to the gesture. the action method will be called at the next turn of the run loop UIGestureRecognizerStateEnded, // the recognizer has received touches recognized as the end of the gesture. the action method will be called at the next turn of the run loop and the recognizer will be reset to UIGestureRecognizerStatePossible UIGestureRecognizerStateCancelled, // the recognizer has received touches resulting in the cancellation of the gesture. the action method will be called at the next turn of the run loop. the recognizer will be reset to UIGestureRecognizerStatePossible UIGestureRecognizerStateFailed, // the recognizer has received a touch sequence that can not be recognized as the gesture. the action method will not be called and the recognizer will be reset to UIGestureRecognizerStatePossible // Discrete Gestures – gesture recognizers that recognize a discrete event but do not report changes (for example, a tap) do not transition through the Began and Changed states and can not fail or be cancelled UIGestureRecognizerStateRecognized = UIGestureRecognizerStateEnded // the recognizer has received touches recognized as the gesture. the action method will be called at the next turn of the run loop and the recognizer will be reset to UIGestureRecognizerStatePossible }; NS_CLASS_AVAILABLE_IOS(3_2) @interface UIGestureRecognizer : NSObject { @package NSMutableArray *_targets; NSMutableArray *_delayedTouches; UIView *_view; UIEvent *_updateEvent; id _delegate; NSMutableSet *_failureRequirements; NSMutableSet *_failureDependents; NSMutableSet *_dynamicFailureRequirements; NSMutableSet *_dynamicFailureDependents; id _failureMap; NSMutableSet *_friends; UIGestureRecognizerState _state; struct { unsigned int delegateShouldBegin:1; unsigned int delegateCanPrevent:1; unsigned int delegateCanBePrevented:1; unsigned int delegateShouldRecognizeSimultaneously:1; unsigned int delegateShouldReceiveTouch:1; unsigned int delegateShouldRequireFailure:1; unsigned int delegateShouldBeRequiredToFail:1; unsigned int delegateFailed:1; unsigned int privateDelegateShouldBegin:1; unsigned int privateDelegateCanPrevent:1; unsigned int privateDelegateCanBePrevented:1; unsigned int privateDelegateShouldRecognizeSimultaneously:1; unsigned int privateDelegateShouldReceiveTouch:1; unsigned int subclassShouldRequireFailure:1; unsigned int cancelsTouchesInView:1; unsigned int delaysTouchesBegan:1; unsigned int delaysTouchesEnded:1; unsigned int disabled:1; unsigned int dirty:1; unsigned int queriedFailureRequirements:1; unsigned int delivered:1; unsigned int continuous:1; unsigned int requiresDelayedBegan:1; } _gestureFlags; } // Valid action method signatures: // -(void)handleGesture; // -(void)handleGesture:(UIGestureRecognizer*)gestureRecognizer; - (id)initWithTarget:(id)target action:(SEL)action; // default initializer - (void)addTarget:(id)target action:(SEL)action; // add a target/action pair. you can call this multiple times to specify multiple target/actions - (void)removeTarget:(id)target action:(SEL)action; // remove the specified target/action pair. passing nil for target matches all targets, and the same for actions @property(nonatomic,readonly) UIGestureRecognizerState state; // the current state of the gesture recognizer @property(nonatomic,assign) id delegate; // the gesture recognizer's delegate @property(nonatomic, getter=isEnabled) BOOL enabled; // default is YES. disabled gesture recognizers will not receive touches. when changed to NO the gesture recognizer will be cancelled if it's currently recognizing a gesture // a UIGestureRecognizer receives touches hit-tested to its view and any of that view's subviews @property(nonatomic,readonly) UIView *view; // the view the gesture is attached to. set by adding the recognizer to a UIView using the addGestureRecognizer: method @property(nonatomic) BOOL cancelsTouchesInView; // default is YES. causes touchesCancelled:withEvent: to be sent to the view for all touches recognized as part of this gesture immediately before the action method is called @property(nonatomic) BOOL delaysTouchesBegan; // default is NO. causes all touch events to be delivered to the target view only after this gesture has failed recognition. set to YES to prevent views from processing any touches that may be recognized as part of this gesture @property(nonatomic) BOOL delaysTouchesEnded; // default is YES. causes touchesEnded events to be delivered to the target view only after this gesture has failed recognition. this ensures that a touch that is part of the gesture can be cancelled if the gesture is recognized // create a relationship with another gesture recognizer that will prevent this gesture's actions from being called until otherGestureRecognizer transitions to UIGestureRecognizerStateFailed // if otherGestureRecognizer transitions to UIGestureRecognizerStateRecognized or UIGestureRecognizerStateBegan then this recognizer will instead transition to UIGestureRecognizerStateFailed // example usage: a single tap may require a double tap to fail - (void)requireGestureRecognizerToFail:(UIGestureRecognizer *)otherGestureRecognizer; // individual UIGestureRecognizer subclasses may provide subclass-specific location information. see individual subclasses for details - (CGPoint)locationInView:(UIView*)view; // a generic single-point location for the gesture. usually the centroid of the touches involved - (NSUInteger)numberOfTouches; // number of touches involved for which locations can be queried - (CGPoint)locationOfTouch:(NSUInteger)touchIndex inView:(UIView*)view; // the location of a particular touch @end @protocol UIGestureRecognizerDelegate @optional // called when a gesture recognizer attempts to transition out of UIGestureRecognizerStatePossible. returning NO causes it to transition to UIGestureRecognizerStateFailed - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer; // called when the recognition of one of gestureRecognizer or otherGestureRecognizer would be blocked by the other // return YES to allow both to recognize simultaneously. the default implementation returns NO (by default no two gestures can be recognized simultaneously) // // note: returning YES is guaranteed to allow simultaneous recognition. returning NO is not guaranteed to prevent simultaneous recognition, as the other gesture's delegate may return YES - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer; // called before touchesBegan:withEvent: is called on the gesture recognizer for a new touch. return NO to prevent the gesture recognizer from seeing this touch - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch; @end // // UIGestureRecognizerSubclass.h // UIKit // // Copyright (c) 2008-2012, Apple Inc. All rights reserved. // #import // the extensions in this header are to be used only by subclasses of UIGestureRecognizer // code that uses UIGestureRecognizers must never call these @interface UIGestureRecognizer (ForSubclassEyesOnly) // readonly for users of a gesture recognizer. may only be changed by direct subclasses of UIGestureRecognizer @property(nonatomic,readwrite) UIGestureRecognizerState state; // the current state of the gesture recognizer. can only be set by subclasses of UIGestureRecognizer, but can be read by consumers - (void)ignoreTouch:(UITouch*)touch forEvent:(UIEvent*)event; // if a touch isn't part of this gesture it can be passed to this method to be ignored. ignored touches won't be cancelled on the view even if cancelsTouchesInView is YES // the following methods are to be overridden by subclasses of UIGestureRecognizer // if you override one you must call super // called automatically by the runtime after the gesture state has been set to UIGestureRecognizerStateEnded // any internal state should be reset to prepare for a new attempt to recognize the gesture // after this is received all remaining active touches will be ignored (no further updates will be received for touches that had already begun but haven't ended) - (void)reset; // same behavior as the equivalent delegate methods, but can be used by subclasses to define class-wide prevention rules // for example, a UITapGestureRecognizer never prevents another UITapGestureRecognizer with a higher tap count - (BOOL)canPreventGestureRecognizer:(UIGestureRecognizer *)preventedGestureRecognizer; - (BOOL)canBePreventedByGestureRecognizer:(UIGestureRecognizer *)preventingGestureRecognizer; // mirror of the touch-delivery methods on UIResponder // UIGestureRecognizers aren't in the responder chain, but observe touches hit-tested to their view and their view's subviews // UIGestureRecognizers receive touches before the view to which the touch was hit-tested - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event; - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event; @end // // UIGraphics.h // UIKit // // Copyright (c) 2005-2012, Apple Inc. All rights reserved. // #import #import #import @class UIImage; UIKIT_EXTERN CGContextRef UIGraphicsGetCurrentContext(void); UIKIT_EXTERN void UIGraphicsPushContext(CGContextRef context); UIKIT_EXTERN void UIGraphicsPopContext(void); UIKIT_EXTERN void UIRectFillUsingBlendMode(CGRect rect, CGBlendMode blendMode); UIKIT_EXTERN void UIRectFill(CGRect rect); UIKIT_EXTERN void UIRectFrameUsingBlendMode(CGRect rect, CGBlendMode blendMode); UIKIT_EXTERN void UIRectFrame(CGRect rect); UIKIT_EXTERN void UIRectClip(CGRect rect); // UIImage context UIKIT_EXTERN void UIGraphicsBeginImageContext(CGSize size); UIKIT_EXTERN void UIGraphicsBeginImageContextWithOptions(CGSize size, BOOL opaque, CGFloat scale) NS_AVAILABLE_IOS(4_0); UIKIT_EXTERN UIImage* UIGraphicsGetImageFromCurrentImageContext(void); UIKIT_EXTERN void UIGraphicsEndImageContext(void); // PDF context UIKIT_EXTERN BOOL UIGraphicsBeginPDFContextToFile(NSString *path, CGRect bounds, NSDictionary *documentInfo) NS_AVAILABLE_IOS(3_2); UIKIT_EXTERN void UIGraphicsBeginPDFContextToData(NSMutableData *data, CGRect bounds, NSDictionary *documentInfo) NS_AVAILABLE_IOS(3_2); UIKIT_EXTERN void UIGraphicsEndPDFContext(void) NS_AVAILABLE_IOS(3_2); UIKIT_EXTERN void UIGraphicsBeginPDFPage(void) NS_AVAILABLE_IOS(3_2); UIKIT_EXTERN void UIGraphicsBeginPDFPageWithInfo(CGRect bounds, NSDictionary *pageInfo) NS_AVAILABLE_IOS(3_2); UIKIT_EXTERN CGRect UIGraphicsGetPDFContextBounds(void) NS_AVAILABLE_IOS(3_2); UIKIT_EXTERN void UIGraphicsSetPDFContextURLForRect(NSURL *url, CGRect rect) NS_AVAILABLE_IOS(3_2); UIKIT_EXTERN void UIGraphicsAddPDFContextDestinationAtPoint(NSString *name, CGPoint point) NS_AVAILABLE_IOS(3_2); UIKIT_EXTERN void UIGraphicsSetPDFContextDestinationForRect(NSString *name, CGRect rect) NS_AVAILABLE_IOS(3_2); // // UIImage.h // UIKit // // Copyright (c) 2005-2012, Apple Inc. All rights reserved. // #import #import #import #import #import #import typedef NS_ENUM(NSInteger, UIImageOrientation) { UIImageOrientationUp, // default orientation UIImageOrientationDown, // 180 deg rotation UIImageOrientationLeft, // 90 deg CCW UIImageOrientationRight, // 90 deg CW UIImageOrientationUpMirrored, // as above but image mirrored along other axis. horizontal flip UIImageOrientationDownMirrored, // horizontal flip UIImageOrientationLeftMirrored, // vertical flip UIImageOrientationRightMirrored, // vertical flip }; /* UIImage will implement the resizing mode the fastest way possible while retaining the desired visual appearance. Note that if an image's resizable area is one point then UIImageResizingModeTile is visually indistinguishable from UIImageResizingModeStretch. */ typedef NS_ENUM(NSInteger, UIImageResizingMode) { UIImageResizingModeTile, UIImageResizingModeStretch, }; NS_CLASS_AVAILABLE_IOS(2_0) @interface UIImage : NSObject { @package CFTypeRef _imageRef; CGFloat _scale; struct { unsigned int named:1; unsigned int imageOrientation:3; unsigned int cached:1; unsigned int hasPattern:1; unsigned int isCIImage:1; unsigned int imageSetIdentifer:16; } _imageFlags; } + (UIImage *)imageNamed:(NSString *)name; // load from main bundle + (UIImage *)imageWithContentsOfFile:(NSString *)path; + (UIImage *)imageWithData:(NSData *)data; + (UIImage *)imageWithData:(NSData *)data scale:(CGFloat)scale NS_AVAILABLE_IOS(6_0); + (UIImage *)imageWithCGImage:(CGImageRef)cgImage; + (UIImage *)imageWithCGImage:(CGImageRef)cgImage scale:(CGFloat)scale orientation:(UIImageOrientation)orientation NS_AVAILABLE_IOS(4_0); + (UIImage *)imageWithCIImage:(CIImage *)ciImage NS_AVAILABLE_IOS(5_0); + (UIImage *)imageWithCIImage:(CIImage *)ciImage scale:(CGFloat)scale orientation:(UIImageOrientation)orientation NS_AVAILABLE_IOS(6_0); - (id)initWithContentsOfFile:(NSString *)path; - (id)initWithData:(NSData *)data; - (id)initWithData:(NSData *)data scale:(CGFloat)scale NS_AVAILABLE_IOS(6_0); - (id)initWithCGImage:(CGImageRef)cgImage; - (id)initWithCGImage:(CGImageRef)cgImage scale:(CGFloat)scale orientation:(UIImageOrientation)orientation NS_AVAILABLE_IOS(4_0); - (id)initWithCIImage:(CIImage *)ciImage NS_AVAILABLE_IOS(5_0); - (id)initWithCIImage:(CIImage *)ciImage scale:(CGFloat)scale orientation:(UIImageOrientation)orientation NS_AVAILABLE_IOS(6_0); @property(nonatomic,readonly) CGSize size; // reflects orientation setting. In iOS 4.0 and later, this is measured in points. In 3.x and earlier, measured in pixels @property(nonatomic,readonly) CGImageRef CGImage; // returns underlying CGImageRef or nil if CIImage based @property(nonatomic,readonly) CIImage *CIImage NS_AVAILABLE_IOS(5_0); // returns underlying CIImage or nil if CGImageRef based @property(nonatomic,readonly) UIImageOrientation imageOrientation; // this will affect how the image is composited @property(nonatomic,readonly) CGFloat scale NS_AVAILABLE_IOS(4_0); // animated images. When set as UIImageView.image, animation will play in an infinite loop until removed. Drawing will render the first image + (UIImage *)animatedImageNamed:(NSString *)name duration:(NSTimeInterval)duration NS_AVAILABLE_IOS(5_0); // read sequence of files with suffix starting at 0 or 1 + (UIImage *)animatedResizableImageNamed:(NSString *)name capInsets:(UIEdgeInsets)capInsets duration:(NSTimeInterval)duration NS_AVAILABLE_IOS(5_0); // sequence of files + (UIImage *)animatedResizableImageNamed:(NSString *)name capInsets:(UIEdgeInsets)capInsets resizingMode:(UIImageResizingMode)resizingMode duration:(NSTimeInterval)duration NS_AVAILABLE_IOS(6_0); + (UIImage *)animatedImageWithImages:(NSArray *)images duration:(NSTimeInterval)duration NS_AVAILABLE_IOS(5_0); @property(nonatomic,readonly) NSArray *images NS_AVAILABLE_IOS(5_0); // default is nil for non-animated images @property(nonatomic,readonly) NSTimeInterval duration NS_AVAILABLE_IOS(5_0); // total duration for all frames. default is 0 for non-animated images // the these draw the image 'right side up' in the usual coordinate system with 'point' being the top-left. - (void)drawAtPoint:(CGPoint)point; // mode = kCGBlendModeNormal, alpha = 1.0 - (void)drawAtPoint:(CGPoint)point blendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha; - (void)drawInRect:(CGRect)rect; // mode = kCGBlendModeNormal, alpha = 1.0 - (void)drawInRect:(CGRect)rect blendMode:(CGBlendMode)blendMode alpha:(CGFloat)alpha; - (void)drawAsPatternInRect:(CGRect)rect; // draws the image as a CGPattern - (UIImage *)resizableImageWithCapInsets:(UIEdgeInsets)capInsets NS_AVAILABLE_IOS(5_0); // create a resizable version of this image. the interior is tiled when drawn. - (UIImage *)resizableImageWithCapInsets:(UIEdgeInsets)capInsets resizingMode:(UIImageResizingMode)resizingMode NS_AVAILABLE_IOS(6_0); // the interior is resized according to the resizingMode @property(nonatomic,readonly) UIEdgeInsets capInsets NS_AVAILABLE_IOS(5_0); // default is UIEdgeInsetsZero for non resizable images @property(nonatomic,readonly) UIImageResizingMode resizingMode NS_AVAILABLE_IOS(6_0); // default is UIImageResizingModeTile // Support for constraint-based layout (auto layout) // The alignmentRectInsets of a UIImage are used by UIImageView and other UIView and UIControl // subclasses that take custom images to determine the view's alignment rect insets for // constraint-based layout. // The default alignmentRectInsets are UIEdgeInsetsZero. - (UIImage *)imageWithAlignmentRectInsets:(UIEdgeInsets)alignmentInsets NS_AVAILABLE_IOS(6_0); @property(nonatomic,readonly) UIEdgeInsets alignmentRectInsets NS_AVAILABLE_IOS(6_0); @end @interface UIImage(UIImageDeprecated) // use resizableImageWithCapInsets: and capInsets. - (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapHeight; @property(nonatomic,readonly) NSInteger leftCapWidth; // default is 0. if non-zero, horiz. stretchable. right cap is calculated as width - leftCapWidth - 1 @property(nonatomic,readonly) NSInteger topCapHeight; // default is 0. if non-zero, vert. stretchable. bottom cap is calculated as height - topCapWidth - 1 @end @interface CIImage(UIKitAdditions) - (id)initWithImage:(UIImage *)image NS_AVAILABLE_IOS(5_0); - (id)initWithImage:(UIImage *)image options:(NSDictionary *)options NS_AVAILABLE_IOS(5_0); @end UIKIT_EXTERN NSData *UIImagePNGRepresentation(UIImage *image); // return image as PNG. May return nil if image has no CGImageRef or invalid bitmap format UIKIT_EXTERN NSData *UIImageJPEGRepresentation(UIImage *image, CGFloat compressionQuality); // return image as JPEG. May return nil if image has no CGImageRef or invalid bitmap format. compression is 0(most)..1(least) // // UIImagePickerController.h // UIKit // // Copyright (c) 2008-2012, Apple Inc. All rights reserved. // #import #import #import @class UIImage; @protocol UIImagePickerControllerDelegate; typedef NS_ENUM(NSInteger, UIImagePickerControllerSourceType) { UIImagePickerControllerSourceTypePhotoLibrary, UIImagePickerControllerSourceTypeCamera, UIImagePickerControllerSourceTypeSavedPhotosAlbum }; typedef NS_ENUM(NSInteger, UIImagePickerControllerQualityType) { UIImagePickerControllerQualityTypeHigh = 0, // highest quality UIImagePickerControllerQualityTypeMedium = 1, // medium quality, suitable for transmission via Wi-Fi UIImagePickerControllerQualityTypeLow = 2, // lowest quality, suitable for tranmission via cellular network #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0 UIImagePickerControllerQualityType640x480 = 3, // VGA quality #endif #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_5_0 UIImagePickerControllerQualityTypeIFrame1280x720 = 4, UIImagePickerControllerQualityTypeIFrame960x540 = 5 #endif }; typedef NS_ENUM(NSInteger, UIImagePickerControllerCameraCaptureMode) { UIImagePickerControllerCameraCaptureModePhoto, UIImagePickerControllerCameraCaptureModeVideo }; typedef NS_ENUM(NSInteger, UIImagePickerControllerCameraDevice) { UIImagePickerControllerCameraDeviceRear, UIImagePickerControllerCameraDeviceFront }; typedef NS_ENUM(NSInteger, UIImagePickerControllerCameraFlashMode) { UIImagePickerControllerCameraFlashModeOff = -1, UIImagePickerControllerCameraFlashModeAuto = 0, UIImagePickerControllerCameraFlashModeOn = 1 }; // info dictionary keys UIKIT_EXTERN NSString *const UIImagePickerControllerMediaType; // an NSString (UTI, i.e. kUTTypeImage) UIKIT_EXTERN NSString *const UIImagePickerControllerOriginalImage; // a UIImage UIKIT_EXTERN NSString *const UIImagePickerControllerEditedImage; // a UIImage UIKIT_EXTERN NSString *const UIImagePickerControllerCropRect; // an NSValue (CGRect) UIKIT_EXTERN NSString *const UIImagePickerControllerMediaURL; // an NSURL UIKIT_EXTERN NSString *const UIImagePickerControllerReferenceURL NS_AVAILABLE_IOS(4_1); // an NSURL that references an asset in the AssetsLibrary framework UIKIT_EXTERN NSString *const UIImagePickerControllerMediaMetadata NS_AVAILABLE_IOS(4_1); // an NSDictionary containing metadata from a captured photo NS_CLASS_AVAILABLE_IOS(2_0) @interface UIImagePickerController : UINavigationController { @private UIImagePickerControllerSourceType _sourceType; id _image; CGRect _cropRect; NSArray *_mediaTypes; NSMutableDictionary *_properties; int _previousStatusBarStyle; struct { unsigned int visible:1; unsigned int isCleaningUp:1; unsigned int savingOptions:3; unsigned int didRevertStatusBar:1; } _imagePickerFlags; } + (BOOL)isSourceTypeAvailable:(UIImagePickerControllerSourceType)sourceType; // returns YES if source is available (i.e. camera present) + (NSArray *)availableMediaTypesForSourceType:(UIImagePickerControllerSourceType)sourceType; // returns array of available media types (i.e. kUTTypeImage) + (BOOL)isCameraDeviceAvailable:(UIImagePickerControllerCameraDevice)cameraDevice NS_AVAILABLE_IOS(4_0); // returns YES if camera device is available + (BOOL)isFlashAvailableForCameraDevice:(UIImagePickerControllerCameraDevice)cameraDevice NS_AVAILABLE_IOS(4_0); // returns YES if camera device supports flash and torch. + (NSArray *)availableCaptureModesForCameraDevice:(UIImagePickerControllerCameraDevice)cameraDevice NS_AVAILABLE_IOS(4_0); // returns array of NSNumbers (UIImagePickerControllerCameraCaptureMode) @property(nonatomic,assign) id delegate; @property(nonatomic) UIImagePickerControllerSourceType sourceType; // default value is UIImagePickerControllerSourceTypePhotoLibrary. @property(nonatomic,copy) NSArray *mediaTypes; // default value is an array containing kUTTypeImage. @property(nonatomic) BOOL allowsEditing NS_AVAILABLE_IOS(3_1); // replacement for -allowsImageEditing; default value is NO. @property(nonatomic) BOOL allowsImageEditing NS_DEPRECATED_IOS(2_0, 3_1); // video properties apply only if mediaTypes includes kUTTypeMovie @property(nonatomic) NSTimeInterval videoMaximumDuration NS_AVAILABLE_IOS(3_1); // default value is 10 minutes. @property(nonatomic) UIImagePickerControllerQualityType videoQuality NS_AVAILABLE_IOS(3_1); // default value is UIImagePickerControllerQualityTypeMedium. If the cameraDevice does not support the videoQuality, it will use the default value. // camera additions available only if sourceType is UIImagePickerControllerSourceTypeCamera. @property(nonatomic) BOOL showsCameraControls NS_AVAILABLE_IOS(3_1); // set to NO to hide all standard camera UI. default is YES @property(nonatomic,retain) UIView *cameraOverlayView NS_AVAILABLE_IOS(3_1); // set a view to overlay the preview view. @property(nonatomic) CGAffineTransform cameraViewTransform NS_AVAILABLE_IOS(3_1); // set the transform of the preview view. - (void)takePicture NS_AVAILABLE_IOS(3_1); // programatically initiates still image capture. ignored if image capture is in-flight. // clients can initiate additional captures after receiving -imagePickerController:didFinishPickingMediaWithInfo: delegate callback - (BOOL)startVideoCapture NS_AVAILABLE_IOS(4_0); - (void)stopVideoCapture NS_AVAILABLE_IOS(4_0); @property(nonatomic) UIImagePickerControllerCameraCaptureMode cameraCaptureMode NS_AVAILABLE_IOS(4_0); // default is UIImagePickerControllerCameraCaptureModePhoto @property(nonatomic) UIImagePickerControllerCameraDevice cameraDevice NS_AVAILABLE_IOS(4_0); // default is UIImagePickerControllerCameraDeviceRear @property(nonatomic) UIImagePickerControllerCameraFlashMode cameraFlashMode NS_AVAILABLE_IOS(4_0); // default is UIImagePickerControllerCameraFlashModeAuto. // cameraFlashMode controls the still-image flash when cameraCaptureMode is Photo. cameraFlashMode controls the video torch when cameraCaptureMode is Video. @end @protocol UIImagePickerControllerDelegate @optional // The picker does not dismiss itself; the client dismisses it in these callbacks. // The delegate will receive one or the other, but not both, depending whether the user // confirms or cancels. - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo NS_DEPRECATED_IOS(2_0, 3_0); - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info; - (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker; @end // Adds a photo to the saved photos album. The optional completionSelector should have the form: // - (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo; UIKIT_EXTERN void UIImageWriteToSavedPhotosAlbum(UIImage *image, id completionTarget, SEL completionSelector, void *contextInfo); // Is a specific video eligible to be saved to the saved photos album? UIKIT_EXTERN BOOL UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(NSString *videoPath) NS_AVAILABLE_IOS(3_1); // Adds a video to the saved photos album. The optional completionSelector should have the form: // - (void)video:(NSString *)videoPath didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo; UIKIT_EXTERN void UISaveVideoAtPathToSavedPhotosAlbum(NSString *videoPath, id completionTarget, SEL completionSelector, void *contextInfo) NS_AVAILABLE_IOS(3_1); // // UIImageView.h // UIKit // // Copyright (c) 2006-2012, Apple Inc. All rights reserved. // #import #import #import @class UIImage; NS_CLASS_AVAILABLE_IOS(2_0) @interface UIImageView : UIView { @private id _storage; } - (id)initWithImage:(UIImage *)image; - (id)initWithImage:(UIImage *)image highlightedImage:(UIImage *)highlightedImage NS_AVAILABLE_IOS(3_0); @property(nonatomic,retain) UIImage *image; // default is nil @property(nonatomic,retain) UIImage *highlightedImage NS_AVAILABLE_IOS(3_0); // default is nil @property(nonatomic,getter=isUserInteractionEnabled) BOOL userInteractionEnabled; // default is NO @property(nonatomic,getter=isHighlighted) BOOL highlighted NS_AVAILABLE_IOS(3_0); // default is NO // these allow a set of images to be animated. the array may contain multiple copies of the same @property(nonatomic,copy) NSArray *animationImages; // The array must contain UIImages. Setting hides the single image. default is nil @property(nonatomic,copy) NSArray *highlightedAnimationImages NS_AVAILABLE_IOS(3_0); // The array must contain UIImages. Setting hides the single image. default is nil @property(nonatomic) NSTimeInterval animationDuration; // for one cycle of images. default is number of images * 1/30th of a second (i.e. 30 fps) @property(nonatomic) NSInteger animationRepeatCount; // 0 means infinite (default is 0) - (void)startAnimating; - (void)stopAnimating; - (BOOL)isAnimating; @end // // UIInterface.h // UIKit // // Copyright (c) 2005-2012, Apple Inc. All rights reserved. // #import #import #import #import // for UINavigationBar and UIToolBar typedef NS_ENUM(NSInteger, UIBarStyle) { UIBarStyleDefault = 0, UIBarStyleBlack = 1, UIBarStyleBlackOpaque = 1, // Deprecated. Use UIBarStyleBlack UIBarStyleBlackTranslucent = 2, // Deprecated. Use UIBarStyleBlack and set the translucent property to YES }; // System colors @interface UIColor (UIColorSystemColors) + (UIColor *)lightTextColor; // for a dark background + (UIColor *)darkTextColor; // for a light background // Group style table view backgrounds can no longer be represented by a simple color. // If you want to have a background in your own view that looks like the table view background, // then you should create an empty table view and place it behind your content. + (UIColor *)groupTableViewBackgroundColor; // This method will be deprecated during the 6.0 seed program + (UIColor *)viewFlipsideBackgroundColor; + (UIColor *)scrollViewTexturedBackgroundColor NS_AVAILABLE_IOS(3_2); + (UIColor *)underPageBackgroundColor NS_AVAILABLE_IOS(5_0); @end // System fonts @interface UIFont (UIFontSystemFonts) + (CGFloat)labelFontSize; + (CGFloat)buttonFontSize; + (CGFloat)smallSystemFontSize; + (CGFloat)systemFontSize; @end // // UIKit.h // UIKit // // Copyright (c) 2005-2012, Apple Inc. All rights reserved. // #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import #import // // UIKitDefines.h // UIKit // // Copyright (c) 2007-2012, Apple Inc. All rights reserved. // #import #ifdef __cplusplus #define UIKIT_EXTERN extern "C" __attribute__((visibility ("default"))) #else #define UIKIT_EXTERN extern __attribute__((visibility ("default"))) #endif #ifndef __has_feature #define __has_feature(x) 0 #endif #if !__has_feature(objc_instancetype) #undef instancetype #define instancetype id #endif #define UIKIT_STATIC_INLINE static inline // // UILabel.h // UIKit // // Copyright (c) 2006-2012, Apple Inc. All rights reserved. // #import #import #import #import #import @class UIColor, UIFont; NS_CLASS_AVAILABLE_IOS(2_0) @interface UILabel : UIView @property(nonatomic,copy) NSString *text; // default is nil @property(nonatomic,retain) UIFont *font; // default is nil (system font 17 plain) @property(nonatomic,retain) UIColor *textColor; // default is nil (text draws black) @property(nonatomic,retain) UIColor *shadowColor; // default is nil (no shadow) @property(nonatomic) CGSize shadowOffset; // default is CGSizeMake(0, -1) -- a top shadow @property(nonatomic) NSTextAlignment textAlignment; // default is NSLeftTextAlignment @property(nonatomic) NSLineBreakMode lineBreakMode; // default is NSLineBreakByTruncatingTail. used for single and multiple lines of text // the underlying attributed string drawn by the label, if set, the label ignores the properties above. @property(nonatomic,copy) NSAttributedString *attributedText NS_AVAILABLE_IOS(6_0); // default is nil // the 'highlight' property is used by subclasses for such things as pressed states. it's useful to make it part of the base class as a user property @property(nonatomic,retain) UIColor *highlightedTextColor; // default is nil @property(nonatomic,getter=isHighlighted) BOOL highlighted; // default is NO @property(nonatomic,getter=isUserInteractionEnabled) BOOL userInteractionEnabled; // default is NO @property(nonatomic,getter=isEnabled) BOOL enabled; // default is YES. changes how the label is drawn // this determines the number of lines to draw and what to do when sizeToFit is called. default value is 1 (single line). A value of 0 means no limit // if the height of the text reaches the # of lines or the height of the view is less than the # of lines allowed, the text will be // truncated using the line break mode. @property(nonatomic) NSInteger numberOfLines; // these next 3 property allow the label to be autosized to fit a certain width by scaling the font size(s) by a scaling factor >= the minimum scaling factor // and to specify how the text baseline moves when it needs to shrink the font. this only affects single line text (lineCount == 1) @property(nonatomic) BOOL adjustsFontSizeToFitWidth; // default is NO @property(nonatomic) BOOL adjustsLetterSpacingToFitWidth NS_AVAILABLE_IOS(6_0); // default is NO, adjust letter spacing to make text fit. Note: setting this property to YES will cause the value of -[NSParagraphStyle tighteningFactorForTruncation] to be disgregarded. @property(nonatomic) CGFloat minimumFontSize NS_DEPRECATED_IOS(2_0, 6_0); // NOTE: deprecated - use minimumScaleFactor. default is 0.0 @property(nonatomic) UIBaselineAdjustment baselineAdjustment; // default is UIBaselineAdjustmentAlignBaselines @property(nonatomic) CGFloat minimumScaleFactor NS_AVAILABLE_IOS(6_0); // default is 0.0 // override points. can adjust rect before calling super. // label has default content mode of UIViewContentModeRedraw - (CGRect)textRectForBounds:(CGRect)bounds limitedToNumberOfLines:(NSInteger)numberOfLines; - (void)drawTextInRect:(CGRect)rect; // Support for constraint-based layout (auto layout) // If nonzero, this is used when determining -intrinsicContentSize for multiline labels @property(nonatomic) CGFloat preferredMaxLayoutWidth NS_AVAILABLE_IOS(6_0); @end // // UILocalNotification.h // UIKit // // Copyright (c) 2007-2012, Apple Inc. All rights reserved. // #import #import NS_CLASS_AVAILABLE_IOS(4_0) @interface UILocalNotification : NSObject // added in iOS 4.0 // scheduling @property(nonatomic,copy) NSDate *fireDate; // the time zone to interpret fireDate in. pass nil if fireDate is an absolute GMT time (e.g. for an egg timer). // pass a time zone to interpret fireDate as a wall time to be adjusted automatically upon time zone changes (e.g. for an alarm clock). @property(nonatomic,copy) NSTimeZone *timeZone; @property(nonatomic) NSCalendarUnit repeatInterval; // 0 means don't repeat @property(nonatomic,copy) NSCalendar *repeatCalendar; // alerts @property(nonatomic,copy) NSString *alertBody; // defaults to nil. pass a string or localized string key to show an alert @property(nonatomic) BOOL hasAction; // defaults to YES. pass NO to hide launching button/slider @property(nonatomic,copy) NSString *alertAction; // used in UIAlert button or 'slide to unlock...' slider in place of unlock @property(nonatomic,copy) NSString *alertLaunchImage; // used as the launch image (UILaunchImageFile) when launch button is tapped // sound @property(nonatomic,copy) NSString *soundName; // name of resource in app's bundle to play or UILocalNotificationDefaultSoundName // badge @property(nonatomic) NSInteger applicationIconBadgeNumber; // 0 means no change. defaults to 0 // user info @property(nonatomic,copy) NSDictionary *userInfo; // throws if contains non-property list types @end UIKIT_EXTERN NSString *const UILocalNotificationDefaultSoundName NS_AVAILABLE_IOS(4_0); // // UILocalizedIndexedCollation.h // UIKit // // Copyright (c) 2009-2012, Apple Inc. All rights reserved. // #import #import NS_CLASS_AVAILABLE_IOS(3_0) @interface UILocalizedIndexedCollation : NSObject { @package NSLocale *_locale; NSArray *_sectionTitles; NSArray *_sectionStartStrings; NSArray *_sectionIndexTitles; NSArray *_sectionIndexMapping; NSString *_transform; NSString *_firstSectionStartString; NSString *_lastSectionStartString; CFStringTokenizerRef _tokenizer; } + (id)currentCollation; // Provides the list of section titles used to group results (e.g. A-Z,# in US/English) @property(nonatomic, readonly) NSArray *sectionTitles; // Provides the list of index titles used to quickly jump to particular sections @property(nonatomic, readonly) NSArray *sectionIndexTitles; // Specifies the section that should be scrolled to for the title at the given index. // This method allows you to map between a given item in the index // and a given section where there isn't a one-to-one mapping. - (NSInteger)sectionForSectionIndexTitleAtIndex:(NSInteger)indexTitleIndex; // Returns the index of the section that will contain the object. // selector must not take any arguments and return an NSString. - (NSInteger)sectionForObject:(id)object collationStringSelector:(SEL)selector; // Used for sorting objects within the same section. // selector must not take any arguments and return an NSString. // In the process of sorting the array, each object may receive // selector multiple times, so this method should be fast. - (NSArray *)sortedArrayFromArray:(NSArray *)array collationStringSelector:(SEL)selector; @end // // UILongPressGestureRecognizer.h // UIKit // // Copyright (c) 2008-2012, Apple Inc. All rights reserved. // #import #import #import // Begins: when numberOfTouchesRequired have tapped numberOfTapsRequired times and been held for minumPressDuration // Changes: when a finger moves // Ends: when a finger is lifted NS_CLASS_AVAILABLE_IOS(3_2) @interface UILongPressGestureRecognizer : UIGestureRecognizer { @package NSArray *_touches; NSMutableSet *_activeTouches; NSUInteger _numberOfTouchesRequired; CFTimeInterval _minimumPressDuration; CGFloat _allowableMovement; CGPoint _startPointScreen; id _enoughTimeElapsed; id _tooMuchTimeElapsed; id _imp; unsigned int _gotTouchEnd:1; unsigned int _gotTooMany:1; unsigned int _gotEnoughTaps:1; unsigned int _cancelPastAllowableMovement:1; } @property (nonatomic) NSUInteger numberOfTapsRequired; // Default is 0. The number of full taps required before the press for gesture to be recognized @property (nonatomic) NSUInteger numberOfTouchesRequired; // Default is 1. Number of fingers that must be held down for the gesture to be recognized @property (nonatomic) CFTimeInterval minimumPressDuration; // Default is 0.5. Time in seconds the fingers must be held down for the gesture to be recognized @property (nonatomic) CGFloat allowableMovement; // Default is 10. Maximum movement in pixels allowed before the gesture fails. Once recognized (after minimumPressDuration) there is no limit on finger movement for the remainder of the touch tracking @end // // UIManagedDocument.h // UIKit // // Copyright (c) 2011-2012, Apple Inc. // All rights reserved. // #import @class NSManagedObjectModel; @class NSManagedObjectContext; @class NSPersistentStoreCoordinator; NS_CLASS_AVAILABLE_IOS(5_0) @interface UIManagedDocument : UIDocument { @private NSManagedObjectContext *_managedObjectContext; NSPersistentStoreCoordinator *_persistentStoreCoordinator; NSManagedObjectModel *_managedObjectModel; NSDictionary *_documentMetadata; struct __mdocFlags { unsigned int shouldWriteAdditionalContent:1; unsigned int _reserved:31; } _mdocFlags; } /* The name for the persistent store file inside the document's file wrapper. When working with the Core Data APIs, this path component is appended to the document URL provided by the UIDocument APIs. The default name is @"documentpersistentstore.db" */ + (NSString *)persistentStoreName; /* Persistent documents always have a managed object context and a persistent store coordinator through that context. The managed object context is required to be initialized with the concurrency type NSMainQueueConcurrencyType and it must have a parent context initialized with the concurrency type NSPrivateQueueConcurrencyType. */ @property (nonatomic, retain, readonly) NSManagedObjectContext *managedObjectContext; /* Persistent documents always have a managed object model. The default model is the union of all models in the main bundle. */ @property (nonatomic, retain, readonly) NSManagedObjectModel* managedObjectModel; /* Optionally provide a collection of store options to be passed when configuring the persistent store */ @property (nonatomic, copy) NSDictionary *persistentStoreOptions; /* Optionally specify a model configuration name to be passed when configuring the persistent store */ @property (nonatomic, copy) NSString *modelConfiguration; /* Customize the loading or creation of a persistent store to the coordinator. */ - (BOOL)configurePersistentStoreCoordinatorForURL:(NSURL *)storeURL ofType:(NSString *)fileType modelConfiguration:(NSString *)configuration storeOptions:(NSDictionary *)storeOptions error:(NSError **)error; /* Returns the Core Data store type string for the given document fileType. The default returns NSSQLiteStoreType. See NSPersistentStoreCoordinator.h for store type information. */ - (NSString *)persistentStoreTypeForFileType:(NSString *)fileType; /* An optional call out by readFromURL:error: to handle non-Core Data content in the document's file wrapper. It is not necessary to call super. */ - (BOOL)readAdditionalContentFromURL:(NSURL *)absoluteURL error:(NSError **)error; /* An optional call out by contentsForType:error: to handle non-Core Data content in the document's file wrapper. The returned object will be passed to -writeAdditionalContent: It is not necessary to call super. */ - (id)additionalContentForURL:(NSURL *)absoluteURL error:(NSError **)error; /* An optional call out by writeContents:andAttributes:safelyToURL:forSaveOperation:error: to handle non-Core Data content in the document's file wrapper. The Core Data content is handled by the primary UIDocument -writeContents:andAttributes:safelyToURL:forSaveOperation:error: method. It is not necessary to call super. */ - (BOOL)writeAdditionalContent:(id)content toURL:(NSURL *)absoluteURL originalContentsURL:(NSURL *)absoluteOriginalContentsURL error:(NSError **)error; @end // // UIMenuController.h // UIKit // // Copyright (c) 2009-2012, Apple Inc. All rights reserved. // #import #import #import typedef NS_ENUM(NSInteger, UIMenuControllerArrowDirection) { UIMenuControllerArrowDefault, // up or down based on screen location #if __IPHONE_3_2 <= __IPHONE_OS_VERSION_MAX_ALLOWED UIMenuControllerArrowUp, UIMenuControllerArrowDown, UIMenuControllerArrowLeft, UIMenuControllerArrowRight, #endif }; @class UIView; NS_CLASS_AVAILABLE_IOS(3_0) @interface UIMenuController : NSObject { @private CGRect _targetRect; UIMenuControllerArrowDirection _arrowDirection; } + (UIMenuController *)sharedMenuController; @property(nonatomic,getter=isMenuVisible) BOOL menuVisible; // default is NO - (void)setMenuVisible:(BOOL)menuVisible animated:(BOOL)animated; - (void)setTargetRect:(CGRect)targetRect inView:(UIView *)targetView; @property(nonatomic) UIMenuControllerArrowDirection arrowDirection NS_AVAILABLE_IOS(3_2); // default is UIMenuControllerArrowDefault @property(nonatomic,copy) NSArray *menuItems NS_AVAILABLE_IOS(3_2); // default is nil. these are in addition to the standard items - (void)update; @property(nonatomic,readonly) CGRect menuFrame; @end UIKIT_EXTERN NSString *const UIMenuControllerWillShowMenuNotification; UIKIT_EXTERN NSString *const UIMenuControllerDidShowMenuNotification; UIKIT_EXTERN NSString *const UIMenuControllerWillHideMenuNotification; UIKIT_EXTERN NSString *const UIMenuControllerDidHideMenuNotification; UIKIT_EXTERN NSString *const UIMenuControllerMenuFrameDidChangeNotification; NS_CLASS_AVAILABLE_IOS(3_2) @interface UIMenuItem : NSObject { @private NSString *_title; SEL _action; BOOL _dontDismiss; } - (id)initWithTitle:(NSString *)title action:(SEL)action; @property(nonatomic,copy) NSString *title; // default is nil @property(nonatomic) SEL action; // default is NULL @end // // UINavigationBar.h // UIKit // // Copyright (c) 2005-2012, Apple Inc. All rights reserved. // #import #import #import #import #import #import #import #import @class UINavigationItem, UIBarButtonItem, UIImage, UIColor; @protocol UINavigationBarDelegate; NS_CLASS_AVAILABLE_IOS(2_0) @interface UINavigationBar : UIView { @private NSMutableArray *_itemStack; CGFloat _rightMargin; unsigned _state; id _delegate; UIView *_backgroundView; UIView *_titleView; NSArray *_leftViews; NSArray *_rightViews; UIView *_prompt; UIView *_accessoryView; UIColor *_tintColor; id _appearanceStorage; id _currentAlert; struct { unsigned int animate:1; unsigned int animationDisabledCount:10; unsigned int transitioningBarStyle:1; unsigned int newBarStyle:3; unsigned int transitioningToTranslucent:1; unsigned int barStyle:3; unsigned int isTranslucent:1; unsigned int disableLayout:1; unsigned int backPressed:1; unsigned int animatePromptChange:1; unsigned int pendingHideBackButton:1; unsigned int titleAutosizesToFit:1; unsigned int usingNewAPI:1; unsigned int minibar:1; unsigned int forceFullHeightInLandscape:1; unsigned int isLocked:1; unsigned int shouldUpdatePromptAfterTransition:1; unsigned int crossfadeItems:1; unsigned int autoAdjustTitle:1; unsigned int isContainedInPopover:1; unsigned int needsDrawRect:1; unsigned int animationCleanupCancelled:1; unsigned int forceLayout:1; unsigned int layoutInProgress:1; unsigned int dynamicDuration:1; unsigned int isInteractive:1; unsigned int cancelledTransition:1; unsigned int animationCount:4; } _navbarFlags; } @property(nonatomic,assign) UIBarStyle barStyle; @property(nonatomic,assign) id delegate; @property(nonatomic,assign,getter=isTranslucent) BOOL translucent NS_AVAILABLE_IOS(3_0); // Default is NO. Always YES if barStyle is set to UIBarStyleBlackTranslucent // Pushing a navigation item displays the item's title in the center of the navigation bar. // The previous top navigation item (if it exists) is displayed as a "back" button on the left. - (void)pushNavigationItem:(UINavigationItem *)item animated:(BOOL)animated; - (UINavigationItem *)popNavigationItemAnimated:(BOOL)animated; // Returns the item that was popped. @property(nonatomic,readonly,retain) UINavigationItem *topItem; @property(nonatomic,readonly,retain) UINavigationItem *backItem; @property(nonatomic,copy) NSArray *items; - (void)setItems:(NSArray *)items animated:(BOOL)animated; // If animated is YES, then simulate a push or pop depending on whether the new top item was previously in the stack. @property(nonatomic,retain) UIColor *tintColor UI_APPEARANCE_SELECTOR; /* In general, you should specify a value for the normal state to be used by other states which don't have a custom value set. Similarly, when a property is dependent on the bar metrics (on the iPhone in landscape orientation, bars have a different height from standard), be sure to specify a value for UIBarMetricsDefault. DISCUSSION: Interdependence of barStyle, tintColor, backgroundImage. When barStyle or tintColor is set as well as the bar's background image, the bar buttons (unless otherwise customized) will inherit the underlying barStyle or tintColor. */ - (void)setBackgroundImage:(UIImage *)backgroundImage forBarMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; - (UIImage *)backgroundImageForBarMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; /* Default is nil. When non-nil, a custom shadow image to show instead of the default shadow image. For a custom shadow to be shown, a custom background image must also be set with -setBackgroundImage:forBarMetrics: (if the default background image is used, the default shadow image will be used). */ @property(nonatomic,retain) UIImage *shadowImage NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR; /* You may specify the font, text color, text shadow color, and text shadow offset for the title in the text attributes dictionary, using the keys found in UIStringDrawing.h. */ @property(nonatomic,copy) NSDictionary *titleTextAttributes NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; - (void)setTitleVerticalPositionAdjustment:(CGFloat)adjustment forBarMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; - (CGFloat)titleVerticalPositionAdjustmentForBarMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; @end @protocol UINavigationBarDelegate @optional - (BOOL)navigationBar:(UINavigationBar *)navigationBar shouldPushItem:(UINavigationItem *)item; // called to push. return NO not to. - (void)navigationBar:(UINavigationBar *)navigationBar didPushItem:(UINavigationItem *)item; // called at end of animation of push or immediately if not animated - (BOOL)navigationBar:(UINavigationBar *)navigationBar shouldPopItem:(UINavigationItem *)item; // same as push methods - (void)navigationBar:(UINavigationBar *)navigationBar didPopItem:(UINavigationItem *)item; @end NS_CLASS_AVAILABLE_IOS(2_0) @interface UINavigationItem : NSObject { @private NSString *_title; NSString *_backButtonTitle; UIBarButtonItem *_backBarButtonItem; NSString *_prompt; NSInteger _tag; id _context; UINavigationBar *_navigationBar; UIView *_defaultTitleView; UIView *_titleView; UIView *_backButtonView; NSArray *_leftBarButtonItems; NSArray *_rightBarButtonItems; NSArray *_customLeftViews; NSArray *_customRightViews; BOOL _hidesBackButton; BOOL _leftItemsSupplementBackButton; UIImageView *_frozenTitleView; } - (id)initWithTitle:(NSString *)title; @property(nonatomic,copy) NSString *title; // Title when topmost on the stack. default is nil @property(nonatomic,retain) UIBarButtonItem *backBarButtonItem; // Bar button item to use for the back button in the child navigation item. @property(nonatomic,retain) UIView *titleView; // Custom view to use in lieu of a title. May be sized horizontally. Only used when item is topmost on the stack. @property(nonatomic,copy) NSString *prompt; // Explanatory text to display above the navigation bar buttons. @property(nonatomic,assign) BOOL hidesBackButton; // If YES, this navigation item will hide the back button when it's on top of the stack. - (void)setHidesBackButton:(BOOL)hidesBackButton animated:(BOOL)animated; /* Use these properties to set multiple items in a navigation bar. The older single properties (leftBarButtonItem and rightBarButtonItem) now refer to the first item in the respective array of items. NOTE: You'll achieve the best results if you use either the singular properties or the plural properties consistently and don't try to mix them. leftBarButtonItems are placed in the navigation bar left to right with the first item in the list at the left outside edge and left aligned. rightBarButtonItems are placed right to left with the first item in the list at the right outside edge and right aligned. */ @property(nonatomic,copy) NSArray *leftBarButtonItems NS_AVAILABLE_IOS(5_0); @property(nonatomic,copy) NSArray *rightBarButtonItems NS_AVAILABLE_IOS(5_0); - (void)setLeftBarButtonItems:(NSArray *)items animated:(BOOL)animated NS_AVAILABLE_IOS(5_0); - (void)setRightBarButtonItems:(NSArray *)items animated:(BOOL)animated NS_AVAILABLE_IOS(5_0); /* By default, the leftItemsSupplementBackButton property is NO. In this case, the back button is not drawn and the left item or items replace it. If you would like the left items to appear in addition to the back button (as opposed to instead of it) set leftItemsSupplementBackButton to YES. */ @property(nonatomic) BOOL leftItemsSupplementBackButton NS_AVAILABLE_IOS(5_0); // Some navigation items want to display a custom left or right item when they're on top of the stack. // A custom left item replaces the regular back button unless you set leftItemsSupplementBackButton to YES @property(nonatomic,retain) UIBarButtonItem *leftBarButtonItem; @property(nonatomic,retain) UIBarButtonItem *rightBarButtonItem; - (void)setLeftBarButtonItem:(UIBarButtonItem *)item animated:(BOOL)animated; - (void)setRightBarButtonItem:(UIBarButtonItem *)item animated:(BOOL)animated; @end // // UINavigationController.h // UIKit // // Copyright (c) 2007-2012, Apple Inc. All rights reserved. // #import #import #import #import #import #import /*! UINavigationController manages a stack of view controllers and a navigation bar. It performs horizontal view transitions for pushed and popped views while keeping the navigation bar in sync. Most clients will not need to subclass UINavigationController. If a navigation controller is nested in a tabbar controller, it uses the title and toolbar attributes of the bottom view controller on the stack. UINavigationController is rotatable if its top view controller is rotatable. Navigation between controllers with non-uniform rotatability is currently not supported. */ UIKIT_EXTERN const CGFloat UINavigationControllerHideShowBarDuration; @class UIView, UINavigationBar, UINavigationItem, UIToolbar, UILayoutContainerView; @protocol UINavigationControllerDelegate; NS_CLASS_AVAILABLE_IOS(2_0) @interface UINavigationController : UIViewController { @package UIView *_containerView; UINavigationBar *_navigationBar; Class _navigationBarClass; UIToolbar *_toolbar; UIView *_navigationTransitionView; UIEdgeInsets _currentScrollContentInsetDelta; UIEdgeInsets _previousScrollContentInsetDelta; CGFloat _previousScrollContentOffsetDelta; CGFloat _bottomInsetDelta; UIViewController *_disappearingViewController; id _delegate; UIBarStyle _savedNavBarStyleBeforeSheet; UIBarStyle _savedToolBarStyleBeforeSheet; struct { unsigned int isAppearingAnimated:1; unsigned int isAlreadyPoppingNavigationItem:1; unsigned int isNavigationBarHidden:1; unsigned int isToolbarShown:1; unsigned int needsDeferredTransition:1; unsigned int isTransitioning:1; unsigned int lastOperation:4; unsigned int lastOperationAnimated:1; unsigned int deferredTransition:8; unsigned int didPreloadKeyboardAnimation:1; unsigned int didHideBottomBar:1; unsigned int isChangingOrientationForPop:1; unsigned int pretendNavBarHidden:1; unsigned int avoidMovingNavBarOffscreenBeforeUnhiding:1; unsigned int searchBarHidNavBar:1; unsigned int useSystemPopoverBarAppearance:1; unsigned int isCustomTransition:1; } _navigationControllerFlags; } /* Use this initializer to make the navigation controller use your custom bar class. Passing nil for navigationBarClass will get you UINavigationBar, nil for toolbarClass gets UIToolbar. The arguments must otherwise be subclasses of the respective UIKit classes. */ - (instancetype)initWithNavigationBarClass:(Class)navigationBarClass toolbarClass:(Class)toolbarClass NS_AVAILABLE_IOS(5_0); - (id)initWithRootViewController:(UIViewController *)rootViewController; // Convenience method pushes the root view controller without animation. - (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated; // Uses a horizontal slide transition. Has no effect if the view controller is already in the stack. - (UIViewController *)popViewControllerAnimated:(BOOL)animated; // Returns the popped controller. - (NSArray *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated; // Pops view controllers until the one specified is on top. Returns the popped controllers. - (NSArray *)popToRootViewControllerAnimated:(BOOL)animated; // Pops until there's only a single view controller left on the stack. Returns the popped controllers. @property(nonatomic,readonly,retain) UIViewController *topViewController; // The top view controller on the stack. @property(nonatomic,readonly,retain) UIViewController *visibleViewController; // Return modal view controller if it exists. Otherwise the top view controller. @property(nonatomic,copy) NSArray *viewControllers; // The current view controller stack. - (void)setViewControllers:(NSArray *)viewControllers animated:(BOOL)animated NS_AVAILABLE_IOS(3_0); // If animated is YES, then simulate a push or pop depending on whether the new top view controller was previously in the stack. @property(nonatomic,getter=isNavigationBarHidden) BOOL navigationBarHidden; - (void)setNavigationBarHidden:(BOOL)hidden animated:(BOOL)animated; // Hide or show the navigation bar. If animated, it will transition vertically using UINavigationControllerHideShowBarDuration. @property(nonatomic,readonly) UINavigationBar *navigationBar; // The navigation bar managed by the controller. Pushing, popping or setting navigation items on a managed navigation bar is not supported. @property(nonatomic,getter=isToolbarHidden) BOOL toolbarHidden NS_AVAILABLE_IOS(3_0); // Defaults to YES, i.e. hidden. - (void)setToolbarHidden:(BOOL)hidden animated:(BOOL)animated NS_AVAILABLE_IOS(3_0); // Hide or show the toolbar at the bottom of the screen. If animated, it will transition vertically using UINavigationControllerHideShowBarDuration. @property(nonatomic,readonly) UIToolbar *toolbar NS_AVAILABLE_IOS(3_0); // For use when presenting an action sheet. @property(nonatomic, assign) id delegate; @end @protocol UINavigationControllerDelegate @optional // Called when the navigation controller shows a new top view controller via a push, pop or setting of the view controller stack. - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated; - (void)navigationController:(UINavigationController *)navigationController didShowViewController:(UIViewController *)viewController animated:(BOOL)animated; @end @interface UIViewController (UINavigationControllerItem) @property(nonatomic,readonly,retain) UINavigationItem *navigationItem; // Created on-demand so that a view controller may customize its navigation appearance. @property(nonatomic) BOOL hidesBottomBarWhenPushed; // If YES, then when this view controller is pushed into a controller hierarchy with a bottom bar (like a tab bar), the bottom bar will slide out. Default is NO. @property(nonatomic,readonly,retain) UINavigationController *navigationController; // If this view controller has been pushed onto a navigation controller, return it. @end @interface UIViewController (UINavigationControllerContextualToolbarItems) @property (nonatomic, retain) NSArray *toolbarItems NS_AVAILABLE_IOS(3_0); - (void)setToolbarItems:(NSArray *)toolbarItems animated:(BOOL)animated NS_AVAILABLE_IOS(3_0); @end // // UINib.h // UIKit // // Copyright (c) 2008-2012, Apple Inc. All rights reserved. // #import #import NS_CLASS_AVAILABLE_IOS(4_0) @interface UINib : NSObject { @private id storage; } // If the bundle parameter is nil, the main bundle is used. // Releases resources in response to memory pressure (e.g. memory warning), reloading from the bundle when necessary. + (UINib *)nibWithNibName:(NSString *)name bundle:(NSBundle *)bundleOrNil; // If the bundle parameter is nil, the main bundle is used. + (UINib *)nibWithData:(NSData *)data bundle:(NSBundle *)bundleOrNil; // Returns an array containing the top-level objects from the NIB. // The owner and options parameters may both be nil. // If the owner parameter is nil, connections to File's Owner are not permitted. // Options are identical to the options specified with -[NSBundle loadNibNamed:owner:options:] - (NSArray *)instantiateWithOwner:(id)ownerOrNil options:(NSDictionary *)optionsOrNil; @end // // UINibDeclarations.h // UIKit // // Copyright (c) 2005-2012, Apple Inc. All rights reserved. // #ifndef IBOutlet #define IBOutlet #endif #ifndef IBOutletCollection #define IBOutletCollection(ClassName) #endif #ifndef IBAction #define IBAction void #endif // // UINibLoading.h // UIKit // // Copyright (c) 2005-2012, Apple Inc. All rights reserved. // #import #import UIKIT_EXTERN NSString * const UINibExternalObjects NS_AVAILABLE_IOS(3_0); @interface NSBundle(UINibLoadingAdditions) - (NSArray *)loadNibNamed:(NSString *)name owner:(id)owner options:(NSDictionary *)options; @end @interface NSObject(UINibLoadingAdditions) - (void)awakeFromNib; @end UIKIT_EXTERN NSString * const UINibProxiedObjectsKey NS_DEPRECATED_IOS(2_0, 3_0); // // UIPageControl.h // UIKit // // Copyright (c) 2008-2012, Apple Inc. All rights reserved. // #import #import #import NS_CLASS_AVAILABLE_IOS(2_0) @interface UIPageControl : UIControl { @private NSMutableArray* _indicators; NSInteger _currentPage; NSInteger _displayedPage; struct { unsigned int hideForSinglePage:1; unsigned int defersCurrentPageDisplay:1; } _pageControlFlags; UIImage* _currentPageImage; UIImage* _pageImage; } @property(nonatomic) NSInteger numberOfPages; // default is 0 @property(nonatomic) NSInteger currentPage; // default is 0. value pinned to 0..numberOfPages-1 @property(nonatomic) BOOL hidesForSinglePage; // hide the the indicator if there is only one page. default is NO @property(nonatomic) BOOL defersCurrentPageDisplay; // if set, clicking to a new page won't update the currently displayed page until -updateCurrentPageDisplay is called. default is NO - (void)updateCurrentPageDisplay; // update page display to match the currentPage. ignored if defersCurrentPageDisplay is NO. setting the page value directly will update immediately - (CGSize)sizeForNumberOfPages:(NSInteger)pageCount; // returns minimum size required to display dots for given page count. can be used to size control if page count could change @property(nonatomic,retain) UIColor *pageIndicatorTintColor NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR; @property(nonatomic,retain) UIColor *currentPageIndicatorTintColor NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR; @end // // UIPageViewController.h // UIKit // // Copyright 2011-2012, Apple Inc. All rights reserved. // #import typedef NS_ENUM(NSInteger, UIPageViewControllerNavigationOrientation) { UIPageViewControllerNavigationOrientationHorizontal = 0, UIPageViewControllerNavigationOrientationVertical = 1 }; typedef NS_ENUM(NSInteger, UIPageViewControllerSpineLocation) { UIPageViewControllerSpineLocationNone = 0, // Returned if 'spineLocation' is queried when 'transitionStyle' is not 'UIPageViewControllerTransitionStylePageCurl'. UIPageViewControllerSpineLocationMin = 1, // Requires one view controller. UIPageViewControllerSpineLocationMid = 2, // Requires two view controllers. UIPageViewControllerSpineLocationMax = 3 // Requires one view controller. }; // Only pertains to 'UIPageViewControllerTransitionStylePageCurl'. typedef NS_ENUM(NSInteger, UIPageViewControllerNavigationDirection) { UIPageViewControllerNavigationDirectionForward, UIPageViewControllerNavigationDirectionReverse }; // For 'UIPageViewControllerNavigationOrientationHorizontal', 'forward' is right-to-left, like pages in a book. For 'UIPageViewControllerNavigationOrientationVertical', bottom-to-top, like pages in a wall calendar. typedef NS_ENUM(NSInteger, UIPageViewControllerTransitionStyle) { UIPageViewControllerTransitionStylePageCurl = 0, // Navigate between views via a page curl transition. UIPageViewControllerTransitionStyleScroll = 1 // Navigate between views by scrolling. }; // Key for specifying spine location in options dictionary argument to initWithTransitionStyle:navigationOrientation:options:. // Value should be a 'UIPageViewControllerSpineLocation' wrapped in an NSNumber. // Only valid for use with page view controllers with transition style 'UIPageViewControllerTransitionStylePageCurl'. UIKIT_EXTERN NSString * const UIPageViewControllerOptionSpineLocationKey; // Key for specifying spacing between pages in options dictionary argument to initWithTransitionStyle:navigationOrientation:options:. // Value should be a CGFloat wrapped in an NSNumber. Default is '0'. // Only valid for use with page view controllers with transition style 'UIPageViewControllerTransitionStyleScroll'. UIKIT_EXTERN NSString * const UIPageViewControllerOptionInterPageSpacingKey NS_AVAILABLE_IOS(6_0); @protocol UIPageViewControllerDelegate, UIPageViewControllerDataSource; NS_CLASS_AVAILABLE_IOS(5_0) @interface UIPageViewController : UIViewController { } - (id)initWithTransitionStyle:(UIPageViewControllerTransitionStyle)style navigationOrientation:(UIPageViewControllerNavigationOrientation)navigationOrientation options:(NSDictionary *)options; @property (nonatomic, assign) id delegate; @property (nonatomic, assign) id dataSource; // If nil, user gesture-driven navigation will be disabled. @property (nonatomic, readonly) UIPageViewControllerTransitionStyle transitionStyle; @property (nonatomic, readonly) UIPageViewControllerNavigationOrientation navigationOrientation; @property (nonatomic, readonly) UIPageViewControllerSpineLocation spineLocation; // If transition style is 'UIPageViewControllerTransitionStylePageCurl', default is 'UIPageViewControllerSpineLocationMin', otherwise 'UIPageViewControllerSpineLocationNone'. // Whether client content appears on both sides of each page. If 'NO', content on page front will partially show through back. // If 'UIPageViewControllerSpineLocationMid' is set, 'doubleSided' is set to 'YES'. Setting 'NO' when spine location is mid results in an exception. @property (nonatomic, getter=isDoubleSided) BOOL doubleSided; // Default is 'NO'. // An array of UIGestureRecognizers pre-configured to handle user interaction. Initially attached to a view in the UIPageViewController's hierarchy, they can be placed on an arbitrary view to change the region in which the page view controller will respond to user gestures. // Only populated if transition style is 'UIPageViewControllerTransitionStylePageCurl'. @property(nonatomic, readonly) NSArray *gestureRecognizers; @property (nonatomic, readonly) NSArray *viewControllers; // Set visible view controllers, optionally with animation. Array should only include view controllers that will be visible after the animation has completed. // For transition style 'UIPageViewControllerTransitionStylePageCurl', if 'doubleSided' is 'YES' and the spine location is not 'UIPageViewControllerSpineLocationMid', two view controllers must be included, as the latter view controller is used as the back. - (void)setViewControllers:(NSArray *)viewControllers direction:(UIPageViewControllerNavigationDirection)direction animated:(BOOL)animated completion:(void (^)(BOOL finished))completion; @end @protocol UIPageViewControllerDelegate @optional // Sent when a gesture-initiated transition begins. - (void)pageViewController:(UIPageViewController *)pageViewController willTransitionToViewControllers:(NSArray *)pendingViewControllers NS_AVAILABLE_IOS(6_0); // Sent when a gesture-initiated transition ends. The 'finished' parameter indicates whether the animation finished, while the 'completed' parameter indicates whether the transition completed or bailed out (if the user let go early). - (void)pageViewController:(UIPageViewController *)pageViewController didFinishAnimating:(BOOL)finished previousViewControllers:(NSArray *)previousViewControllers transitionCompleted:(BOOL)completed; // Delegate may specify a different spine location for after the interface orientation change. Only sent for transition style 'UIPageViewControllerTransitionStylePageCurl'. // Delegate may set new view controllers or update double-sided state within this method's implementation as well. - (UIPageViewControllerSpineLocation)pageViewController:(UIPageViewController *)pageViewController spineLocationForInterfaceOrientation:(UIInterfaceOrientation)orientation; @end @protocol UIPageViewControllerDataSource @required // In terms of navigation direction. For example, for 'UIPageViewControllerNavigationOrientationHorizontal', view controllers coming 'before' would be to the left of the argument view controller, those coming 'after' would be to the right. // Return 'nil' to indicate that no more progress can be made in the given direction. // For gesture-initiated transitions, the page view controller obtains view controllers via these methods, so use of setViewControllers:direction:animated:completion: is not required. - (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController; - (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController; @optional // A page indicator will be visible if both methods are implemented, transition style is 'UIPageViewControllerTransitionStyleScroll', and navigation orientation is 'UIPageViewControllerNavigationOrientationHorizontal'. // Both methods are called in response to a 'setViewControllers:...' call, but the presentation index is updated automatically in the case of gesture-driven navigation. - (NSInteger)presentationCountForPageViewController:(UIPageViewController *)pageViewController NS_AVAILABLE_IOS(6_0); // The number of items reflected in the page indicator. - (NSInteger)presentationIndexForPageViewController:(UIPageViewController *)pageViewController NS_AVAILABLE_IOS(6_0); // The selected item reflected in the page indicator. @end // // UIPanGestureRecognizer.h // UIKit // // Copyright (c) 2008-2012, Apple Inc. All rights reserved. // #import #import // Begins: when at least minimumNumberOfTouches have moved enough to be considered a pan // Changes: when a finger moves while at least minimumNumberOfTouches are down // Ends: when all fingers have lifted NS_CLASS_AVAILABLE_IOS(3_2) @interface UIPanGestureRecognizer : UIGestureRecognizer { @package CGPoint _firstScreenLocation; CGPoint _lastScreenLocation; NSTimeInterval _lastTouchTime; id _velocitySample; id _previousVelocitySample; NSMutableArray *_touches; NSUInteger _lastTouchCount; NSUInteger _minimumNumberOfTouches; NSUInteger _maximumNumberOfTouches; CGFloat _hysteresis; CGPoint _lastUnadjustedScreenLocation; unsigned int _failsPastMaxTouches:1; unsigned int _canPanHorizontally:1; unsigned int _canPanVertically:1; unsigned int _ignoresStationaryTouches:1; } @property (nonatomic) NSUInteger minimumNumberOfTouches; // default is 1. the minimum number of touches required to match @property (nonatomic) NSUInteger maximumNumberOfTouches; // default is UINT_MAX. the maximum number of touches that can be down - (CGPoint)translationInView:(UIView *)view; // translation in the coordinate system of the specified view - (void)setTranslation:(CGPoint)translation inView:(UIView *)view; - (CGPoint)velocityInView:(UIView *)view; // velocity of the pan in pixels/second in the coordinate system of the specified view @end // // UIPasteboard.h // UIKit // // Copyright (c) 2008-2012, Apple Inc. All rights reserved. // #import #import UIKIT_EXTERN NSString *const UIPasteboardNameGeneral; UIKIT_EXTERN NSString *const UIPasteboardNameFind; @class UIColor, UIImage; NS_CLASS_AVAILABLE_IOS(3_0) @interface UIPasteboard : NSObject { @private NSString *_name; } + (UIPasteboard *)generalPasteboard; + (UIPasteboard *)pasteboardWithName:(NSString *)pasteboardName create:(BOOL)create; + (UIPasteboard *)pasteboardWithUniqueName; @property(readonly,nonatomic) NSString *name; + (void)removePasteboardWithName:(NSString *)pasteboardName; @property(getter=isPersistent,nonatomic) BOOL persistent; @property(readonly,nonatomic) NSInteger changeCount; // First item - (NSArray *)pasteboardTypes; - (BOOL)containsPasteboardTypes:(NSArray *)pasteboardTypes; - (NSData *)dataForPasteboardType:(NSString *)pasteboardType; - (id)valueForPasteboardType:(NSString *)pasteboardType; - (void)setValue:(id)value forPasteboardType:(NSString *)pasteboardType; - (void)setData:(NSData *)data forPasteboardType:(NSString *)pasteboardType; // Multiple items @property(readonly,nonatomic) NSInteger numberOfItems; - (NSArray *)pasteboardTypesForItemSet:(NSIndexSet*)itemSet; - (BOOL)containsPasteboardTypes:(NSArray *)pasteboardTypes inItemSet:(NSIndexSet *)itemSet; - (NSIndexSet *)itemSetWithPasteboardTypes:(NSArray *)pasteboardTypes; - (NSArray *)valuesForPasteboardType:(NSString *)pasteboardType inItemSet:(NSIndexSet *)itemSet; - (NSArray *)dataForPasteboardType:(NSString *)pasteboardType inItemSet:(NSIndexSet *)itemSet; // Direct access @property(nonatomic,copy) NSArray *items; - (void)addItems:(NSArray *)items; @end // Notification UIKIT_EXTERN NSString *const UIPasteboardChangedNotification; UIKIT_EXTERN NSString *const UIPasteboardChangedTypesAddedKey; UIKIT_EXTERN NSString *const UIPasteboardChangedTypesRemovedKey; UIKIT_EXTERN NSString *const UIPasteboardRemovedNotification; // Extensions UIKIT_EXTERN NSArray *UIPasteboardTypeListString; UIKIT_EXTERN NSArray *UIPasteboardTypeListURL; UIKIT_EXTERN NSArray *UIPasteboardTypeListImage; UIKIT_EXTERN NSArray *UIPasteboardTypeListColor; @interface UIPasteboard(UIPasteboardDataExtensions) @property(nonatomic,copy) NSString *string; @property(nonatomic,copy) NSArray *strings; @property(nonatomic,copy) NSURL *URL; @property(nonatomic,copy) NSArray *URLs; @property(nonatomic,copy) UIImage *image; @property(nonatomic,copy) NSArray *images; @property(nonatomic,copy) UIColor *color; @property(nonatomic,copy) NSArray *colors; @end // // UIPickerView.h // UIKit // // Copyright (c) 2006-2012, Apple Inc. All rights reserved. // #import #import #import #import #import @protocol UIPickerViewDataSource, UIPickerViewDelegate; NS_CLASS_AVAILABLE_IOS(2_0) @interface UIPickerView : UIView { @private NSMutableArray *_tables; UIView *_topFrame; NSMutableArray *_dividers; NSMutableArray *_selectionBars; id _dataSource; id _delegate; UIView *_backgroundView; NSInteger _numberOfComponents; @package struct { unsigned int needsLayout:1; unsigned int delegateRespondsToNumberOfComponentsInPickerView:1; unsigned int delegateRespondsToNumberOfRowsInComponent:1; unsigned int delegateRespondsToDidSelectRow:1; unsigned int delegateRespondsToViewForRow:1; unsigned int delegateRespondsToTitleForRow:1; unsigned int delegateRespondsToAttributedTitleForRow:1; unsigned int delegateRespondsToWidthForComponent:1; unsigned int delegateRespondsToRowHeightForComponent:1; unsigned int delegateRespondsToCheckableForRow:1; unsigned int showsSelectionBar:1; unsigned int allowsMultipleSelection:1; unsigned int allowSelectingCells:1; unsigned int soundsDisabled:1; unsigned int usesCheckedSelection:1; unsigned int skipsBackground:1; } _pickerViewFlags; } @property(nonatomic,assign) id dataSource; // default is nil. weak reference @property(nonatomic,assign) id delegate; // default is nil. weak reference @property(nonatomic) BOOL showsSelectionIndicator; // default is NO // info that was fetched and cached from the data source and delegate @property(nonatomic,readonly) NSInteger numberOfComponents; - (NSInteger)numberOfRowsInComponent:(NSInteger)component; - (CGSize)rowSizeForComponent:(NSInteger)component; // returns the view provided by the delegate via pickerView:viewForRow:forComponent:reusingView: // or nil if the row/component is not visible or the delegate does not implement // pickerView:viewForRow:forComponent:reusingView: - (UIView *)viewForRow:(NSInteger)row forComponent:(NSInteger)component; // Reloading whole view or single component - (void)reloadAllComponents; - (void)reloadComponent:(NSInteger)component; // selection. in this case, it means showing the appropriate row in the middle - (void)selectRow:(NSInteger)row inComponent:(NSInteger)component animated:(BOOL)animated; // scrolls the specified row to center. - (NSInteger)selectedRowInComponent:(NSInteger)component; // returns selected row. -1 if nothing selected @end @protocol UIPickerViewDataSource @required // returns the number of 'columns' to display. - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView; // returns the # of rows in each component.. - (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component; @end @protocol UIPickerViewDelegate @optional // returns width of column and height of row for each component. - (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component; - (CGFloat)pickerView:(UIPickerView *)pickerView rowHeightForComponent:(NSInteger)component; // these methods return either a plain NSString, a NSAttributedString, or a view (e.g UILabel) to display the row for the component. // for the view versions, we cache any hidden and thus unused views and pass them back for reuse. // If you return back a different object, the old one will be released. the view will be centered in the row rect - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component; - (NSAttributedString *)pickerView:(UIPickerView *)pickerView attributedTitleForRow:(NSInteger)row forComponent:(NSInteger)component NS_AVAILABLE_IOS(6_0); // attributed title is favored if both methods are implemented - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view; - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component; @end // // UIPinchGestureRecognizer.h // UIKit // // Copyright (c) 2008-2012, Apple Inc. All rights reserved. // #import #import // Begins: when two touches have moved enough to be considered a pinch // Changes: when a finger moves while two fingers remain down // Ends: when both fingers have lifted NS_CLASS_AVAILABLE_IOS(3_2) @interface UIPinchGestureRecognizer : UIGestureRecognizer { @package CGFloat _initialTouchDistance; CGFloat _initialTouchScale; NSTimeInterval _lastTouchTime; CGFloat _velocity; CGFloat _previousVelocity; CGFloat _scaleThreshold; CGAffineTransform _transform; CGPoint _anchorPoint; UITouch *_touches[2]; CGFloat _hysteresis; id _transformAnalyzer; unsigned int _endsOnSingleTouch:1; } @property (nonatomic) CGFloat scale; // scale relative to the touch points in screen coordinates @property (nonatomic,readonly) CGFloat velocity; // velocity of the pinch in scale/second @end // // UIPopoverBackgroundView.h // UIKit // // Copyright (c) 2011-2012, Apple Inc. All rights reserved. // #import #import #import #import /* The methods defined below are all to be treated as abstract; in order to subclass `UIPopoverBackgroundView`, you must supply implementations of each of the methods below. For `readwrite` properties, you must supply implementations of both of the accessors. */ NS_CLASS_AVAILABLE_IOS(5_0) @interface UIPopoverBackgroundView : UIView {} /* The arrow offset represents how far from the center of the view the center of the arrow should appear. For `UIPopoverArrowDirectionUp` and `UIPopoverArrowDirectionDown`, this is a left-to-right offset; negative is to the left. For `UIPopoverArrowDirectionLeft` and `UIPopoverArrowDirectionRight`, this is a top-to-bottom offset; negative to toward the top. This method is called inside an animation block managed by the `UIPopoverController`. */ @property (nonatomic, readwrite) CGFloat arrowOffset; /* `arrowDirection` manages which direction the popover arrow is pointing. You may be required to change the direction of the arrow while the popover is still visible on-screen. */ @property (nonatomic, readwrite) UIPopoverArrowDirection arrowDirection; /* These methods must be overridden and the values they return may not be changed during use of the `UIPopoverBackgroundView`. `arrowHeight` represents the height of the arrow in points from its base to its tip. `arrowBase` represents the the length of the base of the arrow's triangle in points. `contentViewInset` describes the distance between each edge of the background view and the corresponding edge of its content view (i.e. if it were strictly a rectangle). `arrowHeight` and `arrowBase` are also used for the drawing of the standard popover shadow. */ + (CGFloat)arrowHeight; + (CGFloat)arrowBase; + (UIEdgeInsets)contentViewInsets; /* This method may be overridden to prevent the drawing of the content inset and drop shadow inside the popover. The default implementation of this method returns YES. */ + (BOOL)wantsDefaultContentAppearance NS_AVAILABLE_IOS(6_0); @end // // UIPopoverController.h // UIKit // // Copyright (c) 2009-2012, Apple Inc. All rights reserved. // #import #import #import #import #import #import #import @class UIBarButtonItem, UIView; @protocol UIPopoverControllerDelegate; typedef NS_OPTIONS(NSUInteger, UIPopoverArrowDirection) { UIPopoverArrowDirectionUp = 1UL << 0, UIPopoverArrowDirectionDown = 1UL << 1, UIPopoverArrowDirectionLeft = 1UL << 2, UIPopoverArrowDirectionRight = 1UL << 3, UIPopoverArrowDirectionAny = UIPopoverArrowDirectionUp | UIPopoverArrowDirectionDown | UIPopoverArrowDirectionLeft | UIPopoverArrowDirectionRight, UIPopoverArrowDirectionUnknown = NSUIntegerMax }; NS_CLASS_AVAILABLE_IOS(3_2) @interface UIPopoverController : NSObject {} /* The view controller provided becomes the content view controller for the UIPopoverController. This is the designated initializer for UIPopoverController. */ - (id)initWithContentViewController:(UIViewController *)viewController; @property (nonatomic, assign) id delegate; /* The content view controller is the `UIViewController` instance in charge of the content view of the displayed popover. This property can be changed while the popover is displayed to allow different view controllers in the same popover session. */ @property (nonatomic, retain) UIViewController *contentViewController; - (void)setContentViewController:(UIViewController *)viewController animated:(BOOL)animated; /* This property allows direction manipulation of the content size of the popover. Changing the property directly is equivalent to animated=YES. The content size is limited to a minimum width of 320 and a maximum width of 600. */ @property (nonatomic) CGSize popoverContentSize; - (void)setPopoverContentSize:(CGSize)size animated:(BOOL)animated; /* Returns whether the popover is visible (presented) or not. */ @property (nonatomic, readonly, getter=isPopoverVisible) BOOL popoverVisible; /* Returns the direction the arrow is pointing on a presented popover. Before presentation, this returns UIPopoverArrowDirectionUnknown. */ @property (nonatomic, readonly) UIPopoverArrowDirection popoverArrowDirection; /* By default, a popover disallows interaction with any view outside of the popover while the popover is presented. This property allows the specification of an array of UIView instances which the user is allowed to interact with while the popover is up. */ @property (nonatomic, copy) NSArray *passthroughViews; /* -presentPopoverFromRect:inView:permittedArrowDirections:animated: allows you to present a popover from a rect in a particular view. `arrowDirections` is a bitfield which specifies what arrow directions are allowed when laying out the popover; for most uses, `UIPopoverArrowDirectionAny` is sufficient. */ - (void)presentPopoverFromRect:(CGRect)rect inView:(UIView *)view permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated; /* Like the above, but is a convenience for presentation from a `UIBarButtonItem` instance. arrowDirection limited to UIPopoverArrowDirectionUp/Down */ - (void)presentPopoverFromBarButtonItem:(UIBarButtonItem *)item permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated; /* Called to dismiss the popover programmatically. The delegate methods for "should" and "did" dismiss are not called when the popover is dismissed in this way. */ - (void)dismissPopoverAnimated:(BOOL)animated; /* Clients may wish to change the available area for popover display. The default implementation of this method always returns insets which define 10 points from the edges of the display, and presentation of popovers always accounts for the status bar. The rectangle being inset is always expressed in terms of the current device orientation; (0, 0) is always in the upper-left of the device. This may require insets to change on device rotation. */ @property (nonatomic, readwrite) UIEdgeInsets popoverLayoutMargins NS_AVAILABLE_IOS(5_0); /* Clients may customize the popover background chrome by providing a class which subclasses `UIPopoverBackgroundView` and which implements the required instance and class methods on that class. */ @property (nonatomic, readwrite, retain) Class popoverBackgroundViewClass NS_AVAILABLE_IOS(5_0); @end @protocol UIPopoverControllerDelegate @optional /* Called on the delegate when the popover controller will dismiss the popover. Return NO to prevent the dismissal of the view. */ - (BOOL)popoverControllerShouldDismissPopover:(UIPopoverController *)popoverController; /* Called on the delegate when the user has taken action to dismiss the popover. This is not called when -dismissPopoverAnimated: is called directly. */ - (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController; @end @interface UIViewController (UIPopoverController) /* contentSizeForViewInPopover allows you to set the size of the content from within the view controller. This property is read/write, and you should generally not override it. */ @property (nonatomic,readwrite) CGSize contentSizeForViewInPopover NS_AVAILABLE_IOS(3_2); /* modalInPopover is set on the view controller when you wish to force the popover hosting the view controller into modal behavior. When this is active, the popover will ignore events outside of its bounds until this is set to NO. */ @property (nonatomic,readwrite,getter=isModalInPopover) BOOL modalInPopover NS_AVAILABLE_IOS(3_2); @end // // UIPrintError.h // UIKit // // Copyright 2010-2012, Apple Inc. All rights reserved. // #import #import UIKIT_EXTERN NSString *const UIPrintErrorDomain; enum { UIPrintingNotAvailableError = 1, // cannot print at this time UIPrintNoContentError, // empty list of files or images UIPrintUnknownImageFormatError, // unrecognized image format UIPrintJobFailedError, // internal error with print job }; // // UIPrintFormatter.h // UIKit // // Copyright 2010-2012, Apple Inc. All rights reserved. // #import #import #import #import #import #import @class UIPrintPageRenderer; @class UIView, UIFont, UIColor; NS_CLASS_AVAILABLE_IOS(4_2) @interface UIPrintFormatter : NSObject { @private UIPrintPageRenderer *_printPageRenderer; CGFloat _maximumContentHeight; CGFloat _maximumContentWidth; UIEdgeInsets _contentInsets; NSInteger _startPage; NSInteger _pageCount; BOOL _needsRecalc; } @property(nonatomic,readonly,assign) UIPrintPageRenderer *printPageRenderer; // default is nil. set when formatter added to a print page renderer - (void)removeFromPrintPageRenderer; @property(nonatomic) CGFloat maximumContentHeight; // default is 0.0. limits content to width @property(nonatomic) CGFloat maximumContentWidth; // default is 0.0. limits content to height @property(nonatomic) UIEdgeInsets contentInsets; // default is UIEdgeInsetsZero. from edge of printableRect. applies to whole content. bottom inset unused @property(nonatomic) NSInteger startPage; // default is NSNotFound @property(nonatomic,readonly) NSInteger pageCount; // calculated - (CGRect)rectForPageAtIndex:(NSInteger)pageIndex; // returns empty rect if index out of range - (void)drawInRect:(CGRect)rect forPageAtIndex:(NSInteger)pageIndex; // override point to add custom drawing @end //______________________________ NS_CLASS_AVAILABLE_IOS(4_2) @interface UISimpleTextPrintFormatter : UIPrintFormatter { } - (id)initWithText:(NSString *)text; @property(nonatomic,copy) NSString *text; // cannot change once drawing started @property(nonatomic,retain) UIFont *font; @property(nonatomic,retain) UIColor *color; @property(nonatomic) NSTextAlignment textAlignment; @end //______________________________ NS_CLASS_AVAILABLE_IOS(4_2) @interface UIMarkupTextPrintFormatter : UIPrintFormatter { } - (id)initWithMarkupText:(NSString *)markupText; @property(nonatomic,copy) NSString *markupText; // cannot change once drawing started @end //______________________________ NS_CLASS_AVAILABLE_IOS(4_2) @interface UIViewPrintFormatter : UIPrintFormatter { @private UIView *_view; } @property(nonatomic,readonly) UIView *view; @end //______________________________ @interface UIView(UIPrintFormatter) - (UIViewPrintFormatter *)viewPrintFormatter; // returns a new print formatter each time - (void)drawRect:(CGRect)rect forViewPrintFormatter:(UIViewPrintFormatter *)formatter; // default calls -drawRect: @end // // UIPrintInfo.h // UIKit // // Copyright 2010-2012, Apple Inc. All rights reserved. // #import #import #import typedef NS_ENUM(NSInteger, UIPrintInfoOutputType) { UIPrintInfoOutputGeneral, // B&W or color, normal quality output for mixed text, graphics, and images UIPrintInfoOutputPhoto, // B&W or color, best quality output for images UIPrintInfoOutputGrayscale, // B&W content only }; typedef NS_ENUM(NSInteger, UIPrintInfoOrientation) { UIPrintInfoOrientationPortrait, UIPrintInfoOrientationLandscape, }; typedef NS_ENUM(NSInteger, UIPrintInfoDuplex) { UIPrintInfoDuplexNone, UIPrintInfoDuplexLongEdge, // flip back page along long edge (same orientation in portrait, flipped for landscape) UIPrintInfoDuplexShortEdge, // flip back page along short edge (flipped orientation for portrait, same in landscape) }; NS_CLASS_AVAILABLE_IOS(4_2) @interface UIPrintInfo : NSObject { @private NSString *_printerID; NSString *_jobName; UIPrintInfoOutputType _outputType; UIPrintInfoOrientation _orientation; UIPrintInfoDuplex _duplex; NSInteger _copies; BOOL _scaleUp; } + (UIPrintInfo *)printInfo; + (UIPrintInfo *)printInfoWithDictionary:(NSDictionary *)dictionary; - (NSDictionary *)dictionaryRepresentation; @property(nonatomic,copy) NSString *printerID; // default is nil. set after user selects printer @property(nonatomic,copy) NSString *jobName; // default is application name @property(nonatomic) UIPrintInfoOutputType outputType; // default is UIPrintInfoOutputGeneral @property(nonatomic) UIPrintInfoOrientation orientation; // default is UIPrintInfoOrientationPortrait @property(nonatomic) UIPrintInfoDuplex duplex; // default is based on document type (none for photo, long edge for other) @end // // UIPrintInteractionController.h // UIKit // // Copyright 2010-2012, Apple Inc. All rights reserved. // #import #import #import #import @class UIPrintInteractionController, UIPrintInfo, UIPrintPaper, UIPrintPageRenderer, UIPrintFormatter; @class UIView, UIBarButtonItem; typedef void (^UIPrintInteractionCompletionHandler)(UIPrintInteractionController *printInteractionController, BOOL completed, NSError *error); @protocol UIPrintInteractionControllerDelegate; NS_CLASS_AVAILABLE_IOS(4_2) @interface UIPrintInteractionController : NSObject { @private UIPrintInfo *_printInfo; id _delegate; BOOL _showsPageRange; UIPrintPageRenderer *_printPageRenderer; UIPrintFormatter *_printFormatter; id _printingItem; NSArray *_printingItems; UIPrintPaper *_printPaper; UIPrintInteractionCompletionHandler _completionHandler; UIBackgroundTaskIdentifier _backgroundTaskIdentifier; id _printState; } + (BOOL)isPrintingAvailable; // return YES if system supports printing. use this to hide HI for unsupported devices. + (NSSet *)printableUTIs; // return set of all document UTI types we can print + (BOOL)canPrintURL:(NSURL *)url; + (BOOL)canPrintData:(NSData *)data; + (UIPrintInteractionController *)sharedPrintController; @property(nonatomic,retain) UIPrintInfo *printInfo; // changes to printInfo ignored while printing. default is nil @property(nonatomic,assign) id delegate; // not retained. default is nil @property(nonatomic) BOOL showsPageRange; // default is NO. @property(nonatomic,readonly) UIPrintPaper *printPaper; // set after printer selection @property(nonatomic,retain) UIPrintPageRenderer *printPageRenderer; // calls class to render each page @property(nonatomic,retain) UIPrintFormatter *printFormatter; // uses a single formatter to fill the pages @property(nonatomic,copy) id printingItem; // single NSData, NSURL, UIImage, ALAsset @property(nonatomic,copy) NSArray *printingItems; // array of NSData, NSURL, UIImage, ALAsset. does not support page range - (BOOL)presentAnimated:(BOOL)animated completionHandler:(UIPrintInteractionCompletionHandler)completion; // iPhone - (BOOL)presentFromRect:(CGRect)rect inView:(UIView *)view animated:(BOOL)animated completionHandler:(UIPrintInteractionCompletionHandler)completion; // iPad - (BOOL)presentFromBarButtonItem:(UIBarButtonItem *)item animated:(BOOL)animated completionHandler:(UIPrintInteractionCompletionHandler)completion; // iPad - (void)dismissAnimated:(BOOL)animated; @end @protocol UIPrintInteractionControllerDelegate @optional - (UIViewController *)printInteractionControllerParentViewController:(UIPrintInteractionController *)printInteractionController; - (UIPrintPaper *)printInteractionController:(UIPrintInteractionController *)printInteractionController choosePaper:(NSArray *)paperList; - (void)printInteractionControllerWillPresentPrinterOptions:(UIPrintInteractionController *)printInteractionController; - (void)printInteractionControllerDidPresentPrinterOptions:(UIPrintInteractionController *)printInteractionController; - (void)printInteractionControllerWillDismissPrinterOptions:(UIPrintInteractionController *)printInteractionController; - (void)printInteractionControllerDidDismissPrinterOptions:(UIPrintInteractionController *)printInteractionController; - (void)printInteractionControllerWillStartJob:(UIPrintInteractionController *)printInteractionController; - (void)printInteractionControllerDidFinishJob:(UIPrintInteractionController *)printInteractionController; @end // // UIPrintPageRenderer.h // UIKit // // Copyright 2010-2012, Apple Inc. All rights reserved. // #import #import #import @class UIPrintFormatter; NS_CLASS_AVAILABLE_IOS(4_2) @interface UIPrintPageRenderer : NSObject { @private CGFloat _headerHeight; CGFloat _footerHeight; CGRect _paperRect; CGRect _printableRect; NSMutableArray *_printFormatters; CGContextRef _printContext; } @property(nonatomic) CGFloat headerHeight; // top of contentRect from printableRect @property(nonatomic) CGFloat footerHeight; // bottom of contentRect from printableRect @property(nonatomic,readonly) CGRect paperRect; // complete paper rect. origin is (0,0) @property(nonatomic,readonly) CGRect printableRect; // imageable area inside paper rect @property(nonatomic,copy) NSArray *printFormatters; - (NSArray *)printFormattersForPageAtIndex:(NSInteger)pageIndex; - (void)addPrintFormatter:(UIPrintFormatter *)formatter startingAtPageAtIndex:(NSInteger)pageIndex; - (NSInteger)numberOfPages; // override point. called to get page count. default returns maximum page count needed for all formatters or 0 - (void)prepareForDrawingPages:(NSRange)range; // override point. default does nothing. called before requesting a set of pages to draw - (void)drawPageAtIndex:(NSInteger)pageIndex inRect:(CGRect)printableRect; // override point. calls the various draw methods below - (void)drawPrintFormatter:(UIPrintFormatter *)printFormatter forPageAtIndex:(NSInteger)pageIndex; // override point. calls each formatter to draw for that page. - (void)drawHeaderForPageAtIndex:(NSInteger)pageIndex inRect:(CGRect)headerRect; // override point. default does nothing - (void)drawContentForPageAtIndex:(NSInteger)pageIndex inRect:(CGRect)contentRect; // override point. default does nothing - (void)drawFooterForPageAtIndex:(NSInteger)pageIndex inRect:(CGRect)footerRect; // override point. default does nothing @end // // UIPrintPaper.h // UIKit // // Copyright 2010-2012, Apple Inc. All rights reserved. // #import #import #import NS_CLASS_AVAILABLE_IOS(4_2) @interface UIPrintPaper : NSObject { @private int _paperOrientation; id _internal; } + (UIPrintPaper *)bestPaperForPageSize:(CGSize)contentSize withPapersFromArray:(NSArray *)paperList; // for use by delegate. pass in list @property(readonly) CGSize paperSize; @property(readonly) CGRect printableRect; @end //_____________________________________________ @interface UIPrintPaper(Deprecated_Nonfunctional) - (CGRect)printRect; @end // // UIProgressView.h // UIKit // // Copyright (c) 2005-2012, Apple Inc. All rights reserved. // #import #import #import @class UIImageView; typedef NS_ENUM(NSInteger, UIProgressViewStyle) { UIProgressViewStyleDefault, // normal progress bar UIProgressViewStyleBar, // for use in a toolbar }; NS_CLASS_AVAILABLE_IOS(2_0) @interface UIProgressView : UIView { @private UIProgressViewStyle _progressViewStyle; float _progress; UIBarStyle _barStyle; UIColor* _progressTintColor; UIColor* _trackTintColor; UIImageView* _trackView; UIImageView* _progressView; BOOL _isAnimating; } - (id)initWithProgressViewStyle:(UIProgressViewStyle)style; // sets the view height according to the style @property(nonatomic) UIProgressViewStyle progressViewStyle; // default is UIProgressViewStyleDefault @property(nonatomic) float progress; // 0.0 .. 1.0, default is 0.0. values outside are pinned. @property(nonatomic, retain) UIColor* progressTintColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; @property(nonatomic, retain) UIColor* trackTintColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; @property(nonatomic, retain) UIImage* progressImage NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; @property(nonatomic, retain) UIImage* trackImage NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; - (void)setProgress:(float)progress animated:(BOOL)animated NS_AVAILABLE_IOS(5_0); @end // // UIReferenceLibraryViewController.h // UIKit // // Copyright 2011-2012, Apple Inc. All rights reserved. // #import NS_CLASS_AVAILABLE_IOS(5_0) @interface UIReferenceLibraryViewController : UIViewController {} /* Returns YES if any installed dictionary has a definition for the provided term. */ + (BOOL)dictionaryHasDefinitionForTerm:(NSString *)term; /* Initializes an instance of a UIReferenceLibraryViewController with the term provided. */ - (id)initWithTerm:(NSString *)term; @end // // UIRefreshControl.h // UIKit // // Copyright 2012 Apple Inc. All rights reserved. // #import #import #import NS_CLASS_AVAILABLE_IOS(6_0) @interface UIRefreshControl : UIControl /* The designated initializer * This initializes a UIRefreshControl with a default height and width. * Once assigned to a UITableViewController, the frame of the control is managed automatically. * When a user has pulled-to-refresh, the UIRefreshControl fires its UIControlEventValueChanged event. */ - (id)init; @property (nonatomic, readonly, getter=isRefreshing) BOOL refreshing; @property (nonatomic, retain) UIColor *tintColor UI_APPEARANCE_SELECTOR; @property (nonatomic, retain) NSAttributedString *attributedTitle UI_APPEARANCE_SELECTOR; // May be used to indicate to the refreshControl that an external event has initiated the refresh action - (void)beginRefreshing NS_AVAILABLE_IOS(6_0); // Must be explicitly called when the refreshing has completed - (void)endRefreshing NS_AVAILABLE_IOS(6_0); @end // // UIResponder.h // UIKit // // Copyright (c) 2005-2012, Apple Inc. All rights reserved. // #import #import #import NS_CLASS_AVAILABLE_IOS(2_0) @interface UIResponder : NSObject { @private } - (UIResponder*)nextResponder; - (BOOL)canBecomeFirstResponder; // default is NO - (BOOL)becomeFirstResponder; - (BOOL)canResignFirstResponder; // default is YES - (BOOL)resignFirstResponder; - (BOOL)isFirstResponder; // Generally, all responders which do custom touch handling should override all four of these methods. // Your responder will receive either touchesEnded:withEvent: or touchesCancelled:withEvent: for each // touch it is handling (those touches it received in touchesBegan:withEvent:). // *** You must handle cancelled touches to ensure correct behavior in your application. Failure to // do so is very likely to lead to incorrect behavior or crashes. - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event; - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event; - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event; - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event; - (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event NS_AVAILABLE_IOS(3_0); - (void)motionEnded:(UIEventSubtype)motion withEvent:(UIEvent *)event NS_AVAILABLE_IOS(3_0); - (void)motionCancelled:(UIEventSubtype)motion withEvent:(UIEvent *)event NS_AVAILABLE_IOS(3_0); - (void)remoteControlReceivedWithEvent:(UIEvent *)event NS_AVAILABLE_IOS(4_0); - (BOOL)canPerformAction:(SEL)action withSender:(id)sender NS_AVAILABLE_IOS(3_0); @property(nonatomic,readonly) NSUndoManager *undoManager NS_AVAILABLE_IOS(3_0); @end @interface NSObject(UIResponderStandardEditActions) // these methods are not implemented in NSObject - (void)cut:(id)sender NS_AVAILABLE_IOS(3_0); - (void)copy:(id)sender NS_AVAILABLE_IOS(3_0); - (void)paste:(id)sender NS_AVAILABLE_IOS(3_0); - (void)select:(id)sender NS_AVAILABLE_IOS(3_0); - (void)selectAll:(id)sender NS_AVAILABLE_IOS(3_0); - (void)delete:(id)sender NS_AVAILABLE_IOS(3_2); - (void)makeTextWritingDirectionLeftToRight:(id)sender NS_AVAILABLE_IOS(5_0); - (void)makeTextWritingDirectionRightToLeft:(id)sender NS_AVAILABLE_IOS(5_0); - (void)toggleBoldface:(id)sender NS_AVAILABLE_IOS(6_0); - (void)toggleItalics:(id)sender NS_AVAILABLE_IOS(6_0); - (void)toggleUnderline:(id)sender NS_AVAILABLE_IOS(6_0); @end @interface UIResponder (UIResponderInputViewAdditions) // Called and presented when object becomes first responder. Goes up the responder chain. @property (readonly, retain) UIView *inputView NS_AVAILABLE_IOS(3_2); @property (readonly, retain) UIView *inputAccessoryView NS_AVAILABLE_IOS(3_2); // If called while object is first responder, reloads inputView and inputAccessoryView. Otherwise ignored. - (void)reloadInputViews NS_AVAILABLE_IOS(3_2); @end // // UIRotationGestureRecognizer.h // UIKit // // Copyright (c) 2009-2012, Apple Inc. All rights reserved. // #import #import // Begins: when two touches have moved enough to be considered a rotation // Changes: when a finger moves while two fingers are down // Ends: when both fingers have lifted NS_CLASS_AVAILABLE_IOS(3_2) @interface UIRotationGestureRecognizer : UIGestureRecognizer { @package double _initialTouchDistance; double _initialTouchAngle; double _currentTouchAngle; NSInteger _currentRotationCount; NSTimeInterval _lastTouchTime; CGFloat _velocity; CGFloat _previousVelocity; CGPoint _anchorPoint; id _transformAnalyzer; UITouch *_touches[2]; } @property (nonatomic) CGFloat rotation; // rotation in radians @property (nonatomic,readonly) CGFloat velocity; // velocity of the pinch in radians/second @end // // UIScreen.h // UIKit // // Copyright (c) 2007-2012, Apple Inc. All rights reserved. // #import #import #import @class UIScreenMode, CADisplayLink; // Object is the UIScreen that represents the new screen. Connection notifications are not sent for screens present when the application is first launched UIKIT_EXTERN NSString *const UIScreenDidConnectNotification NS_AVAILABLE_IOS(3_2); // Object is the UIScreen that represented the disconnected screen. UIKIT_EXTERN NSString *const UIScreenDidDisconnectNotification NS_AVAILABLE_IOS(3_2); // Object is the UIScreen which changed. [object currentMode] is the new UIScreenMode. UIKIT_EXTERN NSString *const UIScreenModeDidChangeNotification NS_AVAILABLE_IOS(3_2); UIKIT_EXTERN NSString *const UIScreenBrightnessDidChangeNotification NS_AVAILABLE_IOS(5_0); // when the connected screen is overscanning, UIScreen can attempt to compensate for the overscan to avoid clipping typedef NS_ENUM(NSInteger, UIScreenOverscanCompensation) { UIScreenOverscanCompensationScale, // the final composited framebuffer for the screen is scaled to avoid clipping UIScreenOverscanCompensationInsetBounds, // the screen's bounds will be inset in the framebuffer to avoid clipping. no scaling will occur UIScreenOverscanCompensationInsetApplicationFrame, // the screen's applicationFrame will be inset in the bounds. content drawn in the bounds outside applicationFrame may be clipped }; NS_CLASS_AVAILABLE_IOS(2_0) @interface UIScreen : NSObject { @private id _display; CGRect _bounds; CGFloat _scale; CGFloat _horizontalScale; struct { unsigned int bitsPerComponent:4; unsigned int initialized:1; unsigned int connected:1; unsigned int overscanCompensation:2; } _screenFlags; } + (NSArray *)screens NS_AVAILABLE_IOS(3_2); // all screens currently attached to the device + (UIScreen *)mainScreen; // the device's internal screen @property(nonatomic,readonly) CGRect bounds; // Bounds of entire screen in points @property(nonatomic,readonly) CGRect applicationFrame; // Frame of application screen area in points (i.e. entire screen minus status bar if visible) @property(nonatomic,readonly) CGFloat scale NS_AVAILABLE_IOS(4_0); @property(nonatomic,readonly,copy) NSArray *availableModes NS_AVAILABLE_IOS(3_2); // The list of modes that this screen supports @property(nonatomic,readonly,retain) UIScreenMode *preferredMode NS_AVAILABLE_IOS(4_3); // Preferred mode of this screen. Choosing this mode will likely produce the best results @property(nonatomic,retain) UIScreenMode *currentMode NS_AVAILABLE_IOS(3_2); // Current mode of this screen @property(nonatomic) UIScreenOverscanCompensation overscanCompensation NS_AVAILABLE_IOS(5_0); // Default is UIScreenOverscanCompensationScale. Determines how the screen behaves if the connected display is overscanning @property(nonatomic,readonly,retain) UIScreen *mirroredScreen NS_AVAILABLE_IOS(4_3); // The screen being mirrored by the receiver. nil if mirroring is disabled or unsupported. Moving a UIWindow to this screen will disable mirroring @property(nonatomic) CGFloat brightness NS_AVAILABLE_IOS(5_0); // 0 .. 1.0, where 1.0 is maximum brightness. Only supported by main screen. @property(nonatomic) BOOL wantsSoftwareDimming NS_AVAILABLE_IOS(5_0); // Default is NO. If YES, brightness levels lower than that of which the hardware is capable are emulated in software, if neccessary. Having enabled may entail performance cost. - (CADisplayLink *)displayLinkWithTarget:(id)target selector:(SEL)sel NS_AVAILABLE_IOS(4_0); @end // // UIScreenMode.h // UIKit // // Copyright (c) 2009-2012, Apple Inc. All rights reserved. // #import #import #import NS_CLASS_AVAILABLE_IOS(3_2) @interface UIScreenMode : NSObject { @private id _mode; } @property(readonly,nonatomic) CGSize size; // The width and height in pixels @property(readonly,nonatomic) CGFloat pixelAspectRatio; // The aspect ratio of a single pixel. The ratio is defined as X/Y. @end // // UIScrollView.h // UIKit // // Copyright (c) 2007-2012, Apple Inc. All rights reserved. // #import #import #import #import #import typedef NS_ENUM(NSInteger, UIScrollViewIndicatorStyle) { UIScrollViewIndicatorStyleDefault, // black with white border. good against any background UIScrollViewIndicatorStyleBlack, // black only. smaller. good against a white background UIScrollViewIndicatorStyleWhite // white only. smaller. good against a black background }; UIKIT_EXTERN const float UIScrollViewDecelerationRateNormal NS_AVAILABLE_IOS(3_0); UIKIT_EXTERN const float UIScrollViewDecelerationRateFast NS_AVAILABLE_IOS(3_0); @class UIEvent, UIImageView, UIPanGestureRecognizer, UIPinchGestureRecognizer; @protocol UIScrollViewDelegate; NS_CLASS_AVAILABLE_IOS(2_0) @interface UIScrollView : UIView { @package CGSize _contentSize; UIEdgeInsets _contentInset; id _delegate; UIImageView* _verticalScrollIndicator; UIImageView* _horizontalScrollIndicator; UIEdgeInsets _scrollIndicatorInset; struct { unsigned int tracking:1; unsigned int dragging:1; unsigned int verticalBounceEnabled:1; unsigned int horizontalBounceEnabled:1; unsigned int verticalBouncing:1; unsigned int horizontalBouncing:1; unsigned int bouncesZoom:1; unsigned int zoomBouncing:1; unsigned int alwaysBounceHorizontal:1; unsigned int alwaysBounceVertical:1; unsigned int preventScrollingContainer:1; unsigned int canCancelContentTouches:1; unsigned int delaysContentTouches:1; unsigned int programmaticScrollDisabled:1; unsigned int scrollDisabled:1; unsigned int zoomDisabled:1; unsigned int scrollTriggered:1; unsigned int scrollDisabledOnTouchBegan:1; unsigned int ignoreNextTouchesMoved:1; unsigned int cancelNextContentTouchEnded:1; unsigned int inContentViewCall:1; unsigned int dontSelect:1; unsigned int contentTouched:1; unsigned int cantCancel:1; unsigned int directionalLockEnabled:1; unsigned int directionalLockAutoEnabled:1; unsigned int lockVertical:1; unsigned int lockHorizontal:1; unsigned int keepLocked:1; unsigned int showsHorizontalScrollIndicator:1; unsigned int showsVerticalScrollIndicator:1; unsigned int indicatorStyle:2; unsigned int inZoom:1; unsigned int hideIndicatorsInZoom:1; unsigned int pushedTrackingMode:1; unsigned int multipleDrag:1; unsigned int displayingScrollIndicators:1; unsigned int verticalIndicatorShrunk:1; unsigned int horizontalIndicatorShrunk:1; unsigned int contentFitDisableScrolling:1; unsigned int pagingEnabled:1; unsigned int pagingLeft:1; unsigned int pagingRight:1; unsigned int pagingUp:1; unsigned int pagingDown:1; unsigned int lastHorizontalDirection:1; unsigned int lastVerticalDirection:1; unsigned int dontScrollToTop:1; unsigned int scrollingToTop:1; unsigned int useGestureRecognizers:1; unsigned int singleFingerPan:1; unsigned int autoscrolling:1; unsigned int automaticContentOffsetAdjustmentDisabled:1; unsigned int skipStartOffsetAdjustment:1; unsigned int delegateScrollViewDidScroll:1; unsigned int delegateScrollViewDidZoom:1; unsigned int delegateContentSizeForZoomScale:1; unsigned int preserveCenterDuringRotation:1; unsigned int delaysTrackingWhileDecelerating:1; unsigned int pinnedZoomMin:1; unsigned int pinnedXMin:1; unsigned int pinnedYMin:1; unsigned int pinnedXMax:1; unsigned int pinnedYMax:1; unsigned int skipLinkChecks:1; unsigned int staysCenteredDuringPinch:1; unsigned int wasDelayingPinchForSystemGestures:1; unsigned int systemGesturesRecognitionPossible:1; unsigned int disableContentOffsetRounding:1; unsigned int adjustedDecelerationTargetX:1; unsigned int adjustedDecelerationTargetY:1; unsigned int hasScrolled:1; unsigned int wantsConstrainedContentSize:1; } _scrollViewFlags; CGFloat _farthestDistance; CGPoint _initialTouchPosition; CGPoint _startTouchPosition; CFTimeInterval _startTouchTime; double _startOffsetX; double _startOffsetY; double _lastUpdateOffsetX; double _lastUpdateOffsetY; CGPoint _lastTouchPosition; CFTimeInterval _lastTouchTime; CFTimeInterval _lastUpdateTime; UIView *_contentView; float _minimumZoomScale; float _maximumZoomScale; UIView *_zoomView; double _horizontalVelocity; double _verticalVelocity; double _previousHorizontalVelocity; double _previousVerticalVelocity; id _scrollHeartbeat; CGPoint _pageDecelerationTarget; CGSize _decelerationFactor; CGPoint _adjustedDecelerationTarget; CGSize _adjustedDecelerationFactor; double _decelerationLnFactorH; double _decelerationLnFactorV; NSArray* _deferredBeginTouchesInfo; UIImageView * __strong *_shadows; id _scrollNotificationViews; CFTimeInterval _contentOffsetAnimationDuration; id _animation; id _zoomAnimation; id _pinch; id _pan; id _swipe; CGFloat _pagingSpringPull; CGFloat _pagingFriction; NSInteger _fastScrollCount; CGFloat _fastScrollMultiplier; CGFloat _fastScrollStartMultiplier; CFTimeInterval _fastScrollEndTime; CGPoint _parentAdjustment; CGPoint _rotationCenterPoint; CGFloat _accuracy; CGFloat _hysteresis; NSUInteger _zoomAnimationCount; } @property(nonatomic) CGPoint contentOffset; // default CGPointZero @property(nonatomic) CGSize contentSize; // default CGSizeZero @property(nonatomic) UIEdgeInsets contentInset; // default UIEdgeInsetsZero. add additional scroll area around content @property(nonatomic,assign) id delegate; // default nil. weak reference @property(nonatomic,getter=isDirectionalLockEnabled) BOOL directionalLockEnabled; // default NO. if YES, try to lock vertical or horizontal scrolling while dragging @property(nonatomic) BOOL bounces; // default YES. if YES, bounces past edge of content and back again @property(nonatomic) BOOL alwaysBounceVertical; // default NO. if YES and bounces is YES, even if content is smaller than bounds, allow drag vertically @property(nonatomic) BOOL alwaysBounceHorizontal; // default NO. if YES and bounces is YES, even if content is smaller than bounds, allow drag horizontally @property(nonatomic,getter=isPagingEnabled) BOOL pagingEnabled; // default NO. if YES, stop on multiples of view bounds @property(nonatomic,getter=isScrollEnabled) BOOL scrollEnabled; // default YES. turn off any dragging temporarily @property(nonatomic) BOOL showsHorizontalScrollIndicator; // default YES. show indicator while we are tracking. fades out after tracking @property(nonatomic) BOOL showsVerticalScrollIndicator; // default YES. show indicator while we are tracking. fades out after tracking @property(nonatomic) UIEdgeInsets scrollIndicatorInsets; // default is UIEdgeInsetsZero. adjust indicators inside of insets @property(nonatomic) UIScrollViewIndicatorStyle indicatorStyle; // default is UIScrollViewIndicatorStyleDefault @property(nonatomic) float decelerationRate NS_AVAILABLE_IOS(3_0); - (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated; // animate at constant velocity to new offset - (void)scrollRectToVisible:(CGRect)rect animated:(BOOL)animated; // scroll so rect is just visible (nearest edges). nothing if rect completely visible - (void)flashScrollIndicators; // displays the scroll indicators for a short time. This should be done whenever you bring the scroll view to front. /* Scrolling with no scroll bars is a bit complex. on touch down, we don't know if the user will want to scroll or track a subview like a control. on touch down, we start a timer and also look at any movement. if the time elapses without sufficient change in position, we start sending events to the hit view in the content subview. if the user then drags far enough, we switch back to dragging and cancel any tracking in the subview. the methods below are called by the scroll view and give subclasses override points to add in custom behaviour. you can remove the delay in delivery of touchesBegan:withEvent: to subviews by setting delaysContentTouches to NO. */ @property(nonatomic,readonly,getter=isTracking) BOOL tracking; // returns YES if user has touched. may not yet have started dragging @property(nonatomic,readonly,getter=isDragging) BOOL dragging; // returns YES if user has started scrolling. this may require some time and or distance to move to initiate dragging @property(nonatomic,readonly,getter=isDecelerating) BOOL decelerating; // returns YES if user isn't dragging (touch up) but scroll view is still moving @property(nonatomic) BOOL delaysContentTouches; // default is YES. if NO, we immediately call -touchesShouldBegin:withEvent:inContentView: @property(nonatomic) BOOL canCancelContentTouches; // default is YES. if NO, then once we start tracking, we don't try to drag if the touch moves // override points for subclasses to control delivery of touch events to subviews of the scroll view // called before touches are delivered to a subview of the scroll view. if it returns NO the touches will not be delivered to the subview // default returns YES - (BOOL)touchesShouldBegin:(NSSet *)touches withEvent:(UIEvent *)event inContentView:(UIView *)view; // called before scrolling begins if touches have already been delivered to a subview of the scroll view. if it returns NO the touches will continue to be delivered to the subview and scrolling will not occur // not called if canCancelContentTouches is NO. default returns YES if view isn't a UIControl - (BOOL)touchesShouldCancelInContentView:(UIView *)view; /* the following properties and methods are for zooming. as the user tracks with two fingers, we adjust the offset and the scale of the content. When the gesture ends, you should update the content as necessary. Note that the gesture can end and a finger could still be down. While the gesture is in progress, we do not send any tracking calls to the subview. the delegate must implement both viewForZoomingInScrollView: and scrollViewDidEndZooming:withView:atScale: in order for zooming to work and the max/min zoom scale must be different note that we are not scaling the actual scroll view but the 'content view' returned by the delegate. the delegate must return a subview, not the scroll view itself, from viewForZoomingInScrollview: */ @property(nonatomic) float minimumZoomScale; // default is 1.0 @property(nonatomic) float maximumZoomScale; // default is 1.0. must be > minimum zoom scale to enable zooming @property(nonatomic) float zoomScale NS_AVAILABLE_IOS(3_0); // default is 1.0 - (void)setZoomScale:(float)scale animated:(BOOL)animated NS_AVAILABLE_IOS(3_0); - (void)zoomToRect:(CGRect)rect animated:(BOOL)animated NS_AVAILABLE_IOS(3_0); @property(nonatomic) BOOL bouncesZoom; // default is YES. if set, user can go past min/max zoom while gesturing and the zoom will animate to the min/max value at gesture end @property(nonatomic,readonly,getter=isZooming) BOOL zooming; // returns YES if user in zoom gesture @property(nonatomic,readonly,getter=isZoomBouncing) BOOL zoomBouncing; // returns YES if we are in the middle of zooming back to the min/max value // When the user taps the status bar, the scroll view beneath the touch which is closest to the status bar will be scrolled to top, but only if its `scrollsToTop` property is YES, its delegate does not return NO from `shouldScrollViewScrollToTop`, and it is not already at the top. // On iPhone, we execute this gesture only if there's one on-screen scroll view with `scrollsToTop` == YES. If more than one is found, none will be scrolled. @property(nonatomic) BOOL scrollsToTop; // default is YES. // Use these accessors to configure the scroll view's built-in gesture recognizers. // Do not change the gestures' delegates or override the getters for these properties. @property(nonatomic, readonly) UIPanGestureRecognizer *panGestureRecognizer NS_AVAILABLE_IOS(5_0); // `pinchGestureRecognizer` will return nil when zooming is disabled. @property(nonatomic, readonly) UIPinchGestureRecognizer *pinchGestureRecognizer NS_AVAILABLE_IOS(5_0); @end @protocol UIScrollViewDelegate @optional - (void)scrollViewDidScroll:(UIScrollView *)scrollView; // any offset changes - (void)scrollViewDidZoom:(UIScrollView *)scrollView NS_AVAILABLE_IOS(3_2); // any zoom scale changes // called on start of dragging (may require some time and or distance to move) - (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView; // called on finger up if the user dragged. velocity is in points/second. targetContentOffset may be changed to adjust where the scroll view comes to rest. not called when pagingEnabled is YES - (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset NS_AVAILABLE_IOS(5_0); // called on finger up if the user dragged. decelerate is true if it will continue moving afterwards - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate; - (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView; // called on finger up as we are moving - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView; // called when scroll view grinds to a halt - (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView; // called when setContentOffset/scrollRectVisible:animated: finishes. not called if not animating - (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView; // return a view that will be scaled. if delegate returns nil, nothing happens - (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView *)view NS_AVAILABLE_IOS(3_2); // called before the scroll view begins zooming its content - (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale; // scale between minimum and maximum. called after any 'bounce' animations - (BOOL)scrollViewShouldScrollToTop:(UIScrollView *)scrollView; // return a yes if you want to scroll to the top. if not defined, assumes YES - (void)scrollViewDidScrollToTop:(UIScrollView *)scrollView; // called when scrolling animation finished. may be called immediately if already at top @end // // UISearchBar.h // UIKit // // Copyright (c) 2008-2012, Apple Inc. All rights reserved. // #import #import #import #import #import #import typedef NS_ENUM(NSInteger, UISearchBarIcon) { UISearchBarIconSearch, // The magnifying glass UISearchBarIconClear, // The circle with an x in it UISearchBarIconBookmark, // The open book icon UISearchBarIconResultsList, // The list lozenge icon }; @protocol UISearchBarDelegate; @class UITextField, UILabel, UIButton, UIColor; NS_CLASS_AVAILABLE_IOS(2_0) @interface UISearchBar : UIView { @private UITextField *_searchField; UILabel *_promptLabel; UIButton *_cancelButton; id _delegate; id _controller; UIColor *_tintColor; UIImageView *_separator; NSString *_cancelButtonText; NSArray *_scopes; NSInteger _selectedScope; UIView *_background; UIView *_scopeBar; UIEdgeInsets _contentInset; UIImageView *_shadowView; id _appearanceStorage; struct { unsigned int barStyle:3; unsigned int showsBookmarkButton:1; unsigned int showsCancelButton:1; unsigned int isTranslucent:1; unsigned int autoDisableCancelButton:1; unsigned int showsScopeBar:1; unsigned int hideBackground:1; unsigned int combinesLandscapeBars:1; unsigned int usesEmbeddedAppearance:1; unsigned int showsSearchResultsButton:1; unsigned int searchResultsButtonSelected:1; unsigned int pretendsIsInBar:1; unsigned int disabled:1; } _searchBarFlags; } @property(nonatomic) UIBarStyle barStyle; // default is UIBarStyleDefault (blue) @property(nonatomic,assign) id delegate; // weak reference. default is nil @property(nonatomic,copy) NSString *text; // current/starting search text @property(nonatomic,copy) NSString *prompt; // default is nil @property(nonatomic,copy) NSString *placeholder; // default is nil @property(nonatomic) BOOL showsBookmarkButton; // default is NO @property(nonatomic) BOOL showsCancelButton; // default is NO @property(nonatomic) BOOL showsSearchResultsButton NS_AVAILABLE_IOS(3_2); // default is NO @property(nonatomic, getter=isSearchResultsButtonSelected) BOOL searchResultsButtonSelected NS_AVAILABLE_IOS(3_2); // default is NO - (void)setShowsCancelButton:(BOOL)showsCancelButton animated:(BOOL)animated NS_AVAILABLE_IOS(3_0); @property(nonatomic,retain) UIColor *tintColor; // default is nil @property(nonatomic,assign,getter=isTranslucent) BOOL translucent NS_AVAILABLE_IOS(3_0); // Default is NO. Always YES if barStyle is set to UIBarStyleBlackTranslucent // available text input traits @property(nonatomic) UITextAutocapitalizationType autocapitalizationType; // default is UITextAutocapitalizationTypeNone @property(nonatomic) UITextAutocorrectionType autocorrectionType; // default is UITextAutocorrectionTypeDefault @property(nonatomic) UITextSpellCheckingType spellCheckingType; // default is UITextSpellCheckingTypeDefault @property(nonatomic) UIKeyboardType keyboardType; // default is UIKeyboardTypeDefault @property(nonatomic,copy) NSArray *scopeButtonTitles NS_AVAILABLE_IOS(3_0); // array of NSStrings. no scope bar shown unless 2 or more items @property(nonatomic) NSInteger selectedScopeButtonIndex NS_AVAILABLE_IOS(3_0); // index into array of scope button titles. default is 0. ignored if out of range @property(nonatomic) BOOL showsScopeBar NS_AVAILABLE_IOS(3_0); // default is NO. if YES, shows the scope bar. call sizeToFit: to update frame /* Allow placement of an input accessory view to the keyboard for the search bar */ @property (nonatomic, readwrite, retain) UIView *inputAccessoryView; // 1pt wide images and resizable images will be scaled or tiled according to the resizable area, otherwise the image will be tiled @property(nonatomic,retain) UIImage *backgroundImage NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; @property(nonatomic,retain) UIImage *scopeBarBackgroundImage NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; /* In general, you should specify a value for the normal state to be used by other states which don't have a custom value set */ /* The rounded-rect search text field image. Valid states are UIControlStateNormal and UIControlStateDisabled */ - (void)setSearchFieldBackgroundImage:(UIImage *)backgroundImage forState:(UIControlState)state NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; - (UIImage *)searchFieldBackgroundImageForState:(UIControlState)state NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; - (void)setImage:(UIImage *)iconImage forSearchBarIcon:(UISearchBarIcon)icon state:(UIControlState)state NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; - (UIImage *)imageForSearchBarIcon:(UISearchBarIcon)icon state:(UIControlState)state NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; // // Customizing the appearance of the scope bar buttons. // /* If backgroundImage is an image returned from -[UIImage resizableImageWithCapInsets:] the cap widths will be calculated from the edge insets, otherwise, the cap width will be calculated by subtracting one from the image's width then dividing by 2. The cap widths will also be used as the margins for text placement. To adjust the margin use the margin adjustment methods. */ - (void)setScopeBarButtonBackgroundImage:(UIImage *)backgroundImage forState:(UIControlState)state NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; - (UIImage *)scopeBarButtonBackgroundImageForState:(UIControlState)state NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; /* To customize the segmented control appearance you will need to provide divider images to go between two unselected segments (leftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateNormal), selected on the left and unselected on the right (leftSegmentState:UIControlStateSelected rightSegmentState:UIControlStateNormal), and unselected on the left and selected on the right (leftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateSelected). */ - (void)setScopeBarButtonDividerImage:(UIImage *)dividerImage forLeftSegmentState:(UIControlState)leftState rightSegmentState:(UIControlState)rightState NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; - (UIImage *)scopeBarButtonDividerImageForLeftSegmentState:(UIControlState)leftState rightSegmentState:(UIControlState)rightState NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; /* You may specify the font, text color, text shadow color, and text shadow offset for the title in the text attributes dictionary, using the keys found in UIStringDrawing.h. */ - (void)setScopeBarButtonTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; - (NSDictionary *)scopeBarButtonTitleTextAttributesForState:(UIControlState)state NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; /* To nudge the position of the search text field background in the search bar */ @property(nonatomic) UIOffset searchFieldBackgroundPositionAdjustment NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; /* To nudge the position of the text within the search text field background */ @property(nonatomic) UIOffset searchTextPositionAdjustment NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; /* To nudge the position of the icon within the search text field */ - (void)setPositionAdjustment:(UIOffset)adjustment forSearchBarIcon:(UISearchBarIcon)icon NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; - (UIOffset)positionAdjustmentForSearchBarIcon:(UISearchBarIcon)icon NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; @end @protocol UISearchBarDelegate @optional - (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar; // return NO to not become first responder - (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar; // called when text starts editing - (BOOL)searchBarShouldEndEditing:(UISearchBar *)searchBar; // return NO to not resign first responder - (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar; // called when text ends editing - (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText; // called when text changes (including clear) - (BOOL)searchBar:(UISearchBar *)searchBar shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text NS_AVAILABLE_IOS(3_0); // called before text changes - (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar; // called when keyboard search button pressed - (void)searchBarBookmarkButtonClicked:(UISearchBar *)searchBar; // called when bookmark button pressed - (void)searchBarCancelButtonClicked:(UISearchBar *) searchBar; // called when cancel button pressed - (void)searchBarResultsListButtonClicked:(UISearchBar *)searchBar NS_AVAILABLE_IOS(3_2); // called when search results button pressed - (void)searchBar:(UISearchBar *)searchBar selectedScopeButtonIndexDidChange:(NSInteger)selectedScope NS_AVAILABLE_IOS(3_0); @end // // UISearchDisplayController.h // UIKit // // Copyright (c) 2009-2012, Apple Inc. All rights reserved. // #import #import #import #import #import @class UISearchBar, UITableView, UIViewController, UIPopoverController; @protocol UITableViewDataSource, UITableViewDelegate, UISearchDisplayDelegate; NS_CLASS_AVAILABLE_IOS(3_0) @interface UISearchDisplayController : NSObject { @private UIViewController *_viewController; UITableView *_tableView; UIView *_dimmingView; UISearchBar *_searchBar; UILabel *_noResultsLabel; NSString *_noResultsMessage; NSString *_resultsTitle; id _delegate; id _tableViewDataSource; id _tableViewDelegate; CFMutableArrayRef _containingScrollViews; CGFloat _lastKeyboardAdjustment; CGFloat _lastFooterAdjustment; UIPopoverController *_popoverController; UITableViewStyle _searchResultsTableViewStyle; id _navigationControllerBookkeeper; struct { unsigned int visible:1; unsigned int animating:1; unsigned int hidIndexBar:1; unsigned int hidNavigationBar:1; unsigned int noResultsMessageVisible:1; unsigned int noResultsMessageAutoDisplay:1; unsigned int navigationBarHidingEnabled:1; unsigned int dimTableViewOnEmptySearchString:1; unsigned int isRotatingWithPopover:1; unsigned int cancelButtonManagementDisabled:1; unsigned int allowDisablingNavigationBarHiding:1; unsigned int showsResultsForEmptyField:1; unsigned int adjustsSearchBarContentInsetForIndexBar:1; } _searchDisplayControllerFlags; } - (id)initWithSearchBar:(UISearchBar *)searchBar contentsController:(UIViewController *)viewController; @property(nonatomic,assign) id delegate; @property(nonatomic,getter=isActive) BOOL active; // configure the view controller for searching. default is NO. animated is NO - (void)setActive:(BOOL)visible animated:(BOOL)animated; // animate the view controller for searching @property(nonatomic,readonly) UISearchBar *searchBar; @property(nonatomic,readonly) UIViewController *searchContentsController; // the view we are searching (often a UITableViewController) @property(nonatomic,readonly) UITableView *searchResultsTableView; // will return non-nil. create if requested @property(nonatomic,assign) id searchResultsDataSource; // default is nil. delegate can provide @property(nonatomic,assign) id searchResultsDelegate; // default is nil. delegate can provide @property(nonatomic,copy) NSString *searchResultsTitle NS_AVAILABLE_IOS(5_0); // default is nil. If nil, the controller uses the default title string @end @protocol UISearchDisplayDelegate @optional // when we start/end showing the search UI - (void) searchDisplayControllerWillBeginSearch:(UISearchDisplayController *)controller; - (void) searchDisplayControllerDidBeginSearch:(UISearchDisplayController *)controller; - (void) searchDisplayControllerWillEndSearch:(UISearchDisplayController *)controller; - (void) searchDisplayControllerDidEndSearch:(UISearchDisplayController *)controller; // called when the table is created destroyed, shown or hidden. configure as necessary. - (void)searchDisplayController:(UISearchDisplayController *)controller didLoadSearchResultsTableView:(UITableView *)tableView; - (void)searchDisplayController:(UISearchDisplayController *)controller willUnloadSearchResultsTableView:(UITableView *)tableView; // called when table is shown/hidden - (void)searchDisplayController:(UISearchDisplayController *)controller willShowSearchResultsTableView:(UITableView *)tableView; - (void)searchDisplayController:(UISearchDisplayController *)controller didShowSearchResultsTableView:(UITableView *)tableView; - (void)searchDisplayController:(UISearchDisplayController *)controller willHideSearchResultsTableView:(UITableView *)tableView; - (void)searchDisplayController:(UISearchDisplayController *)controller didHideSearchResultsTableView:(UITableView *)tableView; // return YES to reload table. called when search string/option changes. convenience methods on top UISearchBar delegate methods - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchString:(NSString *)searchString; - (BOOL)searchDisplayController:(UISearchDisplayController *)controller shouldReloadTableForSearchScope:(NSInteger)searchOption; @end // // UISegmentedControl.h // UIKit // // Copyright (c) 2005-2012, Apple Inc. All rights reserved. // #import #import #import #import #import #import #import typedef NS_ENUM(NSInteger, UISegmentedControlStyle) { UISegmentedControlStylePlain, // large plain UISegmentedControlStyleBordered, // large bordered UISegmentedControlStyleBar, // small button/nav bar style. tintable UISegmentedControlStyleBezeled, // DEPRECATED. Do not use this style. }; enum { UISegmentedControlNoSegment = -1 // segment index for no selected segment }; typedef NS_ENUM(NSInteger, UISegmentedControlSegment) { UISegmentedControlSegmentAny = 0, UISegmentedControlSegmentLeft = 1, // The capped, leftmost segment. Only applies when numSegments > 1. UISegmentedControlSegmentCenter = 2, // Any segment between the left and rightmost segments. Only applies when numSegments > 2. UISegmentedControlSegmentRight = 3, // The capped,rightmost segment. Only applies when numSegments > 1. UISegmentedControlSegmentAlone = 4, // The standalone segment, capped on both ends. Only applies when numSegments = 1. }; @class UIImage, UIColor; NS_CLASS_AVAILABLE_IOS(2_0) @interface UISegmentedControl : UIControl { @private // Note: all instance variables will become private in the future. Do not access directly. NSMutableArray *_segments; NSInteger _selectedSegment; NSInteger _highlightedSegment; UIView* _removedSegment; id _delegate; UIColor *_tintColor; UIBarStyle _barStyle; id _appearanceStorage; UIView *_backgroundBarView; CGFloat _enabledAlpha; struct { unsigned int style:3; unsigned int size:2; unsigned int showsDisclosure:1; unsigned int delegateSelectedSegmentChanged:1; unsigned int delegateDisclosureButtonClicked:1; unsigned int delegateAlwaysNotifiesDelegateOfSegmentClicks:1; unsigned int momentaryClick:1; unsigned int dontAlwaysToggleForTwoSegments:1; unsigned int tracking:1; unsigned int mouseInside:1; unsigned int autosizeToFitSegments:1; unsigned int isSizingToFit:1; unsigned int autosizeText:1; unsigned int transparentBackground:1; unsigned int useProportionalWidthSegments:1; unsigned int translucentBackground:1; unsigned int appearanceNeedsUpdate:1; } _segmentedControlFlags; } - (id)initWithItems:(NSArray *)items; // items can be NSStrings or UIImages. control is automatically sized to fit content @property(nonatomic) UISegmentedControlStyle segmentedControlStyle; // default is UISegmentedControlStylePlain @property(nonatomic,getter=isMomentary) BOOL momentary; // if set, then we don't keep showing selected state after tracking ends. default is NO @property(nonatomic,readonly) NSUInteger numberOfSegments; // For segments whose width value is 0, setting this property to YES attempts to adjust segment widths based on their content widths. Default is NO. @property(nonatomic) BOOL apportionsSegmentWidthsByContent NS_AVAILABLE_IOS(5_0); - (void)insertSegmentWithTitle:(NSString *)title atIndex:(NSUInteger)segment animated:(BOOL)animated; // insert before segment number. 0..#segments. value pinned - (void)insertSegmentWithImage:(UIImage *)image atIndex:(NSUInteger)segment animated:(BOOL)animated; - (void)removeSegmentAtIndex:(NSUInteger)segment animated:(BOOL)animated; - (void)removeAllSegments; - (void)setTitle:(NSString *)title forSegmentAtIndex:(NSUInteger)segment; // can only have image or title, not both. must be 0..#segments - 1 (or ignored). default is nil - (NSString *)titleForSegmentAtIndex:(NSUInteger)segment; - (void)setImage:(UIImage *)image forSegmentAtIndex:(NSUInteger)segment; // can only have image or title, not both. must be 0..#segments - 1 (or ignored). default is nil - (UIImage *)imageForSegmentAtIndex:(NSUInteger)segment; - (void)setWidth:(CGFloat)width forSegmentAtIndex:(NSUInteger)segment; // set to 0.0 width to autosize. default is 0.0 - (CGFloat)widthForSegmentAtIndex:(NSUInteger)segment; - (void)setContentOffset:(CGSize)offset forSegmentAtIndex:(NSUInteger)segment; // adjust offset of image or text inside the segment. default is (0,0) - (CGSize)contentOffsetForSegmentAtIndex:(NSUInteger)segment; - (void)setEnabled:(BOOL)enabled forSegmentAtIndex:(NSUInteger)segment; // default is YES - (BOOL)isEnabledForSegmentAtIndex:(NSUInteger)segment; // ignored in momentary mode. returns last segment pressed. default is UISegmentedControlNoSegment until a segment is pressed // the UIControlEventValueChanged action is invoked when the segment changes via a user event. set to UISegmentedControlNoSegment to turn off selection @property(nonatomic) NSInteger selectedSegmentIndex; /* Default tintColor is nil. Only used if style is UISegmentedControlStyleBar or UISegmentedControlStyleBezeled */ @property(nonatomic,retain) UIColor *tintColor UI_APPEARANCE_SELECTOR; /* If backgroundImage is an image returned from -[UIImage resizableImageWithCapInsets:] the cap widths will be calculated from that information, otherwise, the cap width will be calculated by subtracting one from the image's width then dividing by 2. The cap widths will also be used as the margins for text placement. To adjust the margin use the margin adjustment methods. In general, you should specify a value for the normal state to be used by other states which don't have a custom value set. Similarly, when a property is dependent on the bar metrics (on the iPhone in landscape orientation, bars have a different height from standard), be sure to specify a value for UIBarMetricsDefault. In the case of the segmented control, appearance properties for UIBarMetricsLandscapePhone are only respected for segmented controls in the smaller navigation and toolbars that are used in landscape orientation on the iPhone. */ - (void)setBackgroundImage:(UIImage *)backgroundImage forState:(UIControlState)state barMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; - (UIImage *)backgroundImageForState:(UIControlState)state barMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; /* To customize the segmented control appearance you will need to provide divider images to go between two unselected segments (leftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateNormal), selected on the left and unselected on the right (leftSegmentState:UIControlStateSelected rightSegmentState:UIControlStateNormal), and unselected on the left and selected on the right (leftSegmentState:UIControlStateNormal rightSegmentState:UIControlStateSelected). */ - (void)setDividerImage:(UIImage *)dividerImage forLeftSegmentState:(UIControlState)leftState rightSegmentState:(UIControlState)rightState barMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; - (UIImage *)dividerImageForLeftSegmentState:(UIControlState)leftState rightSegmentState:(UIControlState)rightState barMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; /* You may specify the font, text color, text shadow color, and text shadow offset for the title in the text attributes dictionary, using the keys found in UIStringDrawing.h. */ - (void)setTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; - (NSDictionary *)titleTextAttributesForState:(UIControlState)state NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; /* For adjusting the position of a title or image within the given segment of a segmented control. */ - (void)setContentPositionAdjustment:(UIOffset)adjustment forSegmentType:(UISegmentedControlSegment)leftCenterRightOrAlone barMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; - (UIOffset)contentPositionAdjustmentForSegmentType:(UISegmentedControlSegment)leftCenterRightOrAlone barMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; @end // // UISlider.h // UIKit // // Copyright (c) 2006-2012, Apple Inc. All rights reserved. // #import #import #import #import @class UIImageView, UIImage; NS_CLASS_AVAILABLE_IOS(2_0) @interface UISlider : UIControl { @package float _value; float _minValue; float _maxValue; CGFloat _alpha; CFMutableDictionaryRef _contentLookup; UIImageView *_minValueImageView; UIImageView *_maxValueImageView; UIImageView *_thumbView; UIImageView *_minTrackView; UIImageView *_maxTrackView; UIView *_maxTrackClipView; struct { unsigned int continuous:1; unsigned int animating:1; unsigned int preparingToAnimate:1; unsigned int showValue:1; unsigned int trackEnabled:1; unsigned int creatingSnapshot:1; unsigned int thumbDisabled:1; unsigned int minTrackHidden:1; } _sliderFlags; CGFloat _hitOffset; UIColor *_minTintColor; UIColor *_maxTintColor; UIColor *_thumbTintColor; } @property(nonatomic) float value; // default 0.0. this value will be pinned to min/max @property(nonatomic) float minimumValue; // default 0.0. the current value may change if outside new min value @property(nonatomic) float maximumValue; // default 1.0. the current value may change if outside new max value @property(nonatomic,retain) UIImage *minimumValueImage; // default is nil. image that appears to left of control (e.g. speaker off) @property(nonatomic,retain) UIImage *maximumValueImage; // default is nil. image that appears to right of control (e.g. speaker max) @property(nonatomic,getter=isContinuous) BOOL continuous; // if set, value change events are generated any time the value changes due to dragging. default = YES @property(nonatomic,retain) UIColor *minimumTrackTintColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; @property(nonatomic,retain) UIColor *maximumTrackTintColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; @property(nonatomic,retain) UIColor *thumbTintColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; - (void)setValue:(float)value animated:(BOOL)animated; // move slider at fixed velocity (i.e. duration depends on distance). does not send action // set the images for the slider. there are 3, the thumb which is centered by default and the track. You can specify different left and right track // e.g blue on the left as you increase and white to the right of the thumb. The track images should be 3 part resizable (via UIImage's resizableImage methods) along the direction that is longer - (void)setThumbImage:(UIImage *)image forState:(UIControlState)state; - (void)setMinimumTrackImage:(UIImage *)image forState:(UIControlState)state; - (void)setMaximumTrackImage:(UIImage *)image forState:(UIControlState)state; - (UIImage *)thumbImageForState:(UIControlState)state; - (UIImage *)minimumTrackImageForState:(UIControlState)state; - (UIImage *)maximumTrackImageForState:(UIControlState)state; @property(nonatomic,readonly) UIImage* currentThumbImage; @property(nonatomic,readonly) UIImage* currentMinimumTrackImage; @property(nonatomic,readonly) UIImage* currentMaximumTrackImage; // lets a subclass lay out the track and thumb as needed - (CGRect)minimumValueImageRectForBounds:(CGRect)bounds; - (CGRect)maximumValueImageRectForBounds:(CGRect)bounds; - (CGRect)trackRectForBounds:(CGRect)bounds; - (CGRect)thumbRectForBounds:(CGRect)bounds trackRect:(CGRect)rect value:(float)value; @end // // UISplitViewController.h // UIKit // // Copyright (c) 2009-2012, Apple Inc. All rights reserved. // #import @protocol UISplitViewControllerDelegate; NS_CLASS_AVAILABLE_IOS(3_2) @interface UISplitViewController : UIViewController @property (nonatomic, copy) NSArray *viewControllers; @property (nonatomic, assign) id delegate; // If 'YES', hidden view can be presented and dismissed via a swipe gesture. Defaults to 'YES'. // Set prior to setting delegate. The swipe gesture is only possible if the delegate implements -splitViewController:willHideViewController:withBarButtonItem:forPopoverController:. @property (nonatomic) BOOL presentsWithGesture NS_AVAILABLE_IOS(5_1); @end @protocol UISplitViewControllerDelegate @optional // Called when a button should be added to a toolbar for a hidden view controller. // Implementing this method allows the hidden view controller to be presented via a swipe gesture if 'presentsWithGesture' is 'YES' (the default). - (void)splitViewController:(UISplitViewController *)svc willHideViewController:(UIViewController *)aViewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)pc; // Called when the view is shown again in the split view, invalidating the button and popover controller. - (void)splitViewController:(UISplitViewController *)svc willShowViewController:(UIViewController *)aViewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem; // Called when the view controller is shown in a popover so the delegate can take action like hiding other popovers. - (void)splitViewController:(UISplitViewController *)svc popoverController:(UIPopoverController *)pc willPresentViewController:(UIViewController *)aViewController; // Returns YES if a view controller should be hidden by the split view controller in a given orientation. // (This method is only called on the leftmost view controller and only discriminates portrait from landscape.) - (BOOL)splitViewController:(UISplitViewController *)svc shouldHideViewController:(UIViewController *)vc inOrientation:(UIInterfaceOrientation)orientation NS_AVAILABLE_IOS(5_0); @end @interface UIViewController (UISplitViewController) @property (nonatomic, readonly, retain) UISplitViewController *splitViewController; // If the view controller has a split view controller as its ancestor, return it. Returns nil otherwise. @end /* * UIStateRestoration.h * UIKit * * Copyright 2012, Apple Inc. All rights reserved. * */ #import #import #pragma mark -- State Restoration Coder Keys -- // For use in viewControllerWithRestorationIdentifierPath to get the storyboard that created the saved ViewController UIKIT_EXTERN NSString *const UIStateRestorationViewControllerStoryboardKey NS_AVAILABLE_IOS(6_0); // String with value of info.plist's Bundle Version (app version) when state was last saved for the app UIKIT_EXTERN NSString *const UIApplicationStateRestorationBundleVersionKey NS_AVAILABLE_IOS(6_0); // NSNumber containing the UIUSerInterfaceIdiom enum value of the app that saved state UIKIT_EXTERN NSString *const UIApplicationStateRestorationUserInterfaceIdiomKey NS_AVAILABLE_IOS(6_0); @class UIView; @class UIViewController; #pragma mark -- State Restoration protocols adopted by UIView and UIViewController -- // For a class to be specified as the restoration class of a view controller it must implement this protocol. @protocol UIViewControllerRestoration + (UIViewController *) viewControllerWithRestorationIdentifierPath:(NSArray *)identifierComponents coder:(NSCoder *)coder; @end @protocol UIDataSourceModelAssociation - (NSString *) modelIdentifierForElementAtIndexPath:(NSIndexPath *)idx inView:(UIView *)view; - (NSIndexPath *) indexPathForElementWithModelIdentifier:(NSString *)identifier inView:(UIView *)view; @end // // UIStepper.h // UIKit // // Copyright 2010-2012, Apple Inc. All rights reserved. // #import #import #import @class UIButton, UIImageView; NS_CLASS_AVAILABLE_IOS(5_0) @interface UIStepper : UIControl @property(nonatomic,getter=isContinuous) BOOL continuous; // if YES, value change events are sent any time the value changes during interaction. default = YES @property(nonatomic) BOOL autorepeat; // if YES, press & hold repeatedly alters value. default = YES @property(nonatomic) BOOL wraps; // if YES, value wraps from min <-> max. default = NO @property(nonatomic) double value; // default is 0. sends UIControlEventValueChanged. clamped to min/max @property(nonatomic) double minimumValue; // default 0. must be less than maximumValue @property(nonatomic) double maximumValue; // default 100. must be greater than minimumValue @property(nonatomic) double stepValue; // default 1. must be greater than 0 @property(nonatomic,retain) UIColor *tintColor NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR; // a background image which will be 3-way stretched over the whole of the control. Each half of the stepper will paint the image appropriate for its state - (void)setBackgroundImage:(UIImage*)image forState:(UIControlState)state NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR; - (UIImage*)backgroundImageForState:(UIControlState)state NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR; // an image which will be painted in between the two stepper segments. The image is selected depending both segments' state - (void)setDividerImage:(UIImage*)image forLeftSegmentState:(UIControlState)leftState rightSegmentState:(UIControlState)rightState NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR; - (UIImage*)dividerImageForLeftSegmentState:(UIControlState)state rightSegmentState:(UIControlState)state NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR; // the glyph image for the plus/increase button - (void)setIncrementImage:(UIImage *)image forState:(UIControlState)state NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR; - (UIImage *)incrementImageForState:(UIControlState)state NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR; // the glyph image for the minus/decrease button - (void)setDecrementImage:(UIImage *)image forState:(UIControlState)state NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR; - (UIImage *)decrementImageForState:(UIControlState)state NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR; @end // // UIStoryboard.h // UIKit // // Copyright 2011-2012, Apple Inc. All rights reserved. // #import #import NS_CLASS_AVAILABLE_IOS(5_0) @interface UIStoryboard : NSObject { } + (UIStoryboard *)storyboardWithName:(NSString *)name bundle:(NSBundle *)storyboardBundleOrNil; - (id)instantiateInitialViewController; - (id)instantiateViewControllerWithIdentifier:(NSString *)identifier; @end // // UIStoryboardPopoverSegue.h // UIKit // // Copyright 2011-2012, Apple Inc. All rights reserved. // #import @class UIPopoverController; NS_CLASS_AVAILABLE_IOS(5_0) @interface UIStoryboardPopoverSegue : UIStoryboardSegue { } @property (nonatomic, retain, readonly) UIPopoverController *popoverController; @end // // UIStoryboardSegue.h // UIKit // // Copyright 2011-2012, Apple Inc. All rights reserved. // #import #import @class UIViewController; NS_CLASS_AVAILABLE_IOS(5_0) @interface UIStoryboardSegue : NSObject // Convenience constructor for returning a segue that performs a handler block in its -perform method. + (id)segueWithIdentifier:(NSString *)identifier source:(UIViewController *)source destination:(UIViewController *)destination performHandler:(void (^)(void))performHandler NS_AVAILABLE_IOS(6_0); - (id)initWithIdentifier:(NSString *)identifier source:(UIViewController *)source destination:(UIViewController *)destination; // Designated initializer @property (nonatomic, readonly) NSString *identifier; @property (nonatomic, readonly) id sourceViewController; @property (nonatomic, readonly) id destinationViewController; - (void)perform; @end // // UIStringDrawing.h // UIKit // // Copyright (c) 2005-2012, Apple Inc. All rights reserved. // #import #import #if (TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR) #import #endif #import #import /* Keys for text attributes dictionaries. */ // Key to the font in the text attributes dictionary. A UIFont instance is expected. Use a font with size 0.0 to get the default font size for the situation. UIKIT_EXTERN NSString *const UITextAttributeFont NS_AVAILABLE_IOS(5_0); // Key to the text color in the text attributes dictionary. A UIColor instance is expected. UIKIT_EXTERN NSString *const UITextAttributeTextColor NS_AVAILABLE_IOS(5_0); // Key to the text shadow color in the text attributes dictionary. A UIColor instance is expected. UIKIT_EXTERN NSString *const UITextAttributeTextShadowColor NS_AVAILABLE_IOS(5_0); // Key to the offset used for the text shadow in the text attributes dictionary. An NSValue instance wrapping a UIOffset struct is expected. UIKIT_EXTERN NSString *const UITextAttributeTextShadowOffset NS_AVAILABLE_IOS(5_0); // Deprecated: use NSLineBreakMode instead (we will be adding deprecation tags soon!) enum { UILineBreakModeWordWrap = 0, // Wrap at word boundaries UILineBreakModeCharacterWrap, // Wrap at character boundaries UILineBreakModeClip, // Simply clip when it hits the end of the rect UILineBreakModeHeadTruncation, // Truncate at head of line: "...wxyz". Will truncate multiline text on first line UILineBreakModeTailTruncation, // Truncate at tail of line: "abcd...". Will truncate multiline text on last line UILineBreakModeMiddleTruncation, // Truncate middle of line: "ab...yz". Will truncate multiline text in the middle } NS_DEPRECATED_IOS(2_0,6_0); typedef NSLineBreakMode UILineBreakMode; // Deprecated: use NSTextAlignment instead (we will be adding deprecation tags soon!) enum { UITextAlignmentLeft = 0, UITextAlignmentCenter, UITextAlignmentRight, // could add justified in future } NS_DEPRECATED_IOS(2_0,6_0); typedef NSTextAlignment UITextAlignment; typedef NS_ENUM(NSInteger, UIBaselineAdjustment) { UIBaselineAdjustmentAlignBaselines = 0, // default. used when shrinking text to position based on the original baseline UIBaselineAdjustmentAlignCenters, UIBaselineAdjustmentNone, }; @class UIFont; // these methods draw using a UIFont. draw methods return size of actual string. all draw in the current context using the current color @interface NSString(UIStringDrawing) // Single line, no wrapping. Truncation based on the NSLineBreakMode. - (CGSize)sizeWithFont:(UIFont *)font; // Uses NSLineBreakByWordWrapping - (CGSize)sizeWithFont:(UIFont *)font forWidth:(CGFloat)width lineBreakMode:(NSLineBreakMode)lineBreakMode; // Single line, no wrapping. Truncation based on the NSLineBreakMode. - (CGSize)drawAtPoint:(CGPoint)point withFont:(UIFont *)font; // Uses NSLineBreakByWordWrapping - (CGSize)drawAtPoint:(CGPoint)point forWidth:(CGFloat)width withFont:(UIFont *)font lineBreakMode:(NSLineBreakMode)lineBreakMode; // Wrapping to fit horizontal and vertical size. Text will be wrapped and truncated using the NSLineBreakMode. If the height is less than a line of text, it may return // a vertical size that is bigger than the one passed in. // If you size your text using the constrainedToSize: methods below, you should draw the text using the drawInRect: methods using the same line break mode for consistency - (CGSize)sizeWithFont:(UIFont *)font constrainedToSize:(CGSize)size; // Uses NSLineBreakModeWordWrap - (CGSize)sizeWithFont:(UIFont *)font constrainedToSize:(CGSize)size lineBreakMode:(NSLineBreakMode)lineBreakMode; // NSTextAlignment is not needed to determine size // Wrapping to fit horizontal and vertical size. - (CGSize)drawInRect:(CGRect)rect withFont:(UIFont *)font; // Uses NSLineBreakByWordWrapping and NSLeftTextAlignment - (CGSize)drawInRect:(CGRect)rect withFont:(UIFont *)font lineBreakMode:(NSLineBreakMode)lineBreakMode; // Uses NSLeftTextAlignment - (CGSize)drawInRect:(CGRect)rect withFont:(UIFont *)font lineBreakMode:(NSLineBreakMode)lineBreakMode alignment:(NSTextAlignment)alignment; // These methods will behave identically to the above single line methods if the string will fit in the specified width in the specified font. // If not, the font size will be reduced until either the string fits or the minimum font size is reached. If the minimum font // size is reached and the string still won't fit, the string will be truncated and drawn at the minimum font size. // The first two methods are used together, and the actualFontSize returned in the sizeWithFont method should be passed to the drawAtPoint method. // The last method will do the sizing calculation and drawing in one operation. - (CGSize)sizeWithFont:(UIFont *)font minFontSize:(CGFloat)minFontSize actualFontSize:(CGFloat *)actualFontSize forWidth:(CGFloat)width lineBreakMode:(NSLineBreakMode)lineBreakMode; - (CGSize)drawAtPoint:(CGPoint)point forWidth:(CGFloat)width withFont:(UIFont *)font fontSize:(CGFloat)fontSize lineBreakMode:(NSLineBreakMode)lineBreakMode baselineAdjustment:(UIBaselineAdjustment)baselineAdjustment; // default is UIBaselineAdjustmentAlignBaselines - (CGSize)drawAtPoint:(CGPoint)point forWidth:(CGFloat)width withFont:(UIFont *)font minFontSize:(CGFloat)minFontSize actualFontSize:(CGFloat *)actualFontSize lineBreakMode:(NSLineBreakMode)lineBreakMode baselineAdjustment:(UIBaselineAdjustment)baselineAdjustment; // default is UIBaselineAdjustmentAlignBaselines @end // // UISwipeGestureRecognizer.h // UIKit // // Copyright (c) 2009-2012, Apple Inc. All rights reserved. // #import #import // Recognizes: when numberOfTouchesRequired have moved mostly in the specified direction, enough to be considered a swipe. // a slow swipe requires high directional precision but a small distance // a fast swipe requires low directional precision but a large distance // Touch Location Behaviors: // locationInView: location where the swipe began. this is the centroid if more than one touch was involved // locationOfTouch:inView: location of a particular touch when the swipe began typedef NS_OPTIONS(NSUInteger, UISwipeGestureRecognizerDirection) { UISwipeGestureRecognizerDirectionRight = 1 << 0, UISwipeGestureRecognizerDirectionLeft = 1 << 1, UISwipeGestureRecognizerDirectionUp = 1 << 2, UISwipeGestureRecognizerDirectionDown = 1 << 3 }; NS_CLASS_AVAILABLE_IOS(3_2) @interface UISwipeGestureRecognizer : UIGestureRecognizer { @package CFTimeInterval _maximumDuration; CGFloat _minimumPrimaryMovement; CGFloat _maximumPrimaryMovement; CGFloat _minimumSecondaryMovement; CGFloat _maximumSecondaryMovement; CGFloat _rateOfMinimumMovementDecay; CGFloat _rateOfMaximumMovementDecay; NSUInteger _numberOfTouchesRequired; NSMutableArray *_touches; UISwipeGestureRecognizerDirection _direction; CGPoint _startLocation; CGPoint *_startLocations; CFTimeInterval _startTime; unsigned int _failed:1; } @property(nonatomic) NSUInteger numberOfTouchesRequired; // default is 1. the number of fingers that must swipe @property(nonatomic) UISwipeGestureRecognizerDirection direction; // default is UISwipeGestureRecognizerDirectionRight. the desired direction of the swipe. multiple directions may be specified if they will result in the same behavior (for example, UITableView swipe delete) @end // // UISwitch.h // UIKit // // Copyright (c) 2008-2012, Apple Inc. All rights reserved. // #import #import #import #import NS_CLASS_AVAILABLE_IOS(2_0) @interface UISwitch : UIControl { @private id _control; } @property(nonatomic, retain) UIColor *onTintColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; @property(nonatomic, retain) UIColor *tintColor NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR; @property(nonatomic, retain) UIColor *thumbTintColor NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR; @property(nonatomic, retain) UIImage *onImage NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR; @property(nonatomic, retain) UIImage *offImage NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR; @property(nonatomic,getter=isOn) BOOL on; - (id)initWithFrame:(CGRect)frame; // This class enforces a size appropriate for the control. The frame size is ignored. - (void)setOn:(BOOL)on animated:(BOOL)animated; // does not send action @end // // UITabBar.h // UIKit // // Copyright (c) 2008-2012, Apple Inc. All rights reserved. // #import #import #import @class UITabBarItem; @class UIImageView; @protocol UITabBarDelegate; NS_CLASS_AVAILABLE_IOS(2_0) @interface UITabBar : UIView { @private UIView *_customizeView; UIView *_backgroundView; UIImageView *_shadowView; id _delegate; NSArray *_items; UITabBarItem *_selectedItem; NSArray *_customizationItems; struct { unsigned int alertShown:1; unsigned int wasEnabled:1; unsigned int customized:1; unsigned int downButtonSentAction:1; unsigned int isLocked:1; unsigned int backgroundIsPattern:1; } _tabBarFlags; NSArray *_buttonItems; CFMutableArrayRef _hiddenItems; id _appearanceStorage; } @property(nonatomic,assign) id delegate; // weak reference. default is nil @property(nonatomic,copy) NSArray *items; // get/set visible UITabBarItems. default is nil. changes not animated. shown in order @property(nonatomic,assign) UITabBarItem *selectedItem; // will show feedback based on mode. default is nil - (void)setItems:(NSArray *)items animated:(BOOL)animated; // will fade in or out or reorder and adjust spacing // Reorder items. This will display a sheet with all the items listed, allow the user to change/reorder items and shows a 'Done' button at the top - (void)beginCustomizingItems:(NSArray *)items; // list all items that can be reordered. always animates a sheet up. visible items not listed are fixed in place - (BOOL)endCustomizingAnimated:(BOOL)animated; // hide customization sheet. normally you should let the user do it. check list of items to see new layout. returns YES if layout changed - (BOOL)isCustomizing; /* tintColor will be applied to the tab bar background */ @property(nonatomic,retain) UIColor *tintColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; /* selectedImageTintColor will be applied to the gradient image used when creating the selected image. Default is nil and will result in the system bright blue for selected tab item images. If you wish to also customize the unselected image appearance, you must use -setFinishedSelectedImage:finishedUnselectedImage: on individual tab bar items. */ @property(nonatomic,retain) UIColor *selectedImageTintColor NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; /* The background image will be tiled to fit, even if it was not created via the UIImage resizableImage methods. */ @property(nonatomic,retain) UIImage *backgroundImage NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; /* The selection indicator image is drawn on top of the tab bar, behind the bar item icon. */ @property(nonatomic,retain) UIImage *selectionIndicatorImage NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; /* Default is nil. When non-nil, a custom shadow image to show instead of the default shadow image. For a custom shadow to be shown, a custom background image must also be set with -setBackgroundImage: (if the default background image is used, the default shadow image will be used). */ @property(nonatomic,retain) UIImage *shadowImage NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR; @end //___________________________________________________________________________________________________ @protocol UITabBarDelegate @optional - (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item; // called when a new view is selected by the user (but not programatically) /* called when user shows or dismisses customize sheet. you can use the 'willEnd' to set up what appears underneath. changed is YES if there was some change to which items are visible or which order they appear. If selectedItem is no longer visible, it will be set to nil. */ - (void)tabBar:(UITabBar *)tabBar willBeginCustomizingItems:(NSArray *)items; // called before customize sheet is shown. items is current item list - (void)tabBar:(UITabBar *)tabBar didBeginCustomizingItems:(NSArray *)items; // called after customize sheet is shown. items is current item list - (void)tabBar:(UITabBar *)tabBar willEndCustomizingItems:(NSArray *)items changed:(BOOL)changed; // called before customize sheet is hidden. items is new item list - (void)tabBar:(UITabBar *)tabBar didEndCustomizingItems:(NSArray *)items changed:(BOOL)changed; // called after customize sheet is hidden. items is new item list @end // // UITabBarController.h // UIKit // // Copyright (c) 2007-2012, Apple Inc. All rights reserved. // #import #import #import #import /*! UITabBarController manages a button bar and transition view, for an application with multiple top-level modes. To use in your application, add its view to the view hierarchy, then add top-level view controllers in order. Most clients will not need to subclass UITabBarController. If more than five view controllers are added to a tab bar controller, only the first four will display. The rest will be accessible under an automatically generated More item. UITabBarController is rotatable if all of its view controllers are rotatable. */ @class UIView, UIImage, UINavigationController, UITabBarItem; @protocol UITabBarControllerDelegate; NS_CLASS_AVAILABLE_IOS(2_0) @interface UITabBarController : UIViewController { @package UITabBar *_tabBar; UIView *_containerView; UIView *_viewControllerTransitionView; id _tabBarItemsToViewControllers; UIViewController *_selectedViewController; UINavigationController *_moreNavigationController; NSArray *_customizableViewControllers; id _delegate; UIViewController *_selectedViewControllerDuringWillAppear; UIViewController *_transientViewController; NSUInteger _maxItems; struct { unsigned int isShowingMoreItem:1; unsigned int needsToRebuildItems:1; unsigned int isBarHidden:1; unsigned int editButtonOnLeft:1; } _tabBarControllerFlags; } @property(nonatomic,copy) NSArray *viewControllers; // If the number of view controllers is greater than the number displayable by a tab bar, a "More" navigation controller will automatically be shown. // The "More" navigation controller will not be returned by -viewControllers, but it may be returned by -selectedViewController. - (void)setViewControllers:(NSArray *)viewControllers animated:(BOOL)animated; @property(nonatomic,assign) UIViewController *selectedViewController; // This may return the "More" navigation controller if it exists. @property(nonatomic) NSUInteger selectedIndex; @property(nonatomic,readonly) UINavigationController *moreNavigationController; // Returns the "More" navigation controller, creating it if it does not already exist. @property(nonatomic,copy) NSArray *customizableViewControllers; // If non-nil, then the "More" view will include an "Edit" button that displays customization UI for the specified controllers. By default, all view controllers are customizable. @property(nonatomic,readonly) UITabBar *tabBar NS_AVAILABLE_IOS(3_0); // Provided for -[UIActionSheet showFromTabBar:]. Attempting to modify the contents of the tab bar directly will throw an exception. @property(nonatomic,assign) id delegate; @end @protocol UITabBarControllerDelegate @optional - (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController NS_AVAILABLE_IOS(3_0); - (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController; - (void)tabBarController:(UITabBarController *)tabBarController willBeginCustomizingViewControllers:(NSArray *)viewControllers NS_AVAILABLE_IOS(3_0); - (void)tabBarController:(UITabBarController *)tabBarController willEndCustomizingViewControllers:(NSArray *)viewControllers changed:(BOOL)changed NS_AVAILABLE_IOS(3_0); - (void)tabBarController:(UITabBarController *)tabBarController didEndCustomizingViewControllers:(NSArray *)viewControllers changed:(BOOL)changed; @end @interface UIViewController (UITabBarControllerItem) @property(nonatomic,retain) UITabBarItem *tabBarItem; // Automatically created lazily with the view controller's title if it's not set explicitly. @property(nonatomic,readonly,retain) UITabBarController *tabBarController; // If the view controller has a tab bar controller as its ancestor, return it. Returns nil otherwise. @end // // UITabBarItem.h // UIKit // // Copyright (c) 2008-2012, Apple Inc. All rights reserved. // #import #import #import #import typedef NS_ENUM(NSInteger, UITabBarSystemItem) { UITabBarSystemItemMore, UITabBarSystemItemFavorites, UITabBarSystemItemFeatured, UITabBarSystemItemTopRated, UITabBarSystemItemRecents, UITabBarSystemItemContacts, UITabBarSystemItemHistory, UITabBarSystemItemBookmarks, UITabBarSystemItemSearch, UITabBarSystemItemDownloads, UITabBarSystemItemMostRecent, UITabBarSystemItemMostViewed, }; @class UIView, UIImage; NS_CLASS_AVAILABLE_IOS(2_0) @interface UITabBarItem : UIBarItem { @private NSString *_title; NSSet *_possibleTitles; SEL _action; id _target; UIImage *_image; UIImage *_selectedImage; UIImage *_unselectedImage; UIEdgeInsets _imageInsets; NSString *_badgeValue; UIView *_view; NSInteger _tag; id _appearanceStorage; struct { unsigned int enabled:1; unsigned int style:3; unsigned int isSystemItem:1; unsigned int systemItem:7; unsigned int viewIsCustom:1; unsigned int animatedBadge:1; unsigned int customSelectedImage:1; unsigned int customUnselectedImage:1; } _tabBarItemFlags; } /* Selected and unselected images are autogenerated from the image argument. For full control of the selected and unselected images, use -setFinishedSelectedImage:withFinishedUnselectedImage:. */ - (id)initWithTitle:(NSString *)title image:(UIImage *)image tag:(NSInteger)tag; - (id)initWithTabBarSystemItem:(UITabBarSystemItem)systemItem tag:(NSInteger)tag; @property(nonatomic,copy) NSString *badgeValue; // default is nil /* UIKit will not provide any automatic treatment to finished images. You must provide finished selected and unselected images in matching pairs for good results. Note that these methods are not tagged UI_APPEARANCE_SELECTOR and do not participate in the UIAppearance Proxy API. */ - (void)setFinishedSelectedImage:(UIImage *)selectedImage withFinishedUnselectedImage:(UIImage *)unselectedImage NS_AVAILABLE_IOS(5_0); - (UIImage *)finishedSelectedImage NS_AVAILABLE_IOS(5_0); - (UIImage *)finishedUnselectedImage NS_AVAILABLE_IOS(5_0); /* To set item label text attributes use the appearance selectors available on the superclass, UIBarItem. Use the following to tweak the relative position of the label within the tab button (for handling visual centering corrections if needed because of custom text attributes) */ - (void)setTitlePositionAdjustment:(UIOffset)adjustment NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; - (UIOffset)titlePositionAdjustment NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; @end // // UITableView.h // UIKit // // Copyright (c) 2005-2012, Apple Inc. All rights reserved. // #import #import #import #import #import #import typedef NS_ENUM(NSInteger, UITableViewStyle) { UITableViewStylePlain, // regular table view UITableViewStyleGrouped // preferences style table view }; typedef NS_ENUM(NSInteger, UITableViewScrollPosition) { UITableViewScrollPositionNone, UITableViewScrollPositionTop, UITableViewScrollPositionMiddle, UITableViewScrollPositionBottom }; // scroll so row of interest is completely visible at top/center/bottom of view typedef NS_ENUM(NSInteger, UITableViewRowAnimation) { UITableViewRowAnimationFade, UITableViewRowAnimationRight, // slide in from right (or out to right) UITableViewRowAnimationLeft, UITableViewRowAnimationTop, UITableViewRowAnimationBottom, UITableViewRowAnimationNone, // available in iOS 3.0 UITableViewRowAnimationMiddle, // available in iOS 3.2. attempts to keep cell centered in the space it will/did occupy UITableViewRowAnimationAutomatic = 100 // available in iOS 5.0. chooses an appropriate animation style for you }; // Including this constant string in the array of strings returned by sectionIndexTitlesForTableView: will cause a magnifying glass icon to be displayed at that location in the index. // This should generally only be used as the first title in the index. UIKIT_EXTERN NSString *const UITableViewIndexSearch NS_AVAILABLE_IOS(3_0); // Returning this value from tableView:heightForHeaderInSection: or tableView:heightForFooterInSection: results in a height that fits the value returned from // tableView:titleForHeaderInSection: or tableView:titleForFooterInSection: if the title is not nil. UIKIT_EXTERN const CGFloat UITableViewAutomaticDimension NS_AVAILABLE_IOS(5_0); @class UITableView; @class UINib; @protocol UITableViewDataSource; @class UILongPressGestureRecognizer; @class UITableViewHeaderFooterView; @class UIRefreshControl; //_______________________________________________________________________________________________________________ // this represents the display and behaviour of the cells. @protocol UITableViewDelegate @optional // Display customization - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath; - (void)tableView:(UITableView *)tableView willDisplayHeaderView:(UIView *)view forSection:(NSInteger)section NS_AVAILABLE_IOS(6_0); - (void)tableView:(UITableView *)tableView willDisplayFooterView:(UIView *)view forSection:(NSInteger)section NS_AVAILABLE_IOS(6_0); - (void)tableView:(UITableView *)tableView didEndDisplayingCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath*)indexPath NS_AVAILABLE_IOS(6_0); - (void)tableView:(UITableView *)tableView didEndDisplayingHeaderView:(UIView *)view forSection:(NSInteger)section NS_AVAILABLE_IOS(6_0); - (void)tableView:(UITableView *)tableView didEndDisplayingFooterView:(UIView *)view forSection:(NSInteger)section NS_AVAILABLE_IOS(6_0); // Variable height support - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath; - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section; - (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section; // Section header & footer information. Views are preferred over title should you decide to provide both - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section; // custom view for header. will be adjusted to default or specified header height - (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section; // custom view for footer. will be adjusted to default or specified footer height // Accessories (disclosures). - (UITableViewCellAccessoryType)tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath NS_DEPRECATED_IOS(2_0, 3_0); - (void)tableView:(UITableView *)tableView accessoryButtonTappedForRowWithIndexPath:(NSIndexPath *)indexPath; // Selection // -tableView:shouldHighlightRowAtIndexPath: is called when a touch comes down on a row. // Returning NO to that message halts the selection process and does not cause the currently selected row to lose its selected look while the touch is down. - (BOOL)tableView:(UITableView *)tableView shouldHighlightRowAtIndexPath:(NSIndexPath *)indexPath NS_AVAILABLE_IOS(6_0); - (void)tableView:(UITableView *)tableView didHighlightRowAtIndexPath:(NSIndexPath *)indexPath NS_AVAILABLE_IOS(6_0); - (void)tableView:(UITableView *)tableView didUnhighlightRowAtIndexPath:(NSIndexPath *)indexPath NS_AVAILABLE_IOS(6_0); // Called before the user changes the selection. Return a new indexPath, or nil, to change the proposed selection. - (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath; - (NSIndexPath *)tableView:(UITableView *)tableView willDeselectRowAtIndexPath:(NSIndexPath *)indexPath NS_AVAILABLE_IOS(3_0); // Called after the user changes the selection. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath; - (void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath NS_AVAILABLE_IOS(3_0); // Editing // Allows customization of the editingStyle for a particular cell located at 'indexPath'. If not implemented, all editable cells will have UITableViewCellEditingStyleDelete set for them when the table has editing property set to YES. - (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath; - (NSString *)tableView:(UITableView *)tableView titleForDeleteConfirmationButtonForRowAtIndexPath:(NSIndexPath *)indexPath NS_AVAILABLE_IOS(3_0); // Controls whether the background is indented while editing. If not implemented, the default is YES. This is unrelated to the indentation level below. This method only applies to grouped style table views. - (BOOL)tableView:(UITableView *)tableView shouldIndentWhileEditingRowAtIndexPath:(NSIndexPath *)indexPath; // The willBegin/didEnd methods are called whenever the 'editing' property is automatically changed by the table (allowing insert/delete/move). This is done by a swipe activating a single row - (void)tableView:(UITableView*)tableView willBeginEditingRowAtIndexPath:(NSIndexPath *)indexPath; - (void)tableView:(UITableView*)tableView didEndEditingRowAtIndexPath:(NSIndexPath *)indexPath; // Moving/reordering // Allows customization of the target row for a particular row as it is being moved/reordered - (NSIndexPath *)tableView:(UITableView *)tableView targetIndexPathForMoveFromRowAtIndexPath:(NSIndexPath *)sourceIndexPath toProposedIndexPath:(NSIndexPath *)proposedDestinationIndexPath; // Indentation - (NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath; // return 'depth' of row for hierarchies // Copy/Paste. All three methods must be implemented by the delegate. - (BOOL)tableView:(UITableView *)tableView shouldShowMenuForRowAtIndexPath:(NSIndexPath *)indexPath NS_AVAILABLE_IOS(5_0); - (BOOL)tableView:(UITableView *)tableView canPerformAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender NS_AVAILABLE_IOS(5_0); - (void)tableView:(UITableView *)tableView performAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender NS_AVAILABLE_IOS(5_0); @end UIKIT_EXTERN NSString *const UITableViewSelectionDidChangeNotification; //_______________________________________________________________________________________________________________ NS_CLASS_AVAILABLE_IOS(2_0) @interface UITableView : UIScrollView { @private // UITableViewStyle _style; id _dataSource; id _rowData; CGFloat _rowHeight; CGFloat _sectionHeaderHeight; CGFloat _sectionFooterHeight; CGRect _visibleBounds; NSRange _visibleRows; NSMutableArray *_visibleCells; NSIndexPath *_firstResponderIndexPath; UIView *_firstResponderView; NSUInteger _firstResponderViewType; NSMutableDictionary *_reusableTableCells; NSMutableDictionary *_nibMap; NSMutableDictionary *_headerFooterNibMap; NSMutableDictionary *_nibExternalObjectsTables; UITableViewCell *_topSeparatorCell; id _topSeparator; NSMutableArray *_extraSeparators; CFMutableDictionaryRef _visibleHeaderViews; CFMutableDictionaryRef _visibleFooterViews; NSMutableDictionary *_reusableHeaderFooterViews; NSMutableArray *_highlightedIndexPaths; NSMutableArray *_selectedIndexPaths; NSInteger _swipeToDeleteSection; NSInteger _swipeToDeleteRow; NSIndexPath *_pendingSelectionIndexPath; NSArray *_pendingDeselectionIndexPaths; UIView *_touchedContentView; UIView *_newContentView; id _deleteAnimationSupport; id _reorderingSupport; UIView *_backgroundView; UIView *_index; UIView *_tableHeaderBackgroundView; UIView *_tableHeaderView; UIView *_tableFooterView; id _countLabel; NSInteger _tableReloadingSuspendedCount; // NSInteger _tableDisplaySuspendedCount; NSInteger _sectionIndexMinimumDisplayRowCount; // NSInteger _itemCountFooterMinimumDisplayRowCount; NSMutableArray *_insertItems; NSMutableArray *_deleteItems; NSMutableArray *_reloadItems; NSMutableArray *_moveItems; UIColor *_separatorColor; UIColor *_separatorTopShadowColor; UIColor *_separatorBottomShadowColor; UIColor *_checkmarkColor; UIColor *_sectionBorderColor; UIColor *_indexColor; UIColor *_indexBackgroundColor; NSArray *_defaultSectionIndexTitles; UISwipeGestureRecognizer *_swipeGestureRecognizer; UIGestureRecognizer *_gobblerGestureRecognizer; NSInteger _updateCount; NSIndexPath *_displayingCellContentStringIndexPath; UILongPressGestureRecognizer *_longPressGestureRecognizer; NSTimer *_longPressAutoscrollTimer; int _longPressAutoscrollDirection; UIEdgeInsets _sectionContentInset; UITouch *_currentTouch; UIRefreshControl *_refreshControl; NSMutableDictionary *_cellClassDict; NSMutableDictionary *_headerFooterClassDict; CGFloat _topPadding; CGFloat _bottomPadding; id _updateCompletionHandler; struct { unsigned int dataSourceNumberOfRowsInSection:1; unsigned int dataSourceCellForRow:1; unsigned int dataSourceNumberOfSectionsInTableView:1; unsigned int dataSourceTitleForHeaderInSection:1; unsigned int dataSourceTitleForFooterInSection:1; unsigned int dataSourceDetailTextForHeaderInSection:1; unsigned int dataSourceCommitEditingStyle:1; unsigned int dataSourceSectionIndexTitlesForTableView:1; unsigned int dataSourceSectionForSectionIndexTitle:1; unsigned int dataSourceCanEditRow:1; unsigned int dataSourceCanMoveRow:1; unsigned int dataSourceCanUpdateRow:1; unsigned int dataSourceShouldShowMenu:1; unsigned int dataSourceCanPerformAction:1; unsigned int dataSourcePerformAction:1; unsigned int dataSourceIndexPathForSectionIndexTitle:1; unsigned int delegateEditingStyleForRowAtIndexPath:1; unsigned int delegateTitleForDeleteConfirmationButtonForRowAtIndexPath:1; unsigned int delegateShouldIndentWhileEditing:1; unsigned int dataSourceMoveRow:1; unsigned int delegateCellForRow:1; unsigned int delegateWillDisplayCell:1; unsigned int delegateDidEndDisplayingCell:1; unsigned int delegateDidEndDisplayingSectionHeader:1; unsigned int delegateDidEndDisplayingSectionFooter:1; unsigned int delegateHeightForRow:1; unsigned int delegateHeightForSectionHeader:1; unsigned int delegateTitleWidthForSectionHeader:1; unsigned int delegateHeightForSectionFooter:1; unsigned int delegateTitleWidthForSectionFooter:1; unsigned int delegateViewForHeaderInSection:1; unsigned int delegateViewForFooterInSection:1; unsigned int delegateDisplayedItemCountForRowCount:1; unsigned int delegateDisplayStringForRowCount:1; unsigned int delegateAccessoryTypeForRow:1; unsigned int delegateAccessoryButtonTappedForRow:1; unsigned int delegateWillSelectRow:1; unsigned int delegateWillDeselectRow:1; unsigned int delegateDidSelectRow:1; unsigned int delegateDidDeselectRow:1; unsigned int delegateWillBeginEditing:1; unsigned int delegateDidEndEditing:1; unsigned int delegateWillMoveToRow:1; unsigned int delegateIndentationLevelForRow:1; unsigned int delegateWantsHeaderForSection:1; unsigned int delegateHeightForRowsInSection:1; unsigned int delegateMargin:1; unsigned int delegateHeaderTitleAlignment:1; unsigned int delegateFooterTitleAlignment:1; unsigned int delegateFrameForSectionIndexGivenProposedFrame:1; unsigned int delegateDidFinishReload:1; unsigned int delegateHeightForHeader:1; unsigned int delegateHeightForFooter:1; unsigned int delegateViewForHeader:1; unsigned int delegateViewForFooter:1; unsigned int delegateCalloutTargetRectForCell; unsigned int delegateShouldShowMenu:1; unsigned int delegateCanPerformAction:1; unsigned int delegatePerformAction:1; unsigned int delegateWillBeginReordering:1; unsigned int delegateDidEndReordering:1; unsigned int delegateDidCancelReordering:1; unsigned int delegateWillDisplayHeaderViewForSection:1; unsigned int delegateWillDisplayFooterViewForSection:1; unsigned int delegateShouldHighlightRow:1; unsigned int delegateDidHighlightRow:1; unsigned int delegateDidUnhighlightRow:1; unsigned int style:1; unsigned int separatorStyle:3; unsigned int wasEditing:1; unsigned int isEditing:1; unsigned int scrollsToSelection:1; unsigned int reloadSkippedDuringSuspension:1; unsigned int updating:1; unsigned int displaySkippedDuringSuspension:1; unsigned int needsReload:1; unsigned int updatingVisibleCellsManually:1; unsigned int scheduledUpdateVisibleCells:1; unsigned int scheduledUpdateVisibleCellsFrames:1; unsigned int warnForForcedCellUpdateDisabled:1; unsigned int displayTopSeparator:1; unsigned int countStringInsignificantRowCount:4; unsigned int needToAdjustExtraSeparators:1; unsigned int overlapsSectionHeaderViews:1; unsigned int ignoreDragSwipe:1; unsigned int ignoreTouchSelect:1; unsigned int lastHighlightedRowActive:1; unsigned int reloading:1; unsigned int allowsSelection:1; unsigned int allowsSelectionDuringEditing:1; unsigned int allowsMultipleSelection:1; unsigned int allowsMultipleSelectionDuringEditing:1; unsigned int showsSelectionImmediatelyOnTouchBegin:1; unsigned int indexHidden:1; unsigned int indexHiddenForSearch:1; unsigned int defaultShowsHorizontalScrollIndicator:1; unsigned int defaultShowsVerticalScrollIndicator:1; unsigned int sectionIndexTitlesLoaded:1; unsigned int tableHeaderViewShouldAutoHide:1; unsigned int tableHeaderViewIsHidden:1; unsigned int tableHeaderViewWasHidden:1; unsigned int tableHeaderViewShouldPin:1; unsigned int hideScrollIndicators:1; unsigned int sendReloadFinished:1; unsigned int keepFirstResponderWhenInteractionDisabled:1; unsigned int keepFirstResponderVisibleOnBoundsChange:1; unsigned int dontDrawTopShadowInGroupedSections:1; unsigned int forceStaticHeadersAndFooters; unsigned int displaysCellContentStringsOnTapAndHold:1; unsigned int displayingCellContentStringCallout:1; unsigned int longPressAutoscrollingActive:1; unsigned int adjustsRowHeightsForSectionLocation:1; unsigned int customSectionContentInsetSet:1; unsigned int inInit:1; unsigned int inSetBackgroundColor:1; unsigned int usingCustomBackgroundView:1; unsigned int rowDataIndexPathsAreValidForCurrentCells:1; } _tableFlags; } - (id)initWithFrame:(CGRect)frame style:(UITableViewStyle)style; // must specify style at creation. -initWithFrame: calls this with UITableViewStylePlain @property(nonatomic,readonly) UITableViewStyle style; @property(nonatomic,assign) id dataSource; @property(nonatomic,assign) id delegate; @property(nonatomic) CGFloat rowHeight; // will return the default value if unset @property(nonatomic) CGFloat sectionHeaderHeight; // will return the default value if unset @property(nonatomic) CGFloat sectionFooterHeight; // will return the default value if unset @property(nonatomic, readwrite, retain) UIView *backgroundView NS_AVAILABLE_IOS(3_2); // the background view will be automatically resized to track the size of the table view. this will be placed as a subview of the table view behind all cells and headers/footers. default may be non-nil for some devices. // Data - (void)reloadData; // reloads everything from scratch. redisplays visible rows. because we only keep info about visible rows, this is cheap. will adjust offset if table shrinks - (void)reloadSectionIndexTitles NS_AVAILABLE_IOS(3_0); // reloads the index bar. // Info - (NSInteger)numberOfSections; - (NSInteger)numberOfRowsInSection:(NSInteger)section; - (CGRect)rectForSection:(NSInteger)section; // includes header, footer and all rows - (CGRect)rectForHeaderInSection:(NSInteger)section; - (CGRect)rectForFooterInSection:(NSInteger)section; - (CGRect)rectForRowAtIndexPath:(NSIndexPath *)indexPath; - (NSIndexPath *)indexPathForRowAtPoint:(CGPoint)point; // returns nil if point is outside table - (NSIndexPath *)indexPathForCell:(UITableViewCell *)cell; // returns nil if cell is not visible - (NSArray *)indexPathsForRowsInRect:(CGRect)rect; // returns nil if rect not valid - (UITableViewCell *)cellForRowAtIndexPath:(NSIndexPath *)indexPath; // returns nil if cell is not visible or index path is out of range - (NSArray *)visibleCells; - (NSArray *)indexPathsForVisibleRows; - (UITableViewHeaderFooterView *)headerViewForSection:(NSInteger)section NS_AVAILABLE_IOS(6_0); - (UITableViewHeaderFooterView *)footerViewForSection:(NSInteger)section NS_AVAILABLE_IOS(6_0); - (void)scrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated; - (void)scrollToNearestSelectedRowAtScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated; // Row insertion/deletion/reloading. - (void)beginUpdates; // allow multiple insert/delete of rows and sections to be animated simultaneously. Nestable - (void)endUpdates; // only call insert/delete/reload calls or change the editing state inside an update block. otherwise things like row count, etc. may be invalid. - (void)insertSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation; - (void)deleteSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation; - (void)reloadSections:(NSIndexSet *)sections withRowAnimation:(UITableViewRowAnimation)animation NS_AVAILABLE_IOS(3_0); - (void)moveSection:(NSInteger)section toSection:(NSInteger)newSection NS_AVAILABLE_IOS(5_0); - (void)insertRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation; - (void)deleteRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation; - (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation NS_AVAILABLE_IOS(3_0); - (void)moveRowAtIndexPath:(NSIndexPath *)indexPath toIndexPath:(NSIndexPath *)newIndexPath NS_AVAILABLE_IOS(5_0); // Editing. When set, rows show insert/delete/reorder controls based on data source queries @property(nonatomic,getter=isEditing) BOOL editing; // default is NO. setting is not animated. - (void)setEditing:(BOOL)editing animated:(BOOL)animated; @property(nonatomic) BOOL allowsSelection NS_AVAILABLE_IOS(3_0); // default is YES. Controls whether rows can be selected when not in editing mode @property(nonatomic) BOOL allowsSelectionDuringEditing; // default is NO. Controls whether rows can be selected when in editing mode @property(nonatomic) BOOL allowsMultipleSelection NS_AVAILABLE_IOS(5_0); // default is NO. Controls whether multiple rows can be selected simultaneously @property(nonatomic) BOOL allowsMultipleSelectionDuringEditing NS_AVAILABLE_IOS(5_0); // default is NO. Controls whether multiple rows can be selected simultaneously in editing mode // Selection - (NSIndexPath *)indexPathForSelectedRow; // returns nil or index path representing section and row of selection. - (NSArray *)indexPathsForSelectedRows NS_AVAILABLE_IOS(5_0); // returns nil or a set of index paths representing the sections and rows of the selection. // Selects and deselects rows. These methods will not call the delegate methods (-tableView:willSelectRowAtIndexPath: or tableView:didSelectRowAtIndexPath:), nor will it send out a notification. - (void)selectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated scrollPosition:(UITableViewScrollPosition)scrollPosition; - (void)deselectRowAtIndexPath:(NSIndexPath *)indexPath animated:(BOOL)animated; // Appearance @property(nonatomic) NSInteger sectionIndexMinimumDisplayRowCount; // show special section index list on right when row count reaches this value. default is NSInteger Max @property(nonatomic, retain) UIColor *sectionIndexColor NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR; // color used for text of the section index @property(nonatomic, retain) UIColor *sectionIndexTrackingBackgroundColor NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR; // the background color of the section index while it is being touched @property(nonatomic) UITableViewCellSeparatorStyle separatorStyle; // default is UITableViewCellSeparatorStyleSingleLine @property(nonatomic,retain) UIColor *separatorColor; // default is the standard separator gray @property(nonatomic,retain) UIView *tableHeaderView; // accessory view for above row content. default is nil. not to be confused with section header @property(nonatomic,retain) UIView *tableFooterView; // accessory view below content. default is nil. not to be confused with section footer - (id)dequeueReusableCellWithIdentifier:(NSString *)identifier; // Used by the delegate to acquire an already allocated cell, in lieu of allocating a new one. - (id)dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath NS_AVAILABLE_IOS(6_0); // newer dequeue method guarantees a cell is returned and resized properly, assuming identifier is registered - (id)dequeueReusableHeaderFooterViewWithIdentifier:(NSString *)identifier NS_AVAILABLE_IOS(6_0); // like dequeueReusableCellWithIdentifier:, but for headers/footers // Beginning in iOS 6, clients can register a nib or class for each cell. // If all reuse identifiers are registered, use the newer -dequeueReusableCellWithIdentifier:forIndexPath: to guarantee that a cell instance is returned. // Instances returned from the new dequeue method will also be properly sized when they are returned. - (void)registerNib:(UINib *)nib forCellReuseIdentifier:(NSString *)identifier NS_AVAILABLE_IOS(5_0); - (void)registerClass:(Class)cellClass forCellReuseIdentifier:(NSString *)identifier NS_AVAILABLE_IOS(6_0); - (void)registerNib:(UINib *)nib forHeaderFooterViewReuseIdentifier:(NSString *)identifier NS_AVAILABLE_IOS(6_0); - (void)registerClass:(Class)aClass forHeaderFooterViewReuseIdentifier:(NSString *)identifier NS_AVAILABLE_IOS(6_0); @end //_______________________________________________________________________________________________________________ // this protocol represents the data model object. as such, it supplies no information about appearance (including the cells) @protocol UITableViewDataSource @required - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section; // Row display. Implementers should *always* try to reuse cells by setting each cell's reuseIdentifier and querying for available reusable cells with dequeueReusableCellWithIdentifier: // Cell gets various attributes set automatically based on table (separators) and data source (accessory views, editing controls) - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath; @optional - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView; // Default is 1 if not implemented - (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section; // fixed font style. use custom view (UILabel) if you want something different - (NSString *)tableView:(UITableView *)tableView titleForFooterInSection:(NSInteger)section; // Editing // Individual rows can opt out of having the -editing property set for them. If not implemented, all rows are assumed to be editable. - (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath; // Moving/reordering // Allows the reorder accessory view to optionally be shown for a particular row. By default, the reorder control will be shown only if the datasource implements -tableView:moveRowAtIndexPath:toIndexPath: - (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath; // Index - (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView; // return list of section titles to display in section index view (e.g. "ABCD...Z#") - (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index; // tell table which section corresponds to section title/index (e.g. "B",1)) // Data manipulation - insert and delete support // After a row has the minus or plus button invoked (based on the UITableViewCellEditingStyle for the cell), the dataSource must commit the change - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath; // Data manipulation - reorder / moving support - (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)sourceIndexPath toIndexPath:(NSIndexPath *)destinationIndexPath; @end //_______________________________________________________________________________________________________________ // This category provides convenience methods to make it easier to use an NSIndexPath to represent a section and row @interface NSIndexPath (UITableView) + (NSIndexPath *)indexPathForRow:(NSInteger)row inSection:(NSInteger)section; @property(nonatomic,readonly) NSInteger section; @property(nonatomic,readonly) NSInteger row; @end // // UITableViewCell.h // UIKit // // Copyright (c) 2005-2012, Apple Inc. All rights reserved. // #import #import #import #import #import #import @class UIImage, UIColor, UILabel, UIImageView, UIButton, UITextField, UITableView, UILongPressGestureRecognizer; typedef NS_ENUM(NSInteger, UITableViewCellStyle) { UITableViewCellStyleDefault, // Simple cell with text label and optional image view (behavior of UITableViewCell in iPhoneOS 2.x) UITableViewCellStyleValue1, // Left aligned label on left and right aligned label on right with blue text (Used in Settings) UITableViewCellStyleValue2, // Right aligned label on left with blue text and left aligned label on right (Used in Phone/Contacts) UITableViewCellStyleSubtitle // Left aligned label on top and left aligned label on bottom with gray text (Used in iPod). }; // available in iPhone OS 3.0 typedef NS_ENUM(NSInteger, UITableViewCellSeparatorStyle) { UITableViewCellSeparatorStyleNone, UITableViewCellSeparatorStyleSingleLine, UITableViewCellSeparatorStyleSingleLineEtched // This separator style is only supported for grouped style table views currently }; typedef NS_ENUM(NSInteger, UITableViewCellSelectionStyle) { UITableViewCellSelectionStyleNone, UITableViewCellSelectionStyleBlue, UITableViewCellSelectionStyleGray }; typedef NS_ENUM(NSInteger, UITableViewCellEditingStyle) { UITableViewCellEditingStyleNone, UITableViewCellEditingStyleDelete, UITableViewCellEditingStyleInsert }; typedef NS_ENUM(NSInteger, UITableViewCellAccessoryType) { UITableViewCellAccessoryNone, // don't show any accessory view UITableViewCellAccessoryDisclosureIndicator, // regular chevron. doesn't track UITableViewCellAccessoryDetailDisclosureButton, // blue button w/ chevron. tracks UITableViewCellAccessoryCheckmark // checkmark. doesn't track }; typedef NS_OPTIONS(NSUInteger, UITableViewCellStateMask) { UITableViewCellStateDefaultMask = 0, UITableViewCellStateShowingEditControlMask = 1 << 0, UITableViewCellStateShowingDeleteConfirmationMask = 1 << 1 }; #define UITableViewCellStateEditingMask UITableViewCellStateShowingEditControlMask NS_CLASS_AVAILABLE_IOS(2_0) @interface UITableViewCell : UIView { @private UITableView *_tableView; id _layoutManager; id _target; SEL _editAction; SEL _accessoryAction; id _oldEditingData; id _editingData; CGFloat _rightMargin; NSInteger _indentationLevel; CGFloat _indentationWidth; NSString *_reuseIdentifier; UIView *_contentView; UIImageView *_imageView; UILabel *_textLabel; UILabel *_detailTextLabel; UIView *_backgroundView; UIView *_selectedBackgroundView; UIView *_multipleSelectionBackgroundView; UIView *_selectedOverlayView; CGFloat _selectionFadeDuration; UIColor *_backgroundColor; UIColor *_separatorColor; UIColor *_topShadowColor; UIColor *_bottomShadowColor; UIColor *_sectionBorderColor; UIView *_floatingSeparatorView; UIView *_topShadowAnimationView; UIView *_bottomShadowAnimationView; id _badge; CFMutableDictionaryRef _unhighlightedStates; id _selectionSegueTemplate; id _accessoryActionSegueTemplate; struct { unsigned int showingDeleteConfirmation:1; unsigned int separatorStyle:3; unsigned int selectionStyle:3; unsigned int selectionFadeFraction:11; // used to indicate selection unsigned int editing:1; unsigned int editingStyle:3; unsigned int accessoryType:3; unsigned int editingAccessoryType:3; unsigned int showsAccessoryWhenEditing:1; unsigned int showsReorderControl:1; unsigned int showDisclosure:1; unsigned int showTopSeparator:1; unsigned int hideTopSeparatorDuringReordering:1; unsigned int disclosureClickable:1; unsigned int disclosureStyle:1; unsigned int showingRemoveControl:1; unsigned int sectionLocation:3; unsigned int tableViewStyle:1; unsigned int shouldIndentWhileEditing:1; unsigned int fontSet:1; unsigned int usingDefaultSelectedBackgroundView:1; unsigned int wasSwiped:1; unsigned int highlighted:1; unsigned int separatorDirty:1; unsigned int drawn:1; unsigned int drawingDisabled:1; unsigned int style:12; unsigned int showingMenu:1; unsigned int clipsContents:1; unsigned int animatingSelection:1; unsigned int backgroundColorSet:1; unsigned int needsSetup:1; unsigned int dontDrawTopShadow:1; unsigned int usingMultiselectbackgroundView:1; unsigned int layoutLoopCounter:2; } _tableCellFlags; UIButton *_accessoryView; UIButton *_editingAccessoryView; UIView *_customAccessoryView; UIView *_customEditingAccessoryView; UIView *_separatorView; UIView *_topSeparatorView; UIView *_topShadowView; UITextField *_editableTextField; CFAbsoluteTime _lastSelectionTime; NSTimer *_deselectTimer; CGFloat _textFieldOffset; SEL _returnAction; UIColor *_selectionTintColor; UIColor *_accessoryTintColor; UIImage *_reorderControlImage; UILongPressGestureRecognizer* _menuGesture; id _highlightingSupport; NSIndexPath* _representedIndexPath; } // Designated initializer. If the cell can be reused, you must pass in a reuse identifier. You should use the same reuse identifier for all cells of the same form. - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier NS_AVAILABLE_IOS(3_0); // Content. These properties provide direct access to the internal label and image views used by the table view cell. These should be used instead of the content properties below. @property(nonatomic,readonly,retain) UIImageView *imageView NS_AVAILABLE_IOS(3_0); // default is nil. image view will be created if necessary. @property(nonatomic,readonly,retain) UILabel *textLabel NS_AVAILABLE_IOS(3_0); // default is nil. label will be created if necessary. @property(nonatomic,readonly,retain) UILabel *detailTextLabel NS_AVAILABLE_IOS(3_0); // default is nil. label will be created if necessary (and the current style supports a detail label). // If you want to customize cells by simply adding additional views, you should add them to the content view so they will be positioned appropriately as the cell transitions into and out of editing mode. @property(nonatomic,readonly,retain) UIView *contentView; // Default is nil for cells in UITableViewStylePlain, and non-nil for UITableViewStyleGrouped. The 'backgroundView' will be added as a subview behind all other views. @property(nonatomic,retain) UIView *backgroundView; // Default is nil for cells in UITableViewStylePlain, and non-nil for UITableViewStyleGrouped. The 'selectedBackgroundView' will be added as a subview directly above the backgroundView if not nil, or behind all other views. It is added as a subview only when the cell is selected. Calling -setSelected:animated: will cause the 'selectedBackgroundView' to animate in and out with an alpha fade. @property(nonatomic,retain) UIView *selectedBackgroundView; // If not nil, takes the place of the selectedBackgroundView when using multiple selection. @property(nonatomic,retain) UIView *multipleSelectionBackgroundView NS_AVAILABLE_IOS(5_0); @property(nonatomic,readonly,copy) NSString *reuseIdentifier; - (void)prepareForReuse; // if the cell is reusable (has a reuse identifier), this is called just before the cell is returned from the table view method dequeueReusableCellWithIdentifier:. If you override, you MUST call super. @property(nonatomic) UITableViewCellSelectionStyle selectionStyle; // default is UITableViewCellSelectionStyleBlue. @property(nonatomic,getter=isSelected) BOOL selected; // set selected state (title, image, background). default is NO. animated is NO @property(nonatomic,getter=isHighlighted) BOOL highlighted; // set highlighted state (title, image, background). default is NO. animated is NO - (void)setSelected:(BOOL)selected animated:(BOOL)animated; // animate between regular and selected state - (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated; // animate between regular and highlighted state @property(nonatomic,readonly) UITableViewCellEditingStyle editingStyle; // default is UITableViewCellEditingStyleNone. This is set by UITableView using the delegate's value for cells who customize their appearance accordingly. @property(nonatomic) BOOL showsReorderControl; // default is NO @property(nonatomic) BOOL shouldIndentWhileEditing; // default is YES. This is unrelated to the indentation level below. @property(nonatomic) UITableViewCellAccessoryType accessoryType; // default is UITableViewCellAccessoryNone. use to set standard type @property(nonatomic,retain) UIView *accessoryView; // if set, use custom view. ignore accessoryType. tracks if enabled can calls accessory action @property(nonatomic) UITableViewCellAccessoryType editingAccessoryType; // default is UITableViewCellAccessoryNone. use to set standard type @property(nonatomic,retain) UIView *editingAccessoryView; // if set, use custom view. ignore editingAccessoryType. tracks if enabled can calls accessory action @property(nonatomic) NSInteger indentationLevel; // adjust content indent. default is 0 @property(nonatomic) CGFloat indentationWidth; // width for each level. default is 10.0 @property(nonatomic,getter=isEditing) BOOL editing; // show appropriate edit controls (+/- & reorder). By default -setEditing: calls setEditing:animated: with NO for animated. - (void)setEditing:(BOOL)editing animated:(BOOL)animated; @property(nonatomic,readonly) BOOL showingDeleteConfirmation; // currently showing "Delete" button // These methods can be used by subclasses to animate additional changes to the cell when the cell is changing state // Note that when the cell is swiped, the cell will be transitioned into the UITableViewCellStateShowingDeleteConfirmationMask state, // but the UITableViewCellStateShowingEditControlMask will not be set. - (void)willTransitionToState:(UITableViewCellStateMask)state NS_AVAILABLE_IOS(3_0); - (void)didTransitionToState:(UITableViewCellStateMask)state NS_AVAILABLE_IOS(3_0); @end @interface UITableViewCell (UIDeprecated) // Frame is ignored. The size will be specified by the table view width and row height. - (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString *)reuseIdentifier NS_DEPRECATED_IOS(2_0, 3_0); // Content properties. These properties were deprecated in iPhone OS 3.0. The textLabel and imageView properties above should be used instead. // For selected attributes, set the highlighted attributes on the textLabel and imageView. @property(nonatomic,copy) NSString *text NS_DEPRECATED_IOS(2_0, 3_0); // default is nil @property(nonatomic,retain) UIFont *font NS_DEPRECATED_IOS(2_0, 3_0); // default is nil (Use default font) @property(nonatomic) NSTextAlignment textAlignment NS_DEPRECATED_IOS(2_0, 3_0); // default is UITextAlignmentLeft @property(nonatomic) NSLineBreakMode lineBreakMode NS_DEPRECATED_IOS(2_0, 3_0); // default is UILineBreakModeTailTruncation @property(nonatomic,retain) UIColor *textColor NS_DEPRECATED_IOS(2_0, 3_0); // default is nil (text draws black) @property(nonatomic,retain) UIColor *selectedTextColor NS_DEPRECATED_IOS(2_0, 3_0); // default is nil (text draws white) @property(nonatomic,retain) UIImage *image NS_DEPRECATED_IOS(2_0, 3_0); // default is nil. appears on left next to title. @property(nonatomic,retain) UIImage *selectedImage NS_DEPRECATED_IOS(2_0, 3_0); // default is nil // Use the new editingAccessoryType and editingAccessoryView instead @property(nonatomic) BOOL hidesAccessoryWhenEditing NS_DEPRECATED_IOS(2_0, 3_0); // default is YES // Use the table view data source method -tableView:commitEditingStyle:forRowAtIndexPath: or the table view delegate method -tableView:accessoryButtonTappedForRowWithIndexPath: instead @property(nonatomic,assign) id target NS_DEPRECATED_IOS(2_0, 3_0); // target for insert/delete/accessory clicks. default is nil (i.e. go up responder chain). weak reference @property(nonatomic) SEL editAction NS_DEPRECATED_IOS(2_0, 3_0); // action to call on insert/delete call. set by UITableView @property(nonatomic) SEL accessoryAction NS_DEPRECATED_IOS(2_0, 3_0); // action to call on accessory view clicked. set by UITableView @end // // UITableViewController.h // UIKit // // Copyright (c) 2008-2012, Apple Inc. All rights reserved. // #import #import #import #import // Creates a table view with the correct dimensions and autoresizing, setting the datasource and delegate to self. // In -viewWillAppear:, it reloads the table's data if it's empty. Otherwise, it deselects all rows (with or without animation) if clearsSelectionOnViewWillAppear is YES. // In -viewDidAppear:, it flashes the table's scroll indicators. // Implements -setEditing:animated: to toggle the editing state of the table. NS_CLASS_AVAILABLE_IOS(2_0) @interface UITableViewController : UIViewController { @private UITableViewStyle _tableViewStyle; id _keyboardSupport; id _staticDataSource; struct { int clearsSelectionOnViewWillAppear:1; int insetsApplied:1; int adjustingInsets:1; } _tableViewControllerFlags; } - (id)initWithStyle:(UITableViewStyle)style; @property(nonatomic,retain) UITableView *tableView; @property(nonatomic) BOOL clearsSelectionOnViewWillAppear NS_AVAILABLE_IOS(3_2); // defaults to YES. If YES, any selection is cleared in viewWillAppear: @property (nonatomic,retain) UIRefreshControl *refreshControl NS_AVAILABLE_IOS(6_0); @end // // UITableViewHeaderFooterView.h // UIKit // // Copyright (c) 2008-2012, Apple Inc. All rights reserved. // #import #import // Either the header or footer for a section NS_CLASS_AVAILABLE_IOS(6_0) @interface UITableViewHeaderFooterView : UIView @property(nonatomic, retain) UIColor *tintColor UI_APPEARANCE_SELECTOR; @property(nonatomic, readonly, retain) UILabel* textLabel; @property(nonatomic, readonly, retain) UILabel* detailTextLabel; // only supported for headers in grouped style @property (nonatomic, readonly, retain) UIView *contentView; @property (nonatomic, retain) UIView *backgroundView; @property (nonatomic, readonly, copy) NSString *reuseIdentifier; - (id)initWithReuseIdentifier:(NSString *)reuseIdentifier; - (void)prepareForReuse; // if the view is reusable (has a reuse identifier), this is called just before the view is returned from the table view method dequeueReusableHeaderFooterViewWithIdentifier:. If you override, you MUST call super. @end // // UITapGestureRecognizer.h // UIKit // // Copyright (c) 2008-2012, Apple Inc. All rights reserved. // #import #import #import // Recognizes: when numberOfTouchesRequired have tapped numberOfTapsRequired times // Touch Location Behaviors: // locationInView: location of the tap, from the first tap in the sequence if numberOfTapsRequired > 1. this is the centroid if numberOfTouchesRequired > 1 // locationOfTouch:inView: location of a particular touch, from the first tap in the sequence if numberOfTapsRequired > 1 NS_CLASS_AVAILABLE_IOS(3_2) @interface UITapGestureRecognizer : UIGestureRecognizer { @package CGPoint _locationInView; id _imp; unsigned int _delaysRecognitionForGreaterTapCounts; } @property (nonatomic) NSUInteger numberOfTapsRequired; // Default is 1. The number of taps required to match @property (nonatomic) NSUInteger numberOfTouchesRequired; // Default is 1. The number of fingers required to match @end // // UITextChecker.h // UIKit // // Copyright (c) 2009-2012, Apple Inc. All rights reserved. // #import #import /* A UITextChecker object is used by a client (e.g. a document in an application) to check a given NSString. Generally one UITextChecker instance should be created per document. Multiple related pieces of text may share a single UITextChecker instance, if they are intended to share ignored words and other similar state. */ NS_CLASS_AVAILABLE_IOS(3_2) @interface UITextChecker : NSObject { @private id _checker; id _reserved; NSInteger _usdt; } /* Initiates a spell-check of a string. Returns the range of the first misspelled word, or {NSNotFound, 0} if none is found. Checking is limited to the range specified, and starts at the specified offset (which should lie within the range), but if wrapFlag is YES then it will check from the beginning of the range if no misspelling is found between startingOffset and the end of the range. */ - (NSRange)rangeOfMisspelledWordInString:(NSString *)stringToCheck range:(NSRange)range startingAt:(NSInteger)startingOffset wrap:(BOOL)wrapFlag language:(NSString *)language; /* Returns an array of strings, in the order in which they should be presented, representing guesses for words that might have been intended in place of the misspelled word at the given range in the given string. */ - (NSArray *)guessesForWordRange:(NSRange)range inString:(NSString *)string language:(NSString *)language; /* Returns an array of strings, in the order in which they should be presented, representing complete words that the user might be trying to type when starting by typing the partial word at the given range in the given string. */ - (NSArray *)completionsForPartialWordRange:(NSRange)range inString:(NSString *)string language:(NSString *)language; /* Methods for dealing with ignored words. */ - (void)ignoreWord:(NSString *)wordToIgnore; - (NSArray *)ignoredWords; - (void)setIgnoredWords:(NSArray *)words; /* These allow clients to programmatically instruct the checker to learn and unlearn words, and to determine whether a word has been learned (and hence can potentially be unlearned). */ + (void)learnWord:(NSString *)word; + (BOOL)hasLearnedWord:(NSString *)word; + (void)unlearnWord:(NSString *)word; /* Entries in the availableLanguages list are all available spellchecking languages in user preference order, usually language abbreviations such as en_US. */ + (NSArray *)availableLanguages; @end // // UITextField.h // UIKit // // Copyright (c) 2005-2012, Apple Inc. All rights reserved. // #import #import #import #import #import #import #import @class UIImage, UIImageView, UILabel, UIColor, UIButton; @class UITextFieldAtomBackgroundView; @class UITextFieldBackgroundView; @class UITextFieldBorderView; @class UITextFieldLabel; @class UITextInputTraits; @class UITextSelectionView; @class UITextInteractionAssistant; @class UIPopoverController; @protocol UITextFieldDelegate; @protocol UITextSelecting; typedef NS_ENUM(NSInteger, UITextBorderStyle) { UITextBorderStyleNone, UITextBorderStyleLine, UITextBorderStyleBezel, UITextBorderStyleRoundedRect }; typedef NS_ENUM(NSInteger, UITextFieldViewMode) { UITextFieldViewModeNever, UITextFieldViewModeWhileEditing, UITextFieldViewModeUnlessEditing, UITextFieldViewModeAlways }; NS_CLASS_AVAILABLE_IOS(2_0) @interface UITextField : UIControl { @private NSAttributedString *_text; UIColor *_textColor; UITextBorderStyle _borderStyle; CGFloat _minimumFontSize; id _delegate; UIImage *_background; UIImage *_disabledBackground; UITextFieldViewMode _clearButtonMode; UIView *_leftView; UITextFieldViewMode _leftViewMode; UIView *_rightView; UITextFieldViewMode _rightViewMode; UITextInputTraits *_traits; UITextInputTraits *_nonAtomTraits; CGFloat _fullFontSize; // font size to use when no shrinkage is needed. CGFloat _paddingLeft; CGFloat _paddingTop; CGFloat _paddingRight; CGFloat _paddingBottom; NSString *_textFont; // This ivar will go away. This is deprecated and people should use _font NSRange _selectionRange; int _scrollXOffset; int _scrollYOffset; float _progress; NSString *_style; UIButton *_clearButton; CGSize _clearButtonOffset; CGSize _leftViewOffset; CGSize _rightViewOffset; UITextFieldBorderView *_backgroundView; UITextFieldBorderView *_disabledBackgroundView; UITextFieldBackgroundView *_systemBackgroundView; UITextFieldLabel *_textLabel; UITextFieldLabel *_placeholderLabel; UITextFieldLabel *_suffixLabel; UITextFieldLabel *_prefixLabel; UIImageView *_iconView; UILabel *_label; CGFloat _labelOffset; UITextInteractionAssistant *_interactionAssistant; UIView *_inputView; UIView *_inputAccessoryView; UITextFieldAtomBackgroundView *_atomBackgroundView; UIColor *_shadowColor; CGSize _shadowOffset; CGFloat _shadowBlur; struct { unsigned int secureTextChanged:1; unsigned int guard:1; unsigned int delegateRespondsToHandleKeyDown:1; unsigned int verticallyCenterText:1; unsigned int isAnimating:4; unsigned int inactiveHasDimAppearance:1; unsigned int becomesFirstResponderOnClearButtonTap:1; unsigned int clearsOnBeginEditing:1; unsigned int clearsPlaceholderOnBeginEditing:1; unsigned int adjustsFontSizeToFitWidth:1; unsigned int fieldEditorAttached:1; unsigned int canBecomeFirstResponder:1; unsigned int shouldSuppressShouldBeginEditing:1; unsigned int inResignFirstResponder:1; unsigned int undoDisabled:1; unsigned int contentsRTL:1; unsigned int explicitAlignment:1; unsigned int implementsCustomDrawing:1; unsigned int needsClearing:1; unsigned int suppressContentChangedNotification:1; unsigned int allowsEditingTextAttributes:1; unsigned int usesAttributedText:1; unsigned int backgroundViewState:2; unsigned int clearsOnInsertion:1; } _textFieldFlags; } // End ivars // ============================================================================= // Begin SDK properties @property(nonatomic,copy) NSString *text; // default is nil @property(nonatomic,copy) NSAttributedString *attributedText NS_AVAILABLE_IOS(6_0); // default is nil @property(nonatomic,retain) UIColor *textColor; // default is nil. use opaque black @property(nonatomic,retain) UIFont *font; // default is nil. use system font 12 pt @property(nonatomic) NSTextAlignment textAlignment; // default is NSLeftTextAlignment @property(nonatomic) UITextBorderStyle borderStyle; // default is UITextBorderStyleNone. If set to UITextBorderStyleRoundedRect, custom background images are ignored. @property(nonatomic,copy) NSString *placeholder; // default is nil. string is drawn 70% gray @property(nonatomic,copy) NSAttributedString *attributedPlaceholder NS_AVAILABLE_IOS(6_0); // default is nil @property(nonatomic) BOOL clearsOnBeginEditing; // default is NO which moves cursor to location clicked. if YES, all text cleared @property(nonatomic) BOOL adjustsFontSizeToFitWidth; // default is NO. if YES, text will shrink to minFontSize along baseline @property(nonatomic) CGFloat minimumFontSize; // default is 0.0. actual min may be pinned to something readable. used if adjustsFontSizeToFitWidth is YES @property(nonatomic,assign) id delegate; // default is nil. weak reference @property(nonatomic,retain) UIImage *background; // default is nil. draw in border rect. image should be stretchable @property(nonatomic,retain) UIImage *disabledBackground; // default is nil. ignored if background not set. image should be stretchable @property(nonatomic,readonly,getter=isEditing) BOOL editing; @property(nonatomic) BOOL allowsEditingTextAttributes NS_AVAILABLE_IOS(6_0); // default is NO. allows editing text attributes with style operations and pasting rich text @property(nonatomic,copy) NSDictionary *typingAttributes NS_AVAILABLE_IOS(6_0); // automatically resets when the selection changes // You can supply custom views which are displayed at the left or right // sides of the text field. Uses for such views could be to show an icon or // a button to operate on the text in the field in an application-defined // manner. // // A very common use is to display a clear button on the right side of the // text field, and a standard clear button is provided. Note: if the clear // button overlaps one of the other views, the clear button will be given // precedence. @property(nonatomic) UITextFieldViewMode clearButtonMode; // sets when the clear button shows up. default is UITextFieldViewModeNever @property(nonatomic,retain) UIView *leftView; // e.g. magnifying glass @property(nonatomic) UITextFieldViewMode leftViewMode; // sets when the left view shows up. default is UITextFieldViewModeNever @property(nonatomic,retain) UIView *rightView; // e.g. bookmarks button @property(nonatomic) UITextFieldViewMode rightViewMode; // sets when the right view shows up. default is UITextFieldViewModeNever // drawing and positioning overrides - (CGRect)borderRectForBounds:(CGRect)bounds; - (CGRect)textRectForBounds:(CGRect)bounds; - (CGRect)placeholderRectForBounds:(CGRect)bounds; - (CGRect)editingRectForBounds:(CGRect)bounds; - (CGRect)clearButtonRectForBounds:(CGRect)bounds; - (CGRect)leftViewRectForBounds:(CGRect)bounds; - (CGRect)rightViewRectForBounds:(CGRect)bounds; - (void)drawTextInRect:(CGRect)rect; - (void)drawPlaceholderInRect:(CGRect)rect; // Presented when object becomes first responder. If set to nil, reverts to following responder chain. If // set while first responder, will not take effect until reloadInputViews is called. @property (readwrite, retain) UIView *inputView; @property (readwrite, retain) UIView *inputAccessoryView; @property(nonatomic) BOOL clearsOnInsertion NS_AVAILABLE_IOS(6_0); // defaults to NO. if YES, the selection UI is hidden, and inserting text will replace the contents of the field. changing the selection will automatically set this to NO. @end @interface UIView (UITextField) - (BOOL)endEditing:(BOOL)force; // use to make the view or any subview that is the first responder resign (optionally force) @end @protocol UITextFieldDelegate @optional - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField; // return NO to disallow editing. - (void)textFieldDidBeginEditing:(UITextField *)textField; // became first responder - (BOOL)textFieldShouldEndEditing:(UITextField *)textField; // return YES to allow editing to stop and to resign first responder status. NO to disallow the editing session to end - (void)textFieldDidEndEditing:(UITextField *)textField; // may be called if forced even if shouldEndEditing returns NO (e.g. view removed from window) or endEditing:YES called - (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string; // return NO to not change text - (BOOL)textFieldShouldClear:(UITextField *)textField; // called when clear button pressed. return NO to ignore (no notifications) - (BOOL)textFieldShouldReturn:(UITextField *)textField; // called when 'return' key pressed. return NO to ignore. @end UIKIT_EXTERN NSString *const UITextFieldTextDidBeginEditingNotification; UIKIT_EXTERN NSString *const UITextFieldTextDidEndEditingNotification; UIKIT_EXTERN NSString *const UITextFieldTextDidChangeNotification; // // UITextInput.h // UIKit // // Copyright (c) 2009-2012, Apple Inc. All rights reserved. // #import #import #import //=================================================================================================== // Responders that implement the UIKeyInput protocol will be driven by the system-provided keyboard, // which will be made available whenever a conforming responder becomes first responder. @protocol UIKeyInput - (BOOL)hasText; - (void)insertText:(NSString *)text; - (void)deleteBackward; @end //=================================================================================================== // Responders that implement the UITextInput protocol allow the system-provided keyboard to // offer more sophisticated behaviors based on a current selection and context. @class UITextPosition; @class UITextRange; @class UITextSelectionRect; @protocol UITextInputTokenizer; @protocol UITextInputDelegate; typedef NS_ENUM(NSInteger, UITextStorageDirection) { UITextStorageDirectionForward = 0, UITextStorageDirectionBackward }; typedef NS_ENUM(NSInteger, UITextLayoutDirection) { UITextLayoutDirectionRight = 2, UITextLayoutDirectionLeft, UITextLayoutDirectionUp, UITextLayoutDirectionDown }; typedef NSInteger UITextDirection; typedef NS_ENUM(NSInteger, UITextWritingDirection) { UITextWritingDirectionNatural = -1, UITextWritingDirectionLeftToRight = 0, UITextWritingDirectionRightToLeft, }; typedef NS_ENUM(NSInteger, UITextGranularity) { UITextGranularityCharacter, UITextGranularityWord, UITextGranularitySentence, UITextGranularityParagraph, UITextGranularityLine, UITextGranularityDocument }; NS_CLASS_AVAILABLE_IOS(5_1) @interface UIDictationPhrase : NSObject { @private NSString *_text; NSArray *_alternativeInterpretations; } /* -text returns the most likely interpretation for a phrase. If there are other * interpretations, -alternativeInterpretations will return an array of them, with * the first being most likely and the last being least likely. */ @property (nonatomic, readonly) NSString *text; @property (nonatomic, readonly) NSArray *alternativeInterpretations; @end @protocol UITextInput @required /* Methods for manipulating text. */ - (NSString *)textInRange:(UITextRange *)range; - (void)replaceRange:(UITextRange *)range withText:(NSString *)text; /* Text may have a selection, either zero-length (a caret) or ranged. Editing operations are * always performed on the text from this selection. nil corresponds to no selection. */ @property (readwrite, copy) UITextRange *selectedTextRange; /* If text can be selected, it can be marked. Marked text represents provisionally * inserted text that has yet to be confirmed by the user. It requires unique visual * treatment in its display. If there is any marked text, the selection, whether a * caret or an extended range, always resides witihin. * * Setting marked text either replaces the existing marked text or, if none is present, * inserts it from the current selection. */ @property (nonatomic, readonly) UITextRange *markedTextRange; // Nil if no marked text. @property (nonatomic, copy) NSDictionary *markedTextStyle; // Describes how the marked text should be drawn. - (void)setMarkedText:(NSString *)markedText selectedRange:(NSRange)selectedRange; // selectedRange is a range within the markedText - (void)unmarkText; /* The end and beginning of the the text document. */ @property (nonatomic, readonly) UITextPosition *beginningOfDocument; @property (nonatomic, readonly) UITextPosition *endOfDocument; /* Methods for creating ranges and positions. */ - (UITextRange *)textRangeFromPosition:(UITextPosition *)fromPosition toPosition:(UITextPosition *)toPosition; - (UITextPosition *)positionFromPosition:(UITextPosition *)position offset:(NSInteger)offset; - (UITextPosition *)positionFromPosition:(UITextPosition *)position inDirection:(UITextLayoutDirection)direction offset:(NSInteger)offset; /* Simple evaluation of positions */ - (NSComparisonResult)comparePosition:(UITextPosition *)position toPosition:(UITextPosition *)other; - (NSInteger)offsetFromPosition:(UITextPosition *)from toPosition:(UITextPosition *)toPosition; /* A system-provied input delegate is assigned when the system is interested in input changes. */ @property (nonatomic, assign) id inputDelegate; /* A tokenizer must be provided to inform the text input system about text units of varying granularity. */ @property (nonatomic, readonly) id tokenizer; /* Layout questions. */ - (UITextPosition *)positionWithinRange:(UITextRange *)range farthestInDirection:(UITextLayoutDirection)direction; - (UITextRange *)characterRangeByExtendingPosition:(UITextPosition *)position inDirection:(UITextLayoutDirection)direction; /* Writing direction */ - (UITextWritingDirection)baseWritingDirectionForPosition:(UITextPosition *)position inDirection:(UITextStorageDirection)direction; - (void)setBaseWritingDirection:(UITextWritingDirection)writingDirection forRange:(UITextRange *)range; /* Geometry used to provide, for example, a correction rect. */ - (CGRect)firstRectForRange:(UITextRange *)range; - (CGRect)caretRectForPosition:(UITextPosition *)position; - (NSArray *)selectionRectsForRange:(UITextRange *)range NS_AVAILABLE_IOS(6_0); // Returns an array of UITextSelectionRects /* Hit testing. */ - (UITextPosition *)closestPositionToPoint:(CGPoint)point; - (UITextPosition *)closestPositionToPoint:(CGPoint)point withinRange:(UITextRange *)range; - (UITextRange *)characterRangeAtPoint:(CGPoint)point; @optional - (BOOL)shouldChangeTextInRange:(UITextRange *)range replacementText:(NSString *)text NS_AVAILABLE_IOS(6_0); // return NO to not change text /* Text styling information can affect, for example, the appearance of a correction rect. */ - (NSDictionary *)textStylingAtPosition:(UITextPosition *)position inDirection:(UITextStorageDirection)direction; /* To be implemented if there is not a one-to-one correspondence between text positions within range and character offsets into the associated string. */ - (UITextPosition *)positionWithinRange:(UITextRange *)range atCharacterOffset:(NSInteger)offset; - (NSInteger)characterOffsetOfPosition:(UITextPosition *)position withinRange:(UITextRange *)range; /* An affiliated view that provides a coordinate system for all geometric values in this protocol. * If unimplmeented, the first view in the responder chain will be selected. */ @property (nonatomic, readonly) UIView *textInputView; /* Selection affinity determines whether, for example, the insertion point appears after the last * character on a line or before the first character on the following line in cases where text * wraps across line boundaries. */ @property (nonatomic) UITextStorageDirection selectionAffinity; /* This is an optional method for clients that wish to support dictation phrase alternatives. If * they do not implement this method, dictation will just insert the most likely interpretation * of what was spoken via -insertText:. * dictationResult is an array of UIDictationPhrases. */ - (void)insertDictationResult:(NSArray *)dictationResult; /* These are optional methods for clients that wish to know when there are pending dictation results. */ - (void)dictationRecordingDidEnd; - (void)dictationRecognitionFailed; /* The following three optional methods are for clients that wish to support a placeholder for * pending dictation results. -insertDictationPlaceholder must return a reference to the * placeholder. This reference will be used to identify the placeholder by the other methods * (there may be more than one placeholder). */ - (id)insertDictationResultPlaceholder; - (CGRect)frameForDictationResultPlaceholder:(id)placeholder; /* willInsertResult will be NO if the recognition failed. */ - (void)removeDictationResultPlaceholder:(id)placeholder willInsertResult:(BOOL)willInsertResult; @end //--------------------------------------------------------------------------------------------------- /* Keys to style dictionaries. */ UIKIT_EXTERN NSString *const UITextInputTextBackgroundColorKey; // Key to a UIColor UIKIT_EXTERN NSString *const UITextInputTextColorKey; // Key to a UIColor UIKIT_EXTERN NSString *const UITextInputTextFontKey; // Key to a UIFont /* To accommodate text entry in documents that contain nested elements, or in which supplying and * evaluating characters at indices is an expensive proposition, a position within a text input * document is represented as an object, not an integer. UITextRange and UITextPosition are abstract * classes provided to be subclassed when adopting UITextInput */ NS_CLASS_AVAILABLE_IOS(3_2) @interface UITextPosition : NSObject @end NS_CLASS_AVAILABLE_IOS(3_2) @interface UITextRange : NSObject @property (nonatomic, readonly, getter=isEmpty) BOOL empty; // Whether the range is zero-length. @property (nonatomic, readonly) UITextPosition *start; @property (nonatomic, readonly) UITextPosition *end; @end /* UITextSelectionRect defines an annotated selection rect used by the system to * offer rich text interaction experience. It also serves as an abstract class * provided to be subclassed when adopting UITextInput */ NS_CLASS_AVAILABLE_IOS(6_0) @interface UITextSelectionRect : NSObject @property (nonatomic, readonly) CGRect rect; @property (nonatomic, readonly) UITextWritingDirection writingDirection; @property (nonatomic, readonly) BOOL containsStart; // Returns YES if the rect contains the start of the selection. @property (nonatomic, readonly) BOOL containsEnd; // Returns YES if the rect contains the end of the selection. @property (nonatomic, readonly) BOOL isVertical; // Returns YES if the rect is for vertically oriented text. @end /* The input delegate must be notified of changes to the selection and text. */ @protocol UITextInputDelegate - (void)selectionWillChange:(id )textInput; - (void)selectionDidChange:(id )textInput; - (void)textWillChange:(id )textInput; - (void)textDidChange:(id )textInput; @end /* A tokenizer allows the text input system to evaluate text units of varying granularity. */ @protocol UITextInputTokenizer @required - (UITextRange *)rangeEnclosingPosition:(UITextPosition *)position withGranularity:(UITextGranularity)granularity inDirection:(UITextDirection)direction; // Returns range of the enclosing text unit of the given granularity, or nil if there is no such enclosing unit. Whether a boundary position is enclosed depends on the given direction, using the same rule as isPosition:withinTextUnit:inDirection: - (BOOL)isPosition:(UITextPosition *)position atBoundary:(UITextGranularity)granularity inDirection:(UITextDirection)direction; // Returns YES only if a position is at a boundary of a text unit of the specified granularity in the particular direction. - (UITextPosition *)positionFromPosition:(UITextPosition *)position toBoundary:(UITextGranularity)granularity inDirection:(UITextDirection)direction; // Returns the next boundary position of a text unit of the given granularity in the given direction, or nil if there is no such position. - (BOOL)isPosition:(UITextPosition *)position withinTextUnit:(UITextGranularity)granularity inDirection:(UITextDirection)direction; // Returns YES if position is within a text unit of the given granularity. If the position is at a boundary, returns YES only if the boundary is part of the text unit in the given direction. @end /* A recommended base implementation of the tokenizer protocol. Subclasses are responsible * for handling directions and granularities affected by layout.*/ NS_CLASS_AVAILABLE_IOS(3_2) @interface UITextInputStringTokenizer : NSObject { @package UIResponder *_textInput; } - (id)initWithTextInput:(UIResponder *)textInput; @end NS_CLASS_AVAILABLE_IOS(4_2) @interface UITextInputMode : NSObject @property (nonatomic, readonly, retain) NSString *primaryLanguage; // The primary language, if any, of the input mode. A BCP 47 language identifier such as en-US + (UITextInputMode *)currentInputMode; // The current input mode. Nil if unset. + (NSArray *)activeInputModes; // The activate input modes. @end UIKIT_EXTERN NSString *const UITextInputCurrentInputModeDidChangeNotification NS_AVAILABLE_IOS(4_2); // // UITextInputTraits.h // UIKit // // Copyright (c) 2006-2012, Apple Inc. All rights reserved. // #import // // UITextAutocapitalizationType // // Controls autocapitalization behavior for a text widget. // Note: Capitalization does not apply in all script systems. In such // cases, these values are ignored by the keyboard/input method implementation. // typedef NS_ENUM(NSInteger, UITextAutocapitalizationType) { UITextAutocapitalizationTypeNone, UITextAutocapitalizationTypeWords, UITextAutocapitalizationTypeSentences, UITextAutocapitalizationTypeAllCharacters, }; // // UITextAutocorrectionType // // Controls keyboard autocorrection behavior for a text widget. // Note: Some input methods do not support inline autocorrection, and // instead use a conversion and/or candidate selection methodology. In such // cases, these values are ignored by the keyboard/input method implementation. // typedef NS_ENUM(NSInteger, UITextAutocorrectionType) { UITextAutocorrectionTypeDefault, UITextAutocorrectionTypeNo, UITextAutocorrectionTypeYes, }; // // UITextSpellCheckingType // // Controls the annotation of misspelled words for a text widget. // Note: Some input methods do not support spell checking. typedef NS_ENUM(NSInteger, UITextSpellCheckingType) { UITextSpellCheckingTypeDefault, UITextSpellCheckingTypeNo, UITextSpellCheckingTypeYes, } NS_ENUM_AVAILABLE_IOS(5_0); // // UIKeyboardType // // Requests that a particular keyboard type be displayed when a text widget // becomes first responder. // Note: Some keyboard/input methods types may not support every variant. // In such cases, the input method will make a best effort to find a close // match to the requested type (e.g. displaying UIKeyboardTypeNumbersAndPunctuation // type if UIKeyboardTypeNumberPad is not supported). // typedef NS_ENUM(NSInteger, UIKeyboardType) { UIKeyboardTypeDefault, // Default type for the current input method. UIKeyboardTypeASCIICapable, // Displays a keyboard which can enter ASCII characters, non-ASCII keyboards remain active UIKeyboardTypeNumbersAndPunctuation, // Numbers and assorted punctuation. UIKeyboardTypeURL, // A type optimized for URL entry (shows . / .com prominently). UIKeyboardTypeNumberPad, // A number pad (0-9). Suitable for PIN entry. UIKeyboardTypePhonePad, // A phone pad (1-9, *, 0, #, with letters under the numbers). UIKeyboardTypeNamePhonePad, // A type optimized for entering a person's name or phone number. UIKeyboardTypeEmailAddress, // A type optimized for multiple email address entry (shows space @ . prominently). #if __IPHONE_4_1 <= __IPHONE_OS_VERSION_MAX_ALLOWED UIKeyboardTypeDecimalPad, // A number pad with a decimal point. #endif #if __IPHONE_5_0 <= __IPHONE_OS_VERSION_MAX_ALLOWED UIKeyboardTypeTwitter, // A type optimized for twitter text entry (easy access to @ #) #endif UIKeyboardTypeAlphabet = UIKeyboardTypeASCIICapable, // Deprecated }; // // UIKeyboardAppearance // // Requests a keyboard appearance be used when a text widget // becomes first responder.. // Note: Some keyboard/input methods types may not support every variant. // In such cases, the input method will make a best effort to find a close // match to the requested type. // typedef NS_ENUM(NSInteger, UIKeyboardAppearance) { UIKeyboardAppearanceDefault, // Default apperance for the current input method. UIKeyboardAppearanceAlert // Appearance suitable for use in "alert" scenarios. }; // // UIReturnKeyType // // Controls the display of the return key. // // Note: This enum is under discussion and may be replaced with a // different implementation. // typedef NS_ENUM(NSInteger, UIReturnKeyType) { UIReturnKeyDefault, UIReturnKeyGo, UIReturnKeyGoogle, UIReturnKeyJoin, UIReturnKeyNext, UIReturnKeyRoute, UIReturnKeySearch, UIReturnKeySend, UIReturnKeyYahoo, UIReturnKeyDone, UIReturnKeyEmergencyCall, }; // // UITextInputTraits // // Controls features of text widgets (or other custom objects that might wish // to respond to keyboard input). // @protocol UITextInputTraits @optional @property(nonatomic) UITextAutocapitalizationType autocapitalizationType; // default is UITextAutocapitalizationTypeSentences @property(nonatomic) UITextAutocorrectionType autocorrectionType; // default is UITextAutocorrectionTypeDefault @property(nonatomic) UITextSpellCheckingType spellCheckingType NS_AVAILABLE_IOS(5_0); // default is UITextSpellCheckingTypeDefault; @property(nonatomic) UIKeyboardType keyboardType; // default is UIKeyboardTypeDefault @property(nonatomic) UIKeyboardAppearance keyboardAppearance; // default is UIKeyboardAppearanceDefault @property(nonatomic) UIReturnKeyType returnKeyType; // default is UIReturnKeyDefault (See note under UIReturnKeyType enum) @property(nonatomic) BOOL enablesReturnKeyAutomatically; // default is NO (when YES, will automatically disable return key when text widget has zero-length contents, and will automatically enable when text widget has non-zero-length contents) @property(nonatomic,getter=isSecureTextEntry) BOOL secureTextEntry; // default is NO @end // // UITextView.h // UIKit // // Copyright (c) 2007-2012, Apple Inc. All rights reserved. // #import #import #import #import #import #import #import @class DOMHTMLElement; @class UIDelayedAction; @class UIEvent, UITouch, UIFont, UIColor; @class UITextInputTraits; @class UITextInteractionAssistant; @class UIWebDocumentView; @class WebCoreFrameBridge; @class WebFrame; @class UITextInteractionAssistant; @class UITextSelectionView; @class UITextView; @protocol UITextViewDelegate @optional - (BOOL)textViewShouldBeginEditing:(UITextView *)textView; - (BOOL)textViewShouldEndEditing:(UITextView *)textView; - (void)textViewDidBeginEditing:(UITextView *)textView; - (void)textViewDidEndEditing:(UITextView *)textView; - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text; - (void)textViewDidChange:(UITextView *)textView; - (void)textViewDidChangeSelection:(UITextView *)textView; @end NS_CLASS_AVAILABLE_IOS(2_0) @interface UITextView : UIScrollView { @package WebFrame *m_frame; DOMHTMLElement *m_body; int m_marginTop; UIDelayedAction *m_selectionTimer; UIDelayedAction *m_longPressAction; BOOL m_editable; BOOL m_editing; BOOL m_becomesEditableWithGestures; BOOL m_reentrancyGuard; BOOL m_readyForScroll; BOOL m_hasExplicitTextAlignment; BOOL m_hasExplicitLineHeight; // Gesture recognition. UITextInteractionAssistant *m_interactionAssistant; // property ivars UIWebDocumentView *m_webView; UIFont *m_font; UIColor *m_textColor; NSTextAlignment m_textAlignment; UIView *m_inputView; UIView *m_inputAccessoryView; CGFloat m_lineHeight; BOOL m_skipScrollContainingView; BOOL m_allowsEditingTextAttributes; BOOL m_usesAttributedText; BOOL m_clearsOnInsertion; } @property(nonatomic,assign) id delegate; @property(nonatomic,copy) NSString *text; @property(nonatomic,retain) UIFont *font; @property(nonatomic,retain) UIColor *textColor; @property(nonatomic) NSTextAlignment textAlignment; // default is NSLeftTextAlignment @property(nonatomic) NSRange selectedRange; @property(nonatomic,getter=isEditable) BOOL editable; @property(nonatomic) UIDataDetectorTypes dataDetectorTypes NS_AVAILABLE_IOS(3_0); @property(nonatomic) BOOL allowsEditingTextAttributes NS_AVAILABLE_IOS(6_0); // defaults to NO @property(nonatomic,copy) NSAttributedString *attributedText NS_AVAILABLE_IOS(6_0); // default is nil @property(nonatomic,copy) NSDictionary *typingAttributes NS_AVAILABLE_IOS(6_0); // automatically resets when the selection changes - (BOOL)hasText; - (void)scrollRangeToVisible:(NSRange)range; // Presented when object becomes first responder. If set to nil, reverts to following responder chain. If // set while first responder, will not take effect until reloadInputViews is called. @property (readwrite, retain) UIView *inputView; @property (readwrite, retain) UIView *inputAccessoryView; @property(nonatomic) BOOL clearsOnInsertion NS_AVAILABLE_IOS(6_0); // defaults to NO. if YES, the selection UI is hidden, and inserting text will replace the contents of the field. changing the selection will automatically set this to NO. @end UIKIT_EXTERN NSString * const UITextViewTextDidBeginEditingNotification; UIKIT_EXTERN NSString * const UITextViewTextDidChangeNotification; UIKIT_EXTERN NSString * const UITextViewTextDidEndEditingNotification; // // UIToolbar.h // UIKit // // Copyright (c) 2006-2012, Apple Inc. All rights reserved. // #import #import #import #import #import #import typedef NS_ENUM(NSInteger, UIToolbarPosition) { UIToolbarPositionAny = 0, UIToolbarPositionBottom = 1, UIToolbarPositionTop = 2, }; @class UIBarButtonItem, UIColor; NS_CLASS_AVAILABLE_IOS(2_0) @interface UIToolbar : UIView { @private id _delegate; NSArray *_items; UIColor *_tintColor; struct { unsigned int barStyle:2; unsigned int mode:2; unsigned int wasEnabled:1; unsigned int downButtonSentAction:1; unsigned int isTranslucent:1; unsigned int forceTopBarAppearance:1; unsigned int autolayoutIsLocked:1; } _toolbarFlags; CFMutableDictionaryRef _groups; NSArray *_buttonItems; NSInteger _currentButtonGroup; NSInteger _pressedTag; CGFloat _extraEdgeInsets; UIView *_backgroundView; id _appearanceStorage; id _currentAlert; } @property(nonatomic) UIBarStyle barStyle; // default is UIBarStyleDefault (blue) @property(nonatomic,copy) NSArray *items; // get/set visible UIBarButtonItem. default is nil. changes not animated. shown in order @property(nonatomic,assign,getter=isTranslucent) BOOL translucent NS_AVAILABLE_IOS(3_0); // Default is NO. Always YES if barStyle is set to UIBarStyleBlackTranslucent - (void)setItems:(NSArray *)items animated:(BOOL)animated; // will fade in or out or reorder and adjust spacing /* Default tintColor is nil. When non-nil, bordered buttons and segmented controls in the toolbar will pick up the same tint unless their tints are independently set. */ @property(nonatomic,retain) UIColor *tintColor UI_APPEARANCE_SELECTOR; /* Use these methods to set and access custom background images for toolbars. Default is nil. When non-nil the image will be used instead of the system image for toolbars in the specified position. For the barMetrics argument, UIBarMetricsDefault is the fallback. DISCUSSION: Interdependence of barStyle, tintColor, backgroundImage. When barStyle or tintColor is set as well as the bar's background image, the bar buttons (unless otherwise customized) will inherit the underlying barStyle or tintColor. */ - (void)setBackgroundImage:(UIImage *)backgroundImage forToolbarPosition:(UIToolbarPosition)topOrBottom barMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; - (UIImage *)backgroundImageForToolbarPosition:(UIToolbarPosition)topOrBottom barMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR; /* Default is nil. When non-nil, a custom shadow image to show instead of the default shadow image. For a custom shadow to be shown, a custom background image must also be set with -setBackgroundImage:forToolbarPosition:barMetrics: (if the default background image is used, the default shadow image will be used). */ - (void)setShadowImage:(UIImage *)shadowImage forToolbarPosition:(UIToolbarPosition)topOrBottom NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR; - (UIImage *)shadowImageForToolbarPosition:(UIToolbarPosition)topOrBottom NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR; @end // // UITouch.h // UIKit // // Copyright (c) 2007-2012, Apple Inc. All rights reserved. // #import #import #import @class UIWindow, UIView; typedef NS_ENUM(NSInteger, UITouchPhase) { UITouchPhaseBegan, // whenever a finger touches the surface. UITouchPhaseMoved, // whenever a finger moves on the surface. UITouchPhaseStationary, // whenever a finger is touching the surface but hasn't moved since the previous event. UITouchPhaseEnded, // whenever a finger leaves the surface. UITouchPhaseCancelled, // whenever a touch doesn't end but we need to stop tracking (e.g. putting device to face) }; NS_CLASS_AVAILABLE_IOS(2_0) @interface UITouch : NSObject @property(nonatomic,readonly) NSTimeInterval timestamp; @property(nonatomic,readonly) UITouchPhase phase; @property(nonatomic,readonly) NSUInteger tapCount; // touch down within a certain point within a certain amount of time @property(nonatomic,readonly,retain) UIWindow *window; @property(nonatomic,readonly,retain) UIView *view; @property(nonatomic,readonly,copy) NSArray *gestureRecognizers NS_AVAILABLE_IOS(3_2); - (CGPoint)locationInView:(UIView *)view; - (CGPoint)previousLocationInView:(UIView *)view; @end // // UIVideoEditorController.h // UIKit // // Copyright (c) 2009-2012, Apple Inc.. All rights reserved. // #import #import #import #import @protocol UIVideoEditorControllerDelegate; NS_CLASS_AVAILABLE_IOS(3_1) @interface UIVideoEditorController : UINavigationController { @private int _previousStatusBarStyle; NSMutableDictionary *_properties; struct { unsigned int visible:1; unsigned int isCleaningUp:1; unsigned int didRevertStatusBar:1; } _flags; } + (BOOL)canEditVideoAtPath:(NSString *)videoPath NS_AVAILABLE_IOS(3_1); @property(nonatomic,assign) id delegate; @property(nonatomic, copy) NSString *videoPath; @property(nonatomic) NSTimeInterval videoMaximumDuration; // default value is 10 minutes. set to 0 to specify no maximum duration. @property(nonatomic) UIImagePickerControllerQualityType videoQuality; // default value is UIImagePickerControllerQualityTypeMedium @end @protocol UIVideoEditorControllerDelegate @optional // The editor does not dismiss itself; the client dismisses it in these callbacks. // The delegate will receive exactly one of the following callbacks, depending whether the user // confirms or cancels or if the operation fails. - (void)videoEditorController:(UIVideoEditorController *)editor didSaveEditedVideoToPath:(NSString *)editedVideoPath; // edited video is saved to a path in app's temporary directory - (void)videoEditorController:(UIVideoEditorController *)editor didFailWithError:(NSError *)error; - (void)videoEditorControllerDidCancel:(UIVideoEditorController *)editor; @end // // UIView.h // UIKit // // Copyright (c) 2005-2012, Apple Inc. All rights reserved. // #import #import #import #import #import #import typedef NS_ENUM(NSInteger, UIViewAnimationCurve) { UIViewAnimationCurveEaseInOut, // slow at beginning and end UIViewAnimationCurveEaseIn, // slow at beginning UIViewAnimationCurveEaseOut, // slow at end UIViewAnimationCurveLinear }; typedef NS_ENUM(NSInteger, UIViewContentMode) { UIViewContentModeScaleToFill, UIViewContentModeScaleAspectFit, // contents scaled to fit with fixed aspect. remainder is transparent UIViewContentModeScaleAspectFill, // contents scaled to fill with fixed aspect. some portion of content may be clipped. UIViewContentModeRedraw, // redraw on bounds change (calls -setNeedsDisplay) UIViewContentModeCenter, // contents remain same size. positioned adjusted. UIViewContentModeTop, UIViewContentModeBottom, UIViewContentModeLeft, UIViewContentModeRight, UIViewContentModeTopLeft, UIViewContentModeTopRight, UIViewContentModeBottomLeft, UIViewContentModeBottomRight, }; typedef NS_ENUM(NSInteger, UIViewAnimationTransition) { UIViewAnimationTransitionNone, UIViewAnimationTransitionFlipFromLeft, UIViewAnimationTransitionFlipFromRight, UIViewAnimationTransitionCurlUp, UIViewAnimationTransitionCurlDown, }; typedef NS_OPTIONS(NSUInteger, UIViewAutoresizing) { UIViewAutoresizingNone = 0, UIViewAutoresizingFlexibleLeftMargin = 1 << 0, UIViewAutoresizingFlexibleWidth = 1 << 1, UIViewAutoresizingFlexibleRightMargin = 1 << 2, UIViewAutoresizingFlexibleTopMargin = 1 << 3, UIViewAutoresizingFlexibleHeight = 1 << 4, UIViewAutoresizingFlexibleBottomMargin = 1 << 5 }; typedef NS_OPTIONS(NSUInteger, UIViewAnimationOptions) { UIViewAnimationOptionLayoutSubviews = 1 << 0, UIViewAnimationOptionAllowUserInteraction = 1 << 1, // turn on user interaction while animating UIViewAnimationOptionBeginFromCurrentState = 1 << 2, // start all views from current value, not initial value UIViewAnimationOptionRepeat = 1 << 3, // repeat animation indefinitely UIViewAnimationOptionAutoreverse = 1 << 4, // if repeat, run animation back and forth UIViewAnimationOptionOverrideInheritedDuration = 1 << 5, // ignore nested duration UIViewAnimationOptionOverrideInheritedCurve = 1 << 6, // ignore nested curve UIViewAnimationOptionAllowAnimatedContent = 1 << 7, // animate contents (applies to transitions only) UIViewAnimationOptionShowHideTransitionViews = 1 << 8, // flip to/from hidden state instead of adding/removing UIViewAnimationOptionCurveEaseInOut = 0 << 16, // default UIViewAnimationOptionCurveEaseIn = 1 << 16, UIViewAnimationOptionCurveEaseOut = 2 << 16, UIViewAnimationOptionCurveLinear = 3 << 16, UIViewAnimationOptionTransitionNone = 0 << 20, // default UIViewAnimationOptionTransitionFlipFromLeft = 1 << 20, UIViewAnimationOptionTransitionFlipFromRight = 2 << 20, UIViewAnimationOptionTransitionCurlUp = 3 << 20, UIViewAnimationOptionTransitionCurlDown = 4 << 20, UIViewAnimationOptionTransitionCrossDissolve = 5 << 20, UIViewAnimationOptionTransitionFlipFromTop = 6 << 20, UIViewAnimationOptionTransitionFlipFromBottom = 7 << 20, } NS_ENUM_AVAILABLE_IOS(4_0); @class UIEvent, UIWindow, UIViewController, UIColor, UIGestureRecognizer, CALayer; NS_CLASS_AVAILABLE_IOS(2_0) @interface UIView : UIResponder { @package CALayer *_layer; id _tapInfo; id _gestureInfo; NSMutableArray *_gestureRecognizers; NSArray *_subviewCache; float _charge; NSInteger _tag; UIViewController *_viewDelegate; NSString *_backgroundColorSystemColorName; struct { unsigned int userInteractionDisabled:1; unsigned int implementsDrawRect:1; unsigned int implementsDidScroll:1; unsigned int implementsMouseTracking:1; unsigned int hasBackgroundColor:1; unsigned int isOpaque:1; unsigned int becomeFirstResponderWhenCapable:1; unsigned int interceptMouseEvent:1; unsigned int deallocating:1; unsigned int debugFlash:1; unsigned int debugSkippedSetNeedsDisplay:1; unsigned int debugScheduledDisplayIsRequired:1; unsigned int isInAWindow:1; unsigned int isAncestorOfFirstResponder:1; unsigned int dontAutoresizeSubviews:1; unsigned int autoresizeMask:6; unsigned int patternBackground:1; unsigned int fixedBackgroundPattern:1; unsigned int dontAnimate:1; unsigned int superLayerIsView:1; unsigned int layerKitPatternDrawing:1; unsigned int multipleTouchEnabled:1; unsigned int exclusiveTouch:1; unsigned int hasViewController:1; unsigned int needsDidAppearOrDisappear:1; unsigned int gesturesEnabled:1; unsigned int deliversTouchesForGesturesToSuperview:1; unsigned int chargeEnabled:1; unsigned int skipsSubviewEnumeration:1; unsigned int needsDisplayOnBoundsChange:1; unsigned int hasTiledLayer:1; unsigned int hasLargeContent:1; unsigned int unused:1; unsigned int traversalMark:1; unsigned int appearanceIsInvalid:1; unsigned int monitorsSubtree:1; unsigned int layoutEngineIsOverridden:1; unsigned int constraintsAreClean:1; unsigned int subviewLayoutConstraintsAreClean:1; unsigned int potentiallyHasDanglyConstraints:1; unsigned int doesNotTranslateAutoresizingMaskIntoConstraints:1; unsigned int autolayoutIsClean:1; unsigned int subviewsAutolayoutIsClean:1; unsigned int layoutFlushingDisabled:1; unsigned int layingOutFromConstraints:1; unsigned int wantsAutolayout:1; unsigned int subviewWantsAutolayout:1; unsigned int isApplyingValuesFromEngine:1; unsigned int isInAutolayout:1; unsigned int isUpdatingAutoresizingConstraints:1; unsigned int isUpdatingConstraints:1; unsigned int stayHiddenAwaitingReuse:1; unsigned int stayHiddenAfterReuse:1; unsigned int skippedLayoutWhileHiddenForReuse:1; } _viewFlags; } + (Class)layerClass; // default is [CALayer class]. Used when creating the underlying layer for the view. - (id)initWithFrame:(CGRect)frame; // default initializer @property(nonatomic,getter=isUserInteractionEnabled) BOOL userInteractionEnabled; // default is YES. if set to NO, user events (touch, keys) are ignored and removed from the event queue. @property(nonatomic) NSInteger tag; // default is 0 @property(nonatomic,readonly,retain) CALayer *layer; // returns view's layer. Will always return a non-nil value. view is layer's delegate @end @interface UIView(UIViewGeometry) // animatable. do not use frame if view is transformed since it will not correctly reflect the actual location of the view. use bounds + center instead. @property(nonatomic) CGRect frame; // use bounds/center and not frame if non-identity transform. if bounds dimension is odd, center may be have fractional part @property(nonatomic) CGRect bounds; // default bounds is zero origin, frame size. animatable @property(nonatomic) CGPoint center; // center is center of frame. animatable @property(nonatomic) CGAffineTransform transform; // default is CGAffineTransformIdentity. animatable @property(nonatomic) CGFloat contentScaleFactor NS_AVAILABLE_IOS(4_0); @property(nonatomic,getter=isMultipleTouchEnabled) BOOL multipleTouchEnabled; // default is NO @property(nonatomic,getter=isExclusiveTouch) BOOL exclusiveTouch; // default is NO - (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event; // recursively calls -pointInside:withEvent:. point is in the receiver's coordinate system - (BOOL)pointInside:(CGPoint)point withEvent:(UIEvent *)event; // default returns YES if point is in bounds - (CGPoint)convertPoint:(CGPoint)point toView:(UIView *)view; - (CGPoint)convertPoint:(CGPoint)point fromView:(UIView *)view; - (CGRect)convertRect:(CGRect)rect toView:(UIView *)view; - (CGRect)convertRect:(CGRect)rect fromView:(UIView *)view; @property(nonatomic) BOOL autoresizesSubviews; // default is YES. if set, subviews are adjusted according to their autoresizingMask if self.bounds changes @property(nonatomic) UIViewAutoresizing autoresizingMask; // simple resize. default is UIViewAutoresizingNone - (CGSize)sizeThatFits:(CGSize)size; // return 'best' size to fit given size. does not actually resize view. Default is return existing view size - (void)sizeToFit; // calls sizeThatFits: with current view bounds and changes bounds size. @end @interface UIView(UIViewHierarchy) @property(nonatomic,readonly) UIView *superview; @property(nonatomic,readonly,copy) NSArray *subviews; @property(nonatomic,readonly) UIWindow *window; - (void)removeFromSuperview; - (void)insertSubview:(UIView *)view atIndex:(NSInteger)index; - (void)exchangeSubviewAtIndex:(NSInteger)index1 withSubviewAtIndex:(NSInteger)index2; - (void)addSubview:(UIView *)view; - (void)insertSubview:(UIView *)view belowSubview:(UIView *)siblingSubview; - (void)insertSubview:(UIView *)view aboveSubview:(UIView *)siblingSubview; - (void)bringSubviewToFront:(UIView *)view; - (void)sendSubviewToBack:(UIView *)view; - (void)didAddSubview:(UIView *)subview; - (void)willRemoveSubview:(UIView *)subview; - (void)willMoveToSuperview:(UIView *)newSuperview; - (void)didMoveToSuperview; - (void)willMoveToWindow:(UIWindow *)newWindow; - (void)didMoveToWindow; - (BOOL)isDescendantOfView:(UIView *)view; // returns YES for self. - (UIView *)viewWithTag:(NSInteger)tag; // recursive search. includes self // Allows you to perform layout before the drawing cycle happens. -layoutIfNeeded forces layout early - (void)setNeedsLayout; - (void)layoutIfNeeded; - (void)layoutSubviews; // override point. called by layoutIfNeeded automatically. As of iOS 6.0, when constraints-based layout is used the base implementation applies the constraints-based layout, otherwise it does nothing. @end @interface UIView(UIViewRendering) - (void)drawRect:(CGRect)rect; - (void)setNeedsDisplay; - (void)setNeedsDisplayInRect:(CGRect)rect; @property(nonatomic) BOOL clipsToBounds; // When YES, content and subviews are clipped to the bounds of the view. Default is NO. @property(nonatomic,copy) UIColor *backgroundColor; // default is nil @property(nonatomic) CGFloat alpha; // animatable. default is 1.0 @property(nonatomic,getter=isOpaque) BOOL opaque; // default is YES. opaque views must fill their entire bounds or the results are undefined. the active CGContext in drawRect: will not have been cleared and may have non-zeroed pixels @property(nonatomic) BOOL clearsContextBeforeDrawing; // default is YES. ignored for opaque views. for non-opaque views causes the active CGContext in drawRect: to be pre-filled with transparent pixels @property(nonatomic,getter=isHidden) BOOL hidden; // default is NO. doesn't check superviews @property(nonatomic) UIViewContentMode contentMode; // default is UIViewContentModeScaleToFill @property(nonatomic) CGRect contentStretch NS_DEPRECATED_IOS(3_0,6_0); // animatable. default is unit rectangle {{0,0} {1,1}}. Now deprecated: please use -[UIImage resizableImageWithCapInsets:] to achieve the same effect. @end @interface UIView(UIViewAnimation) + (void)beginAnimations:(NSString *)animationID context:(void *)context; // additional context info passed to will start/did stop selectors. begin/commit can be nested + (void)commitAnimations; // starts up any animations when the top level animation is commited // no getters. if called outside animation block, these setters have no effect. + (void)setAnimationDelegate:(id)delegate; // default = nil + (void)setAnimationWillStartSelector:(SEL)selector; // default = NULL. -animationWillStart:(NSString *)animationID context:(void *)context + (void)setAnimationDidStopSelector:(SEL)selector; // default = NULL. -animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context + (void)setAnimationDuration:(NSTimeInterval)duration; // default = 0.2 + (void)setAnimationDelay:(NSTimeInterval)delay; // default = 0.0 + (void)setAnimationStartDate:(NSDate *)startDate; // default = now ([NSDate date]) + (void)setAnimationCurve:(UIViewAnimationCurve)curve; // default = UIViewAnimationCurveEaseInOut + (void)setAnimationRepeatCount:(float)repeatCount; // default = 0.0. May be fractional + (void)setAnimationRepeatAutoreverses:(BOOL)repeatAutoreverses; // default = NO. used if repeat count is non-zero + (void)setAnimationBeginsFromCurrentState:(BOOL)fromCurrentState; // default = NO. If YES, the current view position is always used for new animations -- allowing animations to "pile up" on each other. Otherwise, the last end state is used for the animation (the default). + (void)setAnimationTransition:(UIViewAnimationTransition)transition forView:(UIView *)view cache:(BOOL)cache; // current limitation - only one per begin/commit block + (void)setAnimationsEnabled:(BOOL)enabled; // ignore any attribute changes while set. + (BOOL)areAnimationsEnabled; @end @interface UIView(UIViewAnimationWithBlocks) + (void)animateWithDuration:(NSTimeInterval)duration delay:(NSTimeInterval)delay options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion NS_AVAILABLE_IOS(4_0); + (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion NS_AVAILABLE_IOS(4_0); // delay = 0.0, options = 0 + (void)animateWithDuration:(NSTimeInterval)duration animations:(void (^)(void))animations NS_AVAILABLE_IOS(4_0); // delay = 0.0, options = 0, completion = NULL + (void)transitionWithView:(UIView *)view duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion NS_AVAILABLE_IOS(4_0); + (void)transitionFromView:(UIView *)fromView toView:(UIView *)toView duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options completion:(void (^)(BOOL finished))completion NS_AVAILABLE_IOS(4_0); // toView added to fromView.superview, fromView removed from its superview @end @interface UIView (UIViewGestureRecognizers) @property(nonatomic,copy) NSArray *gestureRecognizers NS_AVAILABLE_IOS(3_2); - (void)addGestureRecognizer:(UIGestureRecognizer*)gestureRecognizer NS_AVAILABLE_IOS(3_2); - (void)removeGestureRecognizer:(UIGestureRecognizer*)gestureRecognizer NS_AVAILABLE_IOS(3_2); // called when the recognizer attempts to transition out of UIGestureRecognizerStatePossible if a touch hit-tested to this view will be cancelled as a result of gesture recognition // returns YES by default. return NO to cause the gesture recognizer to transition to UIGestureRecognizerStateFailed // subclasses may override to prevent recognition of particular gestures. for example, UISlider prevents swipes parallel to the slider that start in the thumb - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer NS_AVAILABLE_IOS(6_0); @end // // UIView Constraint-based Layout Support // typedef NS_ENUM(NSInteger, UILayoutConstraintAxis) { UILayoutConstraintAxisHorizontal = 0, UILayoutConstraintAxisVertical = 1 }; // Installing Constraints /* A constraint is typically installed on the closest common ancestor of the views involved in the constraint. It is required that a constraint be installed on _a_ common ancestor of every view involved. The numbers in a constraint are interpreted in the coordinate system of the view it is installed on. A view is considered to be an ancestor of itself. */ @interface UIView (UIConstraintBasedLayoutInstallingConstraints) - (NSArray *)constraints NS_AVAILABLE_IOS(6_0); - (void)addConstraint:(NSLayoutConstraint *)constraint NS_AVAILABLE_IOS(6_0); - (void)addConstraints:(NSArray *)constraints NS_AVAILABLE_IOS(6_0); - (void)removeConstraint:(NSLayoutConstraint *)constraint NS_AVAILABLE_IOS(6_0); - (void)removeConstraints:(NSArray *)constraints NS_AVAILABLE_IOS(6_0); @end // Core Layout Methods /* To render a window, the following passes will occur, if necessary. update constraints layout display Please see the conceptual documentation for a discussion of these methods. */ @interface UIView (UIConstraintBasedLayoutCoreMethods) - (void)updateConstraintsIfNeeded NS_AVAILABLE_IOS(6_0); // Updates the constraints from the bottom up for the view hierarchy rooted at the receiver. UIWindow's implementation creates a layout engine if necessary first. - (void)updateConstraints NS_AVAILABLE_IOS(6_0); // Override this to adjust your special constraints during a constraints update pass - (BOOL)needsUpdateConstraints NS_AVAILABLE_IOS(6_0); - (void)setNeedsUpdateConstraints NS_AVAILABLE_IOS(6_0); @end // Compatibility and Adoption @interface UIView (UIConstraintBasedCompatibility) /* by default, the autoresizing mask on a view gives rise to constraints that fully determine the view's position. Any constraints you set on the view are likely to conflict with autoresizing constraints, so you must turn off this property first. IB will turn it off for you. */ - (BOOL)translatesAutoresizingMaskIntoConstraints NS_AVAILABLE_IOS(6_0); // Default YES - (void)setTranslatesAutoresizingMaskIntoConstraints:(BOOL)flag NS_AVAILABLE_IOS(6_0); /* constraint-based layout engages lazily when someone tries to use it (e.g., adds a constraint to a view). If you do all of your constraint set up in -updateConstraints, you might never even receive updateConstraints if no one makes a constraint. To fix this chicken and egg problem, override this method to return YES if your view needs the window to use constraint-based layout. */ + (BOOL)requiresConstraintBasedLayout NS_AVAILABLE_IOS(6_0); @end // Separation of Concerns @interface UIView (UIConstraintBasedLayoutLayering) /* Constraints do not actually relate the frames of the views, rather they relate the "alignment rects" of views. This is the same as the frame unless overridden by a subclass of UIView. Alignment rects are the same as the "layout rects" shown in Interface Builder 3. Typically the alignment rect of a view is what the end user would think of as the bounding rect around a control, omitting ornamentation like shadows and engraving lines. The edges of the alignment rect are what is interesting to align, not the shadows and such. */ /* These two methods should be inverses of each other. UIKit will call both as part of layout computation. They may be overridden to provide arbitrary transforms between frame and alignment rect, though the two methods must be inverses of each other. However, the default implementation uses -alignmentRectInsets, so just override that if it's applicable. It's easier to get right. A view that displayed an image with some ornament would typically override these, because the ornamental part of an image would scale up with the size of the frame. Set the NSUserDefault UIViewShowAlignmentRects to YES to see alignment rects drawn. */ - (CGRect)alignmentRectForFrame:(CGRect)frame NS_AVAILABLE_IOS(6_0); - (CGRect)frameForAlignmentRect:(CGRect)alignmentRect NS_AVAILABLE_IOS(6_0); /* override this if the alignment rect is obtained from the frame by insetting each edge by a fixed amount. This is only called by alignmentRectForFrame: and frameForAlignmentRect:. */ - (UIEdgeInsets)alignmentRectInsets NS_AVAILABLE_IOS(6_0); /* When you make a constraint on the NSLayoutAttributeBaseline of a view, the system aligns with the bottom of the view returned from this method. A nil return is interpreted as the receiver, and a non-nil return must be in the receiver's subtree. UIView's implementation returns self. */ - (UIView *)viewForBaselineLayout NS_AVAILABLE_IOS(6_0); /* Override this method to tell the layout system that there is something it doesn't natively understand in this view, and this is how large it intrinsically is. A typical example would be a single line text field. The layout system does not understand text - it must just be told that there's something in the view, and that that something will take a certain amount of space if not clipped. In response, UIKit will set up constraints that specify (1) that the opaque content should not be compressed or clipped, (2) that the view prefers to hug tightly to its content. A user of a view may need to specify the priority of these constraints. For example, by default, a push button -strongly wants to hug its content in the vertical direction (buttons really ought to be their natural height) -weakly hugs its content horizontally (extra side padding between the title and the edge of the bezel is acceptable) -strongly resists compressing or clipping content in both directions. However, you might have a case where you'd prefer to show all the available buttons with truncated text rather than losing some of the buttons. The truncation might only happen in portrait orientation but not in landscape, for example. In that case you'd want to setContentCompressionResistancePriority:forAxis: to (say) UILayoutPriorityDefaultLow for the horizontal axis. The default 'strong' and 'weak' priorities referred to above are UILayoutPriorityDefaultHigh and UILayoutPriorityDefaultLow. Note that not all views have an intrinsicContentSize. UIView's default implementation is to return (UIViewNoIntrinsicMetric, UIViewNoIntrinsicMetric). The _intrinsic_ content size is concerned only with data that is in the view itself, not in other views. Remember that you can also set constant width or height constraints on any view, and you don't need to override instrinsicContentSize if these dimensions won't be changing with changing view content. */ UIKIT_EXTERN const CGFloat UIViewNoIntrinsicMetric NS_AVAILABLE_IOS(6_0); // -1 - (CGSize)intrinsicContentSize NS_AVAILABLE_IOS(6_0); - (void)invalidateIntrinsicContentSize NS_AVAILABLE_IOS(6_0); // call this when something changes that affects the intrinsicContentSize. Otherwise UIKit won't notice that it changed. - (UILayoutPriority)contentHuggingPriorityForAxis:(UILayoutConstraintAxis)axis NS_AVAILABLE_IOS(6_0); - (void)setContentHuggingPriority:(UILayoutPriority)priority forAxis:(UILayoutConstraintAxis)axis NS_AVAILABLE_IOS(6_0); - (UILayoutPriority)contentCompressionResistancePriorityForAxis:(UILayoutConstraintAxis)axis NS_AVAILABLE_IOS(6_0); - (void)setContentCompressionResistancePriority:(UILayoutPriority)priority forAxis:(UILayoutConstraintAxis)axis NS_AVAILABLE_IOS(6_0); @end // Size To Fit UIKIT_EXTERN const CGSize UILayoutFittingCompressedSize NS_AVAILABLE_IOS(6_0); UIKIT_EXTERN const CGSize UILayoutFittingExpandedSize NS_AVAILABLE_IOS(6_0); @interface UIView (UIConstraintBasedLayoutFittingSize) /* The size fitting most closely to targetSize in which the receiver's subtree can be laid out while optimally satisfying the constraints. If you want the smallest possible size, pass UILayoutFittingCompressedSize; for the largest possible size, pass UILayoutFittingExpandedSize. Also see the comment for UILayoutPriorityFittingSizeLevel. */ - (CGSize)systemLayoutSizeFittingSize:(CGSize)targetSize NS_AVAILABLE_IOS(6_0); @end // Debugging /* Everything in this section should be used in debugging only, never in shipping code. These methods may not exist in the future - no promises. */ @interface UIView (UIConstraintBasedLayoutDebugging) /* This returns a list of all the constraints that are affecting the current location of the receiver. The constraints do not necessarily involve the receiver, they may affect the frame indirectly. Pass UILayoutConstraintAxisHorizontal for the constraints affecting [self center].x and CGRectGetWidth([self bounds]), and UILayoutConstraintAxisVertical for the constraints affecting[self center].y and CGRectGetHeight([self bounds]). */ - (NSArray *)constraintsAffectingLayoutForAxis:(UILayoutConstraintAxis)axis NS_AVAILABLE_IOS(6_0); /* If there aren't enough constraints in the system to uniquely determine layout, we say the layout is ambiguous. For example, if the only constraint in the system was x = y + 100, then there are lots of different possible values for x and y. This situation is not automatically detected by UIKit, due to performance considerations and details of the algorithm used for layout. The symptom of ambiguity is that views sometimes jump from place to place, or possibly are just in the wrong place. -hasAmbiguousLayout runs a check for whether there is another center and bounds the receiver could have that could also satisfy the constraints. -exerciseAmbiguousLayout does more. It randomly changes the view layout to a different valid layout. Making the UI jump back and forth can be helpful for figuring out where you're missing a constraint. */ - (BOOL)hasAmbiguousLayout NS_AVAILABLE_IOS(6_0); - (void)exerciseAmbiguityInLayout NS_AVAILABLE_IOS(6_0); @end @interface UIView (UIStateRestoration) @property (nonatomic, copy) NSString *restorationIdentifier NS_AVAILABLE_IOS(6_0); - (void) encodeRestorableStateWithCoder:(NSCoder *)coder NS_AVAILABLE_IOS(6_0); - (void) decodeRestorableStateWithCoder:(NSCoder *)coder NS_AVAILABLE_IOS(6_0); @end // // UIViewController.h // UIKit // // Copyright (c) 2007-2012, Apple Inc. All rights reserved. // #import #import #import #import /* UIViewController is a generic controller base class that manages a view. It has methods that are called when a view appears or disappears. Subclasses can override -loadView to create their custom view hierarchy, or specify a nib name to be loaded automatically. This class is also a good place for delegate & datasource methods, and other controller stuff. */ @class UIView; @class UINavigationItem, UIBarButtonItem, UITabBarItem; @class UISearchDisplayController; @class UIPopoverController; @class UIStoryboard, UIStoryboardSegue; typedef NS_ENUM(NSInteger, UIModalTransitionStyle) { UIModalTransitionStyleCoverVertical = 0, UIModalTransitionStyleFlipHorizontal, UIModalTransitionStyleCrossDissolve, #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2 UIModalTransitionStylePartialCurl, #endif }; typedef NS_ENUM(NSInteger, UIModalPresentationStyle) { UIModalPresentationFullScreen = 0, #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_3_2 UIModalPresentationPageSheet, UIModalPresentationFormSheet, UIModalPresentationCurrentContext, #endif }; NS_CLASS_AVAILABLE_IOS(2_0) @interface UIViewController : UIResponder { @package UIView *_view; UITabBarItem *_tabBarItem; UINavigationItem *_navigationItem; NSArray *_toolbarItems; NSString *_title; NSString *_nibName; NSBundle *_nibBundle; UIViewController *_parentViewController; // Nonretained UIViewController *_childModalViewController; UIViewController *_parentModalViewController; // Nonretained UIViewController *_previousRootViewController; // Nonretained UIView *_modalTransitionView; UIResponder *_modalPreservedFirstResponder; UIResponder *_defaultFirstResponder; id _dimmingView; id _dropShadowView; id _currentAction; UIStoryboard *_storyboard; NSArray *_storyboardSegueTemplates; NSDictionary *_externalObjectsTableForViewLoading; NSArray *_topLevelObjectsToKeepAliveFromStoryboard; UIView *_savedHeaderSuperview; UIView *_savedFooterSuperview; UIBarButtonItem *_editButtonItem; UISearchDisplayController *_searchDisplayController; UIModalTransitionStyle _modalTransitionStyle; UIModalPresentationStyle _modalPresentationStyle; UIInterfaceOrientation _lastKnownInterfaceOrientation; UIPopoverController* _popoverController; UIView *_containerViewInSheet; CGSize _contentSizeForViewInPopover; CGSize _formSheetSize; void (^_afterAppearance)(void); NSInteger _explicitAppearanceTransitionLevel; struct { unsigned int appearState:2; unsigned int isEditing:1; unsigned int isPerformingModalTransition:1; unsigned int hidesBottomBarWhenPushed:1; unsigned int autoresizesArchivedViewToFullSize:1; unsigned int viewLoadedFromControllerNib:1; unsigned int isRootViewController:1; unsigned int customizesForPresentationInPopover:1; unsigned int isSuspended:1; unsigned int wasApplicationFrameAtSuspend:1; unsigned int wantsFullScreenLayout:1; unsigned int shouldUseFullScreenLayout:1; unsigned int allowsAutorotation:1; unsigned int searchControllerRetained:1; unsigned int oldModalInPopover:1; unsigned int isModalInPopover:1; unsigned int restoreDeepestFirstResponder:1; unsigned int isInWillRotateCallback:1; unsigned int disallowMixedOrientationPresentations:1; unsigned int isFinishingModalTransition:1; unsigned int definesPresentationContext:1; unsigned int providesPresentationContextTransitionStyle:1; unsigned int containmentSupport:1; unsigned int isSettingAppearState:1; unsigned int isInAnimatedVCTransition:1; unsigned int presentationIsChanging:1; unsigned int isBeingPresented:1; unsigned int containmentIsChanging:1; unsigned int explicitTransitionIsAppearing:1; unsigned int disableAppearanceTransitions:1; unsigned int needsDidMoveCleanup:1; unsigned int suppressesBottomBar:1; unsigned int disableRootPromotion:1; unsigned int interfaceOrientationReentranceGuard:1; unsigned int isExecutingAfterAppearance:1; unsigned int rootResignationNeeded:1; unsigned int shouldSynthesizeSupportedOrientations:1; unsigned int viewConstraintsNeedUpdateOnAppearance:1; } _viewControllerFlags; } /* The designated initializer. If you subclass UIViewController, you must call the super implementation of this method, even if you aren't using a NIB. (As a convenience, the default init method will do this for you, and specify nil for both of this methods arguments.) In the specified NIB, the File's Owner proxy should have its class set to your view controller subclass, with the view outlet connected to the main view. If you invoke this method with a nil nib name, then this class' -loadView method will attempt to load a NIB whose name is the same as your view controller's class. If no such NIB in fact exists then you must either call -setView: before -view is invoked, or override the -loadView method to set up your views programatically. */ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil; @property(nonatomic,retain) UIView *view; // The getter first invokes [self loadView] if the view hasn't been set yet. Subclasses must call super if they override the setter or getter. - (void)loadView; // This is where subclasses should create their custom view hierarchy if they aren't using a nib. Should never be called directly. - (void)viewWillUnload NS_DEPRECATED_IOS(5_0,6_0); - (void)viewDidUnload NS_DEPRECATED_IOS(3_0,6_0); // Called after the view controller's view is released and set to nil. For example, a memory warning which causes the view to be purged. Not invoked as a result of -dealloc. - (void)viewDidLoad; // Called after the view has been loaded. For view controllers created in code, this is after -loadView. For view controllers unarchived from a nib, this is after the view is set. - (BOOL)isViewLoaded NS_AVAILABLE_IOS(3_0); @property(nonatomic, readonly, copy) NSString *nibName; // The name of the nib to be loaded to instantiate the view. @property(nonatomic, readonly, retain) NSBundle *nibBundle; // The bundle from which to load the nib. @property(nonatomic, readonly, retain) UIStoryboard *storyboard NS_AVAILABLE_IOS(5_0); - (void)performSegueWithIdentifier:(NSString *)identifier sender:(id)sender NS_AVAILABLE_IOS(5_0); - (BOOL)shouldPerformSegueWithIdentifier:(NSString *)identifier sender:(id)sender NS_AVAILABLE_IOS(6_0); // Invoked immediately prior to initiating a segue. Return NO to prevent the segue from firing. The default implementation returns YES. This method is not invoked when -performSegueWithIdentifier:sender: is used. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender NS_AVAILABLE_IOS(5_0); // View controllers will receive this message during segue unwinding. The default implementation returns the result of -respondsToSelector: - controllers can override this to perform any ancillary checks, if necessary. - (BOOL)canPerformUnwindSegueAction:(SEL)action fromViewController:(UIViewController *)fromViewController withSender:(id)sender NS_AVAILABLE_IOS(6_0); // Custom containers should override this method and search their children for an action handler (using -canPerformUnwindSegueAction:fromViewController:sender:). If a handler is found, the controller should return it. Otherwise, the result of invoking super's implementation should be returned. - (UIViewController *)viewControllerForUnwindSegueAction:(SEL)action fromViewController:(UIViewController *)fromViewController withSender:(id)sender NS_AVAILABLE_IOS(6_0); // Custom container view controllers should override this method and return segue instances that will perform the navigation portion of segue unwinding. - (UIStoryboardSegue *)segueForUnwindingToViewController:(UIViewController *)toViewController fromViewController:(UIViewController *)fromViewController identifier:(NSString *)identifier NS_AVAILABLE_IOS(6_0); - (void)viewWillAppear:(BOOL)animated; // Called when the view is about to made visible. Default does nothing - (void)viewDidAppear:(BOOL)animated; // Called when the view has been fully transitioned onto the screen. Default does nothing - (void)viewWillDisappear:(BOOL)animated; // Called when the view is dismissed, covered or otherwise hidden. Default does nothing - (void)viewDidDisappear:(BOOL)animated; // Called after the view was dismissed, covered or otherwise hidden. Default does nothing // Called just before the view controller's view's layoutSubviews method is invoked. Subclasses can implement as necessary. The default is a nop. - (void)viewWillLayoutSubviews NS_AVAILABLE_IOS(5_0); // Called just after the view controller's view's layoutSubviews method is invoked. Subclasses can implement as necessary. The default is a nop. - (void)viewDidLayoutSubviews NS_AVAILABLE_IOS(5_0); @property(nonatomic,copy) NSString *title; // Localized title for use by a parent controller. - (void)didReceiveMemoryWarning; // Called when the parent application receives a memory warning. On iOS 6.0 it will no longer clear the view by default. /* If this view controller is a child of a containing view controller (e.g. a navigation controller or tab bar controller,) this is the containing view controller. Note that as of 5.0 this no longer will return the presenting view controller. */ @property(nonatomic,readonly) UIViewController *parentViewController; // This property has been replaced by presentedViewController. @property(nonatomic,readonly) UIViewController *modalViewController NS_DEPRECATED_IOS(2_0, 6_0); // The view controller that was presented by this view controller or its nearest ancestor. @property(nonatomic,readonly) UIViewController *presentedViewController NS_AVAILABLE_IOS(5_0); // The view controller that presented this view controller (or its farthest ancestor.) @property(nonatomic,readonly) UIViewController *presentingViewController NS_AVAILABLE_IOS(5_0); /* Determines which parent view controller's view should be presented over for presentations of type UIModalPresentationCurrentContext. If no ancestor view controller has this flag set, then the presenter will be the root view controller. */ @property(nonatomic,assign) BOOL definesPresentationContext NS_AVAILABLE_IOS(5_0); // A controller that defines the presentation context can also specify the modal transition style if this property is true. @property(nonatomic,assign) BOOL providesPresentationContextTransitionStyle NS_AVAILABLE_IOS(5_0); /* These four methods can be used in a view controller's appearance callbacks to determine if it is being presented, dismissed, or added or removed as a child view controller. For example, a view controller can check if it is disappearing because it was dismissed or popped by asking itself in its viewWillDisappear: method by checking the expression ([self isDismissing] || [self isMovingFromParentViewController]). */ - (BOOL)isBeingPresented NS_AVAILABLE_IOS(5_0); - (BOOL)isBeingDismissed NS_AVAILABLE_IOS(5_0); - (BOOL)isMovingToParentViewController NS_AVAILABLE_IOS(5_0); - (BOOL)isMovingFromParentViewController NS_AVAILABLE_IOS(5_0); /* The next two methods are replacements for presentModalViewController:animated and dismissModalViewControllerAnimated: The completion handler, if provided, will be invoked after the presented controllers viewDidAppear: callback is invoked. */ - (void)presentViewController:(UIViewController *)viewControllerToPresent animated: (BOOL)flag completion:(void (^)(void))completion NS_AVAILABLE_IOS(5_0); // The completion handler, if provided, will be invoked after the dismissed controller's viewDidDisappear: callback is invoked. - (void)dismissViewControllerAnimated: (BOOL)flag completion: (void (^)(void))completion NS_AVAILABLE_IOS(5_0); // Display another view controller as a modal child. Uses a vertical sheet transition if animated.This method has been replaced by presentViewController:animated:completion: - (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated NS_DEPRECATED_IOS(2_0, 6_0); // Dismiss the current modal child. Uses a vertical sheet transition if animated. This method has been replaced by dismissViewControllerAnimated:completion: - (void)dismissModalViewControllerAnimated:(BOOL)animated NS_DEPRECATED_IOS(2_0, 6_0); /* Defines the transition style that will be used for this view controller when it is presented modally. Set this property on the view controller to be presented, not the presenter. Defaults to UIModalTransitionStyleCoverVertical. */ @property(nonatomic,assign) UIModalTransitionStyle modalTransitionStyle NS_AVAILABLE_IOS(3_0); @property(nonatomic,assign) UIModalPresentationStyle modalPresentationStyle NS_AVAILABLE_IOS(3_2); // Presentation modes may keep the keyboard visible when not required. Default implementation affects UIModalPresentationFormSheet visibility. - (BOOL)disablesAutomaticKeyboardDismissal NS_AVAILABLE_IOS(4_3); @property(nonatomic,assign) BOOL wantsFullScreenLayout NS_AVAILABLE_IOS(3_0); @end // To make it more convenient for applications to adopt rotation, a view controller may implement the below methods. Your UIWindow's frame should use [UIScreen mainScreen].bounds as its frame. @interface UIViewController (UIViewControllerRotation) // call this method when your return value from shouldAutorotateToInterfaceOrientation: changes // if the current interface orientation does not match the current device orientation, a rotation may occur provided all relevant view controllers now return YES from shouldAutorotateToInterfaceOrientation: + (void)attemptRotationToDeviceOrientation NS_AVAILABLE_IOS(5_0); // Applications should use supportedInterfaceOrientations and/or shouldAutorotate.. - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation NS_DEPRECATED_IOS(2_0, 6_0); // New Autorotation support. - (BOOL)shouldAutorotate NS_AVAILABLE_IOS(6_0); - (NSUInteger)supportedInterfaceOrientations NS_AVAILABLE_IOS(6_0); // Returns interface orientation masks. - (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation NS_AVAILABLE_IOS(6_0); // The rotating header and footer views will slide out during the rotation and back in once it has completed. - (UIView *)rotatingHeaderView; // Must be in the view hierarchy. Default returns nil. - (UIView *)rotatingFooterView; // Must be in the view hierarchy. Default returns nil. @property(nonatomic,readonly) UIInterfaceOrientation interfaceOrientation; // Notifies when rotation begins, reaches halfway point and ends. - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration; - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation; // Faster one-part variant, called from within a rotating animation block, for additional animations during rotation. // A subclass may override this method, or the two-part variants below, but not both. - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration NS_AVAILABLE_IOS(3_0); // Slower two-part variant, called from within a rotating animation block, for additional animations during rotation. // A subclass may override these methods, or the one-part variant above, but not both. - (void)willAnimateFirstHalfOfRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration NS_DEPRECATED_IOS(2_0, 5_0); - (void)didAnimateFirstHalfOfRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation NS_DEPRECATED_IOS(2_0, 5_0); // The rotating header and footer views are offscreen. - (void)willAnimateSecondHalfOfRotationFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation duration:(NSTimeInterval)duration NS_DEPRECATED_IOS(2_0, 5_0); // A this point, our view orientation is set to the new orientation. @end // Many view controllers have a view that may be in an editing state or not- for example, a UITableView. These view // controllers can track the editing state, and generate an Edit|Done button to be used in a navigation bar. @interface UIViewController (UIViewControllerEditing) @property(nonatomic,getter=isEditing) BOOL editing; - (void)setEditing:(BOOL)editing animated:(BOOL)animated; // Updates the appearance of the Edit|Done button item as necessary. Clients who override it must call super first. - (UIBarButtonItem *)editButtonItem; // Return an Edit|Done button that can be used as a navigation item's custom view. Default action toggles the editing state with animation. @end @interface UIViewController (UISearchDisplayControllerSupport) @property(nonatomic, readonly, retain) UISearchDisplayController *searchDisplayController; @end /* This exception is raised when a child view controller's view is added into the view hierarchy and the first superview of the child view controller's view that has a view controller is NOT the child view controller's parent. */ UIKIT_EXTERN NSString *const UIViewControllerHierarchyInconsistencyException NS_AVAILABLE_IOS(5_0); /* The methods in the UIContainerViewControllerProtectedMethods and the UIContainerViewControllerCallbacks categories typically should only be called by subclasses which are implementing new container view controllers. They may be overridden but must call super. */ @interface UIViewController (UIContainerViewControllerProtectedMethods) // An array of children view controllers. This array does not include any presented view controllers. @property(nonatomic,readonly) NSArray *childViewControllers NS_AVAILABLE_IOS(5_0); /* If the child controller has a different parent controller, it will first be removed from its current parent by calling removeFromParentViewController. If this method is overridden then the super implementation must be called. */ - (void)addChildViewController:(UIViewController *)childController NS_AVAILABLE_IOS(5_0); /* Removes the the receiver from its parent's children controllers array. If this method is overridden then the super implementation must be called. */ - (void) removeFromParentViewController NS_AVAILABLE_IOS(5_0); /* This method can be used to transition between sibling child view controllers. The receiver of this method is their common parent view controller. (Use [UIViewController addChildViewController:] to create the parent/child relationship.) This method will add the toViewController's view to the superview of the fromViewController's view and the fromViewController's view will be removed from its superview after the transition completes. It is important to allow this method to add and remove the views. The arguments to this method are the same as those defined by UIView's block animation API. This method will fail with an NSInvalidArgumentException if the parent view controllers are not the same as the receiver, or if the receiver explicitly forwards its appearance and rotation callbacks to its children. Finally, the receiver should not be a subclass of an iOS container view controller. Note also that it is possible to use the UIView APIs directly. If they are used it is important to ensure that the toViewController's view is added to the visible view hierarchy while the fromViewController's view is removed. */ - (void)transitionFromViewController:(UIViewController *)fromViewController toViewController:(UIViewController *)toViewController duration:(NSTimeInterval)duration options:(UIViewAnimationOptions)options animations:(void (^)(void))animations completion:(void (^)(BOOL finished))completion NS_AVAILABLE_IOS(5_0); // If a custom container controller manually forwards its appearance callbacks, then rather than calling // viewWillAppear:, viewDidAppear: viewWillDisappear:, or viewDidDisappear: on the children these methods // should be used instead. This will ensure that descendent child controllers appearance methods will be // invoked. It also enables more complex custom transitions to be implemented since the appearance callbacks are // now tied to the final matching invocation of endAppearanceTransition. - (void)beginAppearanceTransition:(BOOL)isAppearing animated:(BOOL)animated __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0); - (void)endAppearanceTransition __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0); @end @interface UIViewController (UIContainerViewControllerCallbacks) /* This method is consulted to determine if a view controller manually forwards its containment callbacks to any children view controllers. Subclasses of UIViewController that implement containment logic may override this method. The default implementation returns YES. If it is overridden and returns NO, then the subclass is responsible for forwarding the following methods as appropriate - viewWillAppear: viewDidAppear: viewWillDisappear: viewDidDisappear: willRotateToInterfaceOrientation:duration: willAnimateRotationToInterfaceOrientation:duration: didRotateFromInterfaceOrientation: */ // This soon to be deprecated method - (BOOL)automaticallyForwardAppearanceAndRotationMethodsToChildViewControllers NS_DEPRECATED_IOS(5_0,6_0); // is being replaced by these two methods. - (BOOL)shouldAutomaticallyForwardRotationMethods NS_AVAILABLE_IOS(6_0); - (BOOL)shouldAutomaticallyForwardAppearanceMethods NS_AVAILABLE_IOS(6_0); /* These two methods are public for container subclasses to call when transitioning between child controllers. If they are overridden, the overrides should ensure to call the super. The parent argument in both of these methods is nil when a child is being removed from its parent; otherwise it is equal to the new parent view controller. addChildViewController: will call [child willMoveToParentViewController:self] before adding the child. However, it will not call didMoveToParentViewController:. It is expected that a container view controller subclass will make this call after a transition to the new child has completed or, in the case of no transition, immediately after the call to addChildViewController:. Similarly removeFromParentViewController: does not call [self willMoveToParentViewController:nil] before removing the child. This is also the responsibilty of the container subclass. Container subclasses will typically define a method that transitions to a new child by first calling addChildViewController:, then executing a transition which will add the new child's view into the view hierarchy of its parent, and finally will call didMoveToParentViewController:. Similarly, subclasses will typically define a method that removes a child in the reverse manner by first calling [child willMoveToParentViewController:nil]. */ - (void)willMoveToParentViewController:(UIViewController *)parent NS_AVAILABLE_IOS(5_0); - (void)didMoveToParentViewController:(UIViewController *)parent NS_AVAILABLE_IOS(5_0); @end @interface UIViewController (UIStateRestoration) @property (nonatomic, copy) NSString *restorationIdentifier NS_AVAILABLE_IOS(6_0); @property (nonatomic, readwrite, assign) Class restorationClass NS_AVAILABLE_IOS(6_0); - (void) encodeRestorableStateWithCoder:(NSCoder *)coder NS_AVAILABLE_IOS(6_0); - (void) decodeRestorableStateWithCoder:(NSCoder *)coder NS_AVAILABLE_IOS(6_0); @end @interface UIViewController (UIConstraintBasedLayoutCoreMethods) /* Base implementation sends -updateConstraints to the view. When a view has a view controller, this message is sent to the view controller during the autolayout updateConstraints pass in lieu of sending updateConstraints directly to the view. You may override this method in a UIViewController subclass for updating custom constraints instead of subclassing your view and overriding -[UIView updateConstraints]. Overrides must call super or send -updateConstraints to the view. */ - (void)updateViewConstraints NS_AVAILABLE_IOS(6_0); @end // // UIWebView.h // UIKit // // Copyright (c) 2007-2012, Apple Inc. All rights reserved. // #import #import #import #import #import typedef NS_ENUM(NSInteger, UIWebViewNavigationType) { UIWebViewNavigationTypeLinkClicked, UIWebViewNavigationTypeFormSubmitted, UIWebViewNavigationTypeBackForward, UIWebViewNavigationTypeReload, UIWebViewNavigationTypeFormResubmitted, UIWebViewNavigationTypeOther }; @class UIWebViewInternal; @protocol UIWebViewDelegate; NS_CLASS_AVAILABLE_IOS(2_0) @interface UIWebView : UIView { @private UIWebViewInternal *_internal; } @property(nonatomic,assign) id delegate; @property(nonatomic,readonly,retain) UIScrollView *scrollView NS_AVAILABLE_IOS(5_0); - (void)loadRequest:(NSURLRequest *)request; - (void)loadHTMLString:(NSString *)string baseURL:(NSURL *)baseURL; - (void)loadData:(NSData *)data MIMEType:(NSString *)MIMEType textEncodingName:(NSString *)textEncodingName baseURL:(NSURL *)baseURL; @property(nonatomic,readonly,retain) NSURLRequest *request; - (void)reload; - (void)stopLoading; - (void)goBack; - (void)goForward; @property(nonatomic,readonly,getter=canGoBack) BOOL canGoBack; @property(nonatomic,readonly,getter=canGoForward) BOOL canGoForward; @property(nonatomic,readonly,getter=isLoading) BOOL loading; - (NSString *)stringByEvaluatingJavaScriptFromString:(NSString *)script; @property(nonatomic) BOOL scalesPageToFit; @property(nonatomic) BOOL detectsPhoneNumbers NS_DEPRECATED_IOS(2_0, 3_0); @property(nonatomic) UIDataDetectorTypes dataDetectorTypes NS_AVAILABLE_IOS(3_0); @property (nonatomic) BOOL allowsInlineMediaPlayback NS_AVAILABLE_IOS(4_0); // iPhone Safari defaults to NO. iPad Safari defaults to YES @property (nonatomic) BOOL mediaPlaybackRequiresUserAction NS_AVAILABLE_IOS(4_0); // iPhone and iPad Safari both default to YES @property (nonatomic) BOOL mediaPlaybackAllowsAirPlay NS_AVAILABLE_IOS(5_0); // iPhone and iPad Safari both default to YES @property (nonatomic) BOOL suppressesIncrementalRendering NS_AVAILABLE_IOS(6_0); // iPhone and iPad Safari both default to NO @property (nonatomic) BOOL keyboardDisplayRequiresUserAction NS_AVAILABLE_IOS(6_0); // default is YES @end @protocol UIWebViewDelegate @optional - (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType; - (void)webViewDidStartLoad:(UIWebView *)webView; - (void)webViewDidFinishLoad:(UIWebView *)webView; - (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error; @end // // UIWindow.h // UIKit // // Copyright (c) 2005-2012, Apple Inc. All rights reserved. // #import #import #import #import #import typedef CGFloat UIWindowLevel; @class UIEvent, UIScreen, NSUndoManager, UIViewController; NS_CLASS_AVAILABLE_IOS(2_0) @interface UIWindow : UIView { @package id _delegate; CGFloat _windowLevel; CGFloat _windowSublevel; id _layerContext; UIView *_lastMouseDownView; UIView *_lastMouseEnteredView; UIResponder *_firstResponder; id _fingerInfo; id _touchData; UIInterfaceOrientation _viewOrientation; UIView *_exclusiveTouchView; NSUndoManager *_undoManager; UIScreen *_screen; CALayer *_transformLayer; NSMutableArray *_rotationViewControllers; UIViewController *_rootViewController; UIColor *_savedBackgroundColor; NSMutableSet *_subtreeMonitoringViews; NSMutableSet *_tintViews; id _currentTintView; struct { unsigned int delegateWillRotate:1; unsigned int delegateDidRotate:1; unsigned int delegateWillAnimateFirstHalf:1; unsigned int delegateDidAnimationFirstHalf:1; unsigned int delegateWillAnimateSecondHalf:1; unsigned int autorotatesToPortrait:1; unsigned int autorotatesToPortraitUpsideDown:1; unsigned int autorotatesToLandscapeLeft:1; unsigned int autorotatesToLandscapeRight:1; unsigned int dontBecomeKeyOnOrderFront:1; unsigned int output:1; unsigned int inGesture:1; unsigned int bitsPerComponent:4; unsigned int autorotates:1; unsigned int isRotating:1; unsigned int isUsingOnePartRotationAnimation:1; unsigned int isHandlingContentRotation:1; unsigned int disableAutorotationCount:4; unsigned int needsAutorotationWhenReenabled:1; unsigned int forceTwoPartRotationAnimation:1; unsigned int orderKeyboardInAfterRotating:1; unsigned int roundedCorners:4; unsigned int resizesToFullScreen:1; unsigned int keepContextInBackground:1; unsigned int ignoreSetHidden:1; unsigned int forceVisibleOnInit:1; unsigned int settingFirstResponder:1; unsigned int legacyOrientationChecks:1; unsigned int windowResizedToFullScreen:1; } _windowFlags; id _windowController; } @property(nonatomic,retain) UIScreen *screen NS_AVAILABLE_IOS(3_2); // default is [UIScreen mainScreen]. changing the screen may be an expensive operation and should not be done in performance-sensitive code @property(nonatomic) UIWindowLevel windowLevel; // default = 0.0 @property(nonatomic,readonly,getter=isKeyWindow) BOOL keyWindow; - (void)becomeKeyWindow; // override point for subclass. Do not call directly - (void)resignKeyWindow; // override point for subclass. Do not call directly - (void)makeKeyWindow; - (void)makeKeyAndVisible; // convenience. most apps call this to show the main window and also make it key. otherwise use view hidden property @property(nonatomic,retain) UIViewController *rootViewController NS_AVAILABLE_IOS(4_0); // default is nil - (void)sendEvent:(UIEvent *)event; // called by UIApplication to dispatch events to views inside the window - (CGPoint)convertPoint:(CGPoint)point toWindow:(UIWindow *)window; // can be used to convert to another window - (CGPoint)convertPoint:(CGPoint)point fromWindow:(UIWindow *)window; // pass in nil to mean screen - (CGRect)convertRect:(CGRect)rect toWindow:(UIWindow *)window; - (CGRect)convertRect:(CGRect)rect fromWindow:(UIWindow *)window; @end UIKIT_EXTERN const UIWindowLevel UIWindowLevelNormal; UIKIT_EXTERN const UIWindowLevel UIWindowLevelAlert; UIKIT_EXTERN const UIWindowLevel UIWindowLevelStatusBar; UIKIT_EXTERN NSString *const UIWindowDidBecomeVisibleNotification; // nil UIKIT_EXTERN NSString *const UIWindowDidBecomeHiddenNotification; // nil UIKIT_EXTERN NSString *const UIWindowDidBecomeKeyNotification; // nil UIKIT_EXTERN NSString *const UIWindowDidResignKeyNotification; // nil // Each notification includes a nil object and a userInfo dictionary containing the // begining and ending keyboard frame in screen coordinates. Use the various UIView and // UIWindow convertRect facilities to get the frame in the desired coordinate system. // Animation key/value pairs are only available for the "will" family of notification. UIKIT_EXTERN NSString *const UIKeyboardWillShowNotification; UIKIT_EXTERN NSString *const UIKeyboardDidShowNotification; UIKIT_EXTERN NSString *const UIKeyboardWillHideNotification; UIKIT_EXTERN NSString *const UIKeyboardDidHideNotification; UIKIT_EXTERN NSString *const UIKeyboardFrameBeginUserInfoKey NS_AVAILABLE_IOS(3_2); // NSValue of CGRect UIKIT_EXTERN NSString *const UIKeyboardFrameEndUserInfoKey NS_AVAILABLE_IOS(3_2); // NSValue of CGRect UIKIT_EXTERN NSString *const UIKeyboardAnimationDurationUserInfoKey NS_AVAILABLE_IOS(3_0); // NSNumber of double UIKIT_EXTERN NSString *const UIKeyboardAnimationCurveUserInfoKey NS_AVAILABLE_IOS(3_0); // NSNumber of NSUInteger (UIViewAnimationCurve) // Like the standard keyboard notifications above, these additional notifications include // a nil object and begin/end frames of the keyboard in screen coordinates in the userInfo dictionary. UIKIT_EXTERN NSString *const UIKeyboardWillChangeFrameNotification NS_AVAILABLE_IOS(5_0); UIKIT_EXTERN NSString *const UIKeyboardDidChangeFrameNotification NS_AVAILABLE_IOS(5_0); // These keys are superseded by UIKeyboardFrameBeginUserInfoKey and UIKeyboardFrameEndUserInfoKey. UIKIT_EXTERN NSString *const UIKeyboardCenterBeginUserInfoKey NS_DEPRECATED_IOS(2_0, 3_2); UIKIT_EXTERN NSString *const UIKeyboardCenterEndUserInfoKey NS_DEPRECATED_IOS(2_0, 3_2); UIKIT_EXTERN NSString *const UIKeyboardBoundsUserInfoKey NS_DEPRECATED_IOS(2_0, 3_2);