青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品

逛奔的蝸牛

我不聰明,但我會很努力

   ::  :: 新隨筆 ::  ::  :: 管理 ::
Adopted Protocols
NSCoding例子
- (id)initWithCoder:(NSCoder *)coder {
    if (self = [super init]) {
        [self setName:[coder decodeObject]];
        [self setPrice:[coder decodeObject]];
    }

    return self;
}

- (void)encodeWithCoder:(NSCoder *)coder {
    [coder encodeObject:name]; // 注意與decodeObject的順序一致
    [coder encodeObject:price];
}

arrayWithArray:

Creates and returns an array containing the objects in another given array.

+ (id)arrayWithArray:(NSArray *)anArray
Parameters
anArray

An array.

Return Value

An array containing the objects in anArray.


arrayWithContentsOfFile:

Creates and returns an array containing the contents of the file specified by a given path.

+ (id)arrayWithContentsOfFile:(NSString *)aPath
Parameters
aPath

The path to a file containing a string representation of an array produced by the writeToFile:atomically: method.

Return Value

An array containing the contents of the file specified by aPath. Returns nil if the file can’t be opened or if the contents of the file can’t be parsed into an array.

Discussion

The array representation in the file identified by aPath must contain only property list objects (NSStringNSDataNSDateNSNumberNSArray, or NSDictionary objects). For more details, see Property List Programming Guide. The objects contained by this array are immutable, even if the array is mutable.

arrayWithContentsOfURL:

arrayWithObjects:

Creates and returns an array containing the objects in the argument list.

+ (id)arrayWithObjects:(id)firstObj, ...
Parameters
firstObj, ...

A comma-separated list of objects ending with nil. // 要以nil結尾

Return Value

An array containing the objects in the argument list.

Discussion

This code example creates an array containing three different types of element:

NSArray *myArray;
NSDate *aDate = [NSDate distantFuture];
NSValue *aValue = [NSNumber numberWithInt:5];
NSString *aString = @"a string";
 
myArray = [NSArray arrayWithObjects:aDate, aValue, aString, nil];

arrayWithObjects:count:

Creates and returns an array that includes a given number of objects from a given C array.

+ (id)arrayWithObjects:(const id *)objects count:(NSUInteger)count
Parameters
objects

A C array of objects.

count

The number of values from the objects C array to include in the new array. This number will be the count of the new array—it must not be negative or greater than the number of elements in objects.

Return Value

A new array including the first count objects from objects.

Discussion

Elements are added to the new array in the same order they appear in objects, up to but not including index count. For example:

NSString *strings[3];
strings[0] = @"First";
strings[1] = @"Second";
strings[2] = @"Third";
 
NSArray *stringsArray = [NSArray arrayWithObjects:strings count:2];
// strings array contains { @"First", @"Second" }

arrayByAddingObject:

Returns a new array that is a copy of the receiving array with a given object added to the end.

- (NSArray *)arrayByAddingObject:(id)anObject
Parameters
anObject

An object.

Return Value

A new array that is a copy of the receiving array with anObject added to the end.

Discussion

If anObject is nil, an NSInvalidArgumentException is raised.


arrayByAddingObjectsFromArray:

Returns a new array that is a copy of the receiving array with the objects contained in another array added to the end.

- (NSArray *)arrayByAddingObjectsFromArray:(NSArray *)otherArray
Parameters
otherArray

An array.

Return Value

A new array that is a copy of the receiving array with the objects contained in otherArray added to the end.

See Also


componentsJoinedByString:

Constructs and returns an NSString object that is the result of interposing a given separator between the elements of the array.

- (NSString *)componentsJoinedByString:(NSString *)separator
Parameters
separator

The string to interpose between the elements of the array.

Return Value

An NSString object that is the result of interposing separator between the elements of the array. If the array has no elements, returns an NSString object representing an empty string.

Discussion

For example, this code excerpt writes "here be dragons" to the console:

NSArray *pathArray = [NSArray arrayWithObjects:@"here", @"be", @"dragons", nil];
NSLog(@"%@",[pathArray componentsJoinedByString:@" "]);
Special Considerations

Each element in the array must handle description.


containsObject:

Returns a Boolean value that indicates whether a given object is present in the array.

- (BOOL)containsObject:(id)anObject
Parameters
anObject

An object.

Return Value

YES if anObject is present in the array, otherwise NO.

Discussion

This method determines whether anObject is present in the array by sending an isEqual: message to each of the array’s objects (and passing anObject as the parameter to eachisEqual: message).


count

Returns the number of objects currently in the array.

- (NSUInteger)count
Return Value

The number of objects currently in the array. nil不計算在內


NSEnumerationOptions

Options for Block enumeration operations.

enum {   NSEnumerationConcurrent = (1UL << 0),   NSEnumerationReverse = (1UL << 1),};typedef NSUInteger NSEnumerationOptions;
Constants
NSEnumerationConcurrent

Specifies that the Block enumeration should be concurrent.

The order of invocation is nondeterministic and undefined; this flag is a hint and may be ignored by the implementation under some circumstances; the code of the Block must be safe against concurrent invocation.

Available in Mac OS X v10.6 and later.

Declared in NSObjCRuntime.h.

NSEnumerationReverse

Specifies that the enumeration should be performed in reverse.

This option is available for NSArray and NSIndexSet classes; its behavior is undefined for NSDictionary and NSSet classes, or when combined with theNSEnumerationConcurrent flag.

Available in Mac OS X v10.6 and later.

Declared in NSObjCRuntime.h.

Declared In
NSObjCRuntime.h

enumerateObjectsWithOptions:usingBlock:

Executes a given block using each object in the array.

- (void)enumerateObjectsWithOptions:(NSEnumerationOptions)opts usingBlock:(void (^)(id obj, NSUInteger idx, BOOL *stop))block
Parameters
opts

A bitmask that specifies the options for the enumeration (whether it should be performed concurrently and whether it should be performed in reverse order).

block

The block to apply to elements in the array.

The block takes three arguments:

obj

The element in the array.

idx

The index of the element in the array.

stop

A reference to a Boolean value. The block can set the value to YES to stop further processing of the array. The stop argument is an out-only argument. You should only ever set this Boolean to YES within the Block.

Discussion

By default, the enumeration starts with the first object and continues serially through the array to the last object. You can specify NSEnumerationConcurrent and/orNSEnumerationReverse as enumeration options to modify this behavior.

Important: If the Block parameter is nil this method will raise an exception.


filteredArrayUsingPredicate:

Evaluates a given predicate against each object in the receiving array and returns a new array containing the objects for which the predicate returns true.

- (NSArray *)filteredArrayUsingPredicate:(NSPredicate *)predicate
Parameters
predicate

The predicate against which to evaluate the receiving array’s elements.

Return Value

A new array containing the objects in the receiving array for which predicate returns true.


getObjects:range:

Copies the objects contained in the array that fall within the specified range to aBuffer.

- (void)getObjects:(id *)aBuffer range:(NSRange)aRange
Parameters
aBuffer

A C array of objects of size at least the length of the range specified by aRange.

aRange

A range within the bounds of the array.

If the location plus the length of the range is greater than the count of the array, this method raises an NSRangeException.

Discussion

The method copies into aBuffer the objects in the array in the range specified by aRange; the size of the buffer must therefore be at least the length of the range multiplied by the size of an object reference, as shown in the following example (this is solely for illustration—you should typically not create a buffer simply to iterate over the contents of an array):

NSArray *mArray = // an array with at least six elements...;
id *objects;
 
NSRange range = NSMakeRange(2, 4);
objects = malloc(sizeof(id) * range.length);
 
[mArray getObjects:objects range:range];
 
for (i = 0; i < range.length; i++) {
    NSLog(@"objects: %@", objects[i]);
}
free(objects);

indexOfObject:

Returns the lowest index whose corresponding array value is equal to a given object.

- (NSUInteger)indexOfObject:(id)anObject
Parameters
anObject

An object.

Return Value

The lowest index whose corresponding array value is equal to anObject. If none of the objects in the array is equal to anObject, returns NSNotFound.

Discussion

Starting at index 0, each element of the array is sent an isEqual: message until a match is found or the end of the array is reached. This method passes the anObject parameter to each isEqual: message. Objects are considered equal if isEqual: (declared in the NSObject protocol) returns YES.

NSNotFound

Defines a value that indicates that an item requested couldn’t be found or doesn’t exist.

enum {   NSNotFound = NSIntegerMax};
Constants
NSNotFound

A value that indicates that an item requested couldn’t be found or doesn’t exist.

Available in Mac OS X v10.0 and later.

Declared in NSObjCRuntime.h.

Discussion

NSNotFound is typically used by various methods and functions that search for items in serial data and return indices, such as characters in a string object or ids in an NSArrayobject.

Special Considerations

Prior to Mac OS X v10.5, NSNotFound was defined as 0x7fffffff. For 32-bit systems, this was effectively the same as NSIntegerMax. To support 64-bit environments,NSNotFound is now formally defined as NSIntegerMax. This means, however, that the value is different in 32-bit and 64-bit environments. You should therefore not save the value directly in files or archives. Moreover, sending the value between 32-bit and 64-bit processes via Distributed Objects will not get you NSNotFound on the other side. This applies to any Cocoa methods invoked over Distributed Objects and which might return NSNotFound, such as the indexOfObject: method of NSArray (if sent to a proxy for an array).

NSRange

A structure used to describe a portion of a series—such as characters in a string or objects in an NSArray object.

typedef struct _NSRange {      NSUInteger location;      NSUInteger length;} NSRange;
Fields
location

The start index (0 is the first, as in C arrays).

length

The number of items in the range (can be 0).

makeObjectsPerformSelector:

Sends to each object in the array the message identified by a given selector, starting with the first object and continuing through the array to the last object.

- (void)makeObjectsPerformSelector:(SEL)aSelector
Parameters
aSelector

A selector that identifies the message to send to the objects in the array. The method must not take any arguments, and must not have the side effect of modifying the receiving array.


objectAtIndex:

Returns the object located at index.

- (id)objectAtIndex:(NSUInteger)index
Parameters
index

An index within the bounds of the array.

Return Value

The object located at index.

Discussion

If index is beyond the end of the array (that is, if index is greater than or equal to the value returned by count), an NSRangeException is raised.

objectEnumerator

Returns an enumerator object that lets you access each object in the array.

- (NSEnumerator *)objectEnumerator
Return Value

An enumerator object that lets you access each object in the array, in order, from the element at the lowest index upwards.

Discussion

Returns an enumerator object that lets you access each object in the array, in order, starting with the element at index 0, as in:

NSEnumerator *enumerator = [myArray objectEnumerator];
id anObject;
 
while (anObject = [enumerator nextObject]) {
    /* code to act on each element as it is returned */
}
Special Considerations

When you use this method with mutable subclasses of NSArray, you must not modify the array during enumeration.

It is more efficient to use the fast enumeration protocol (see NSFastEnumeration). Fast enumeration is available on Mac OS X v10.5 and later and iOS 2.0 and later.

pathsMatchingExtensions:

Returns an array containing all the pathname elements in the receiving array that have filename extensions from a given array.

- (NSArray *)pathsMatchingExtensions:(NSArray *)filterTypes
Parameters
filterTypes

An array of NSString objects containing filename extensions. The extensions should not include the dot (“.”) character.

Return Value

An array containing all the pathname elements in the receiving array that have filename extensions from the filterTypes array.

setValue:forKey:

Invokes setValue:forKey: on each of the array's items using the specified value and key.

- (void)setValue:(id)value forKey:(NSString *)key
Parameters
value

The object value.

key

The key to store the value.

sortedArrayUsingComparator:

Returns an array that lists the receiving array’s elements in ascending order, as determined by the comparison method specified by a given NSComparator Block.

- (NSArray *)sortedArrayUsingComparator:(NSComparator)cmptr
Parameters
cmptr

A comparator block.

Return Value

An array that lists the receiving array’s elements in ascending order, as determined by the comparison method specified cmptr.

NSComparator

Defines the signature for a block object used for comparison operations.

typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
Discussion

The arguments to the block are two objects to compare. The block returns an NSComparisonResult value to denote the ordering of the two objects.

You use NSComparator blocks in comparison operations such as NSArray’s sortedArrayUsingComparator:, for example:

NSArray *sortedArray = [array sortedArrayUsingComparator: ^(id obj1, id obj2) {
 
    if ([obj1 integerValue] > [obj2 integerValue]) {
        return (NSComparisonResult)NSOrderedDescending;
    }
 
    if ([obj1 integerValue] < [obj2 integerValue]) {
        return (NSComparisonResult)NSOrderedAscending;
    }
    return (NSComparisonResult)NSOrderedSame;
}];

NSComparisonResult

These constants are used to indicate how items in a request are ordered.

enum {   NSOrderedAscending = -1,   NSOrderedSame,   NSOrderedDescending};typedef NSInteger NSComparisonResult;
Constants
NSOrderedAscending

The left operand is smaller than the right operand.

Available in Mac OS X v10.0 and later.

Declared in NSObjCRuntime.h.

NSOrderedSame

The two operands are equal.

Available in Mac OS X v10.0 and later.

Declared in NSObjCRuntime.h.

NSOrderedDescending

The left operand is greater than the right operand.

Available in Mac OS X v10.0 and later.

Declared in NSObjCRuntime.h.

sortedArrayUsingSelector:

Returns an array that lists the receiving array’s elements in ascending order, as determined by the comparison method specified by a given selector.

- (NSArray *)sortedArrayUsingSelector:(SEL)comparator
Parameters
comparator

A selector that identifies the method to use to compare two elements at a time. The method should return NSOrderedAscending if the receiving array is smaller than the argument, NSOrderedDescending if the receiving array is larger than the argument, and NSOrderedSame if they are equal.

Return Value

An array that lists the receiving array’s elements in ascending order, as determined by the comparison method specified by the selector comparator.

Discussion

The new array contains references to the receiving array’s elements, not copies of them.

The comparator message is sent to each object in the array and has as its single argument another object in the array.

For example, an array of NSString objects can be sorted by using the caseInsensitiveCompare: method declared in the NSString class. Assuming anArray exists, a sorted version of the array can be created in this way:

     NSArray *sortedArray =
         [anArray sortedArrayUsingSelector:@selector(caseInsensitiveCompare:)];

subarrayWithRange:

Returns a new array containing the receiving array’s elements that fall within the limits specified by a given range.

- (NSArray *)subarrayWithRange:(NSRange)range
Parameters
range

A range within the receiving array’s range of elements.

Return Value

A new array containing the receiving array’s elements that fall within the limits specified by range.

Discussion

If range isn’t within the receiving array’s range of elements, an NSRangeException is raised.

For example, the following code example creates an array containing the elements found in the first half of wholeArray (assuming wholeArray exists).

NSArray *halfArray;
NSRange theRange;
 
theRange.location = 0;
theRange.length = [wholeArray count] / 2;
 
halfArray = [wholeArray subarrayWithRange:theRange];

subarrayWithRange:

Returns a new array containing the receiving array’s elements that fall within the limits specified by a given range.

- (NSArray *)subarrayWithRange:(NSRange)range
Parameters
range

A range within the receiving array’s range of elements.

Return Value

A new array containing the receiving array’s elements that fall within the limits specified by range.

Discussion

If range isn’t within the receiving array’s range of elements, an NSRangeException is raised.

For example, the following code example creates an array containing the elements found in the first half of wholeArray (assuming wholeArray exists).

NSArray *halfArray;
NSRange theRange;
 
theRange.location = 0;
theRange.length = [wholeArray count] / 2;
 
halfArray = [wholeArray subarrayWithRange:theRange];

writeToFile:atomically:

Writes the contents of the array to a file at a given path.

- (BOOL)writeToFile:(NSString *)path atomically:(BOOL)flag
Parameters
path

The path at which to write the contents of the array.

If path contains a tilde (~) character, you must expand it with stringByExpandingTildeInPath before invoking this method.

flag

If YES, the array is written to an auxiliary file, and then the auxiliary file is renamed to path. If NO, the array is written directly to path. The YES option guarantees that path, if it exists at all, won’t be corrupted even if the system should crash during writing.

Return Value

YES if the file is written successfully, otherwise NO.

Discussion

If the array’s contents are all property list objects (NSStringNSDataNSArray, or NSDictionary objects), the file written by this method can be used to initialize a new array with the class method arrayWithContentsOfFile: or the instance method initWithContentsOfFile:. This method recursively validates that all the contained objects are property list objects before writing out the file, and returns NO if all the objects are not property list objects, since the resultant file would not be a valid property list.

@import url(http://www.shnenglu.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
posted on 2011-12-02 00:13 逛奔的蝸牛 閱讀(1455) 評論(0)  編輯 收藏 引用 所屬分類: Cocoa
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            亚洲激情二区| 国产亚洲精品7777| 欧美精品一区二区精品网| 欧美成人免费全部观看天天性色| 久久综合久久久久88| 老鸭窝毛片一区二区三区| 欧美成人蜜桃| 欧美日韩在线一区二区三区| 欧美视频亚洲视频| 国产精品专区一| 韩国美女久久| 亚洲精品少妇网址| 亚洲一区二区三区精品视频| 午夜国产精品影院在线观看 | 国产精品青草久久| 欧美色欧美亚洲另类二区 | 亚洲人午夜精品| 亚洲精品久久久久久久久久久久久| 亚洲人成小说网站色在线| 亚洲乱码国产乱码精品精98午夜 | 蜜臀av性久久久久蜜臀aⅴ四虎 | 亚洲国产一区视频| 亚洲视频导航| 久久国产精品99国产精| 女女同性女同一区二区三区91| 亚洲国产精品嫩草影院| 一本色道久久加勒比88综合| 午夜精品久久久久久久| 可以看av的网站久久看| 欧美日韩精品一区二区| 国产欧美一区二区精品仙草咪| 悠悠资源网亚洲青| 亚洲天堂免费观看| 狂野欧美性猛交xxxx巴西| 91久久香蕉国产日韩欧美9色| 宅男精品导航| 老司机免费视频一区二区三区| 欧美午夜大胆人体| 一区精品在线| 亚洲一二三区在线| 欧美~级网站不卡| 在线视频精品一| 久久免费午夜影院| 国产精品视频一区二区三区| 亚洲第一精品在线| 性色一区二区三区| 亚洲欧洲精品一区二区| 欧美一区二粉嫩精品国产一线天| 欧美激情第4页| 狠狠色伊人亚洲综合网站色| 一区二区三区精密机械公司 | 欧美激情导航| 亚洲欧美日韩综合aⅴ视频| 欧美成人a∨高清免费观看| 国产目拍亚洲精品99久久精品| 亚洲激情视频在线播放| 久久精品理论片| av不卡免费看| 麻豆精品视频在线观看| 国产视频在线观看一区二区三区| 夜夜精品视频| 欧美激情精品| 欧美伊久线香蕉线新在线| 国产精品xnxxcom| 亚洲精品亚洲人成人网| 美女精品一区| 久久er精品视频| 国产精品欧美久久| 一区二区三区成人| 亚洲韩国精品一区| 久久裸体艺术| 国产综合欧美| 香蕉久久夜色精品国产| 一区二区三区日韩精品| 欧美精品在线视频| 亚洲国产美女| 欧美.日韩.国产.一区.二区| 欧美制服丝袜| 国产伦精品一区二区三区免费| 亚洲一区二区三区四区视频| 亚洲免费播放| 欧美日韩国产精品一卡| 日韩亚洲精品在线| 亚洲欧洲在线视频| 欧美国产高潮xxxx1819| 亚洲精品护士| 最新亚洲激情| 欧美福利视频在线| 亚洲精品乱码久久久久久黑人| 欧美大片免费观看| 乱码第一页成人| 亚洲国产精品一区制服丝袜| 免费在线看一区| 老色鬼久久亚洲一区二区 | 久久精品国产欧美激情| 国模一区二区三区| 久久亚洲精品欧美| 久久欧美肥婆一二区| 亚洲丰满在线| 亚洲黄色免费| 欧美视频二区36p| 亚洲专区国产精品| 亚洲淫片在线视频| 国产深夜精品| 久久久噜噜噜久久人人看| 久久福利资源站| 在线成人性视频| 亚洲大胆在线| 欧美日韩在线另类| 亚洲欧美日韩视频一区| 亚洲欧美综合国产精品一区| 国产午夜精品视频| 欧美成年人视频网站欧美| 欧美激情一区二区三区在线视频观看 | 亚洲精品乱码久久久久| 欧美噜噜久久久xxx| 亚洲小说春色综合另类电影| 一区二区三区四区精品| 国产欧美日本在线| 蜜桃av一区二区在线观看| 蜜桃久久av一区| 一级日韩一区在线观看| 亚洲免费伊人电影在线观看av| 国产一区二区三区视频在线观看| 欧美成人精品高清在线播放| 欧美激情一区在线| 欧美在线观看网址综合| 狂野欧美一区| 亚洲男人av电影| 久久国产精品第一页| 日韩视频一区二区三区在线播放| 一本色道久久综合狠狠躁的推荐| 国产亚洲精品aa午夜观看| 亚洲国产精品久久久久婷婷老年| 国产精品高潮视频| 老司机午夜精品视频在线观看| 欧美大香线蕉线伊人久久国产精品| 亚洲网址在线| 久久午夜国产精品| 亚洲影视在线| 美女黄色成人网| 午夜国产精品视频| 欧美91精品| 欧美一区二区精品| 欧美成人午夜激情视频| 欧美在线播放一区二区| 欧美电影免费| 久久精品国产99精品国产亚洲性色 | 亚洲综合日韩| 久久影院午夜论| 校园春色国产精品| 欧美成人亚洲成人日韩成人| 欧美一区二区在线观看| 欧美激情2020午夜免费观看| 久久成人综合网| 欧美噜噜久久久xxx| 麻豆精品视频在线观看| 国产精品久久久久9999高清 | 亚洲国产视频a| 亚洲一区三区电影在线观看| 亚洲黄色一区| 欧美伊人久久久久久久久影院| 一本一道久久综合狠狠老精东影业| 久久精品欧美日韩精品| 亚洲影院污污.| 欧美精品99| 免播放器亚洲一区| 国产欧美日本一区视频| 99国内精品久久久久久久软件| 在线观看欧美| 欧美亚洲免费高清在线观看| 亚洲手机在线| 欧美激情精品久久久六区热门 | 在线午夜精品| 欧美成人免费全部| 免费成人美女女| 国产亚洲二区| 亚洲一区综合| 亚洲一区国产视频| 欧美日韩精品免费看| 亚洲国产成人精品视频| 1000精品久久久久久久久| 欧美一区1区三区3区公司| 欧美亚洲综合在线| 国产精品麻豆va在线播放| 一本色道久久加勒比精品| 宅男在线国产精品| 欧美日本国产在线| 亚洲裸体俱乐部裸体舞表演av| 亚洲激情综合| 榴莲视频成人在线观看| 免费在线观看精品| 伊人色综合久久天天五月婷| 久久不见久久见免费视频1| 久久精品欧美| 国产亚洲精品高潮| 欧美在线免费视频| 久久久久久久97| 狠狠综合久久av一区二区小说| 亚欧成人在线|