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

逛奔的蝸牛

我不聰明,但我會很努力

   ::  :: 新隨筆 ::  ::  :: 管理 ::
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>
            久久这里只有| 欧美日韩日本网| 久久免费的精品国产v∧| 欧美一区二视频在线免费观看| 校园激情久久| 欧美在线黄色| 久久综合给合久久狠狠狠97色69| 久久久久国产精品一区| 美女网站久久| 欧美国产精品人人做人人爱| 欧美理论片在线观看| 欧美日韩成人一区二区| 欧美午夜不卡在线观看免费 | 久久视频免费观看| 久久深夜福利| 欧美黄色aaaa| 一区二区日韩免费看| 亚洲系列中文字幕| 久久国产精品久久国产精品 | 亚洲电影成人| 亚洲精品五月天| 亚洲综合色噜噜狠狠| 久久国产一区二区三区| 欧美va天堂| 日韩视频免费看| 午夜精品电影| 麻豆国产精品va在线观看不卡| 欧美理论大片| 国产亚洲一二三区| 亚洲欧洲日产国码二区| 亚洲夜晚福利在线观看| 久久精品成人一区二区三区| 欧美国产激情二区三区| 99精品欧美一区二区三区综合在线 | 久久久人人人| 欧美日韩精品一本二本三本| 国产一区在线看| 亚洲人体一区| 久久成人精品视频| 亚洲福利视频一区二区| 亚洲乱码一区二区| 久久精品国产亚洲a| 欧美久久成人| 国产在线高清精品| 最新日韩欧美| 久久九九国产| 夜夜嗨av一区二区三区四区| 久久久久久久久岛国免费| 欧美日韩国产色站一区二区三区| 国产一区二区三区观看| 99在线热播精品免费| 久久综合精品国产一区二区三区| 亚洲美女电影在线| 久久久精品2019中文字幕神马| 欧美视频免费看| 亚洲欧洲精品一区二区三区不卡 | 日韩亚洲欧美中文三级| 久久精品国产欧美激情| 国产精品高潮呻吟久久av黑人| 狠狠色狠色综合曰曰| 亚洲一区二区三区视频| 欧美高清在线一区| 性色av香蕉一区二区| 欧美日韩国产一区精品一区 | 亚洲精品视频二区| 美玉足脚交一区二区三区图片| 一区二区三区色| 欧美大片在线观看一区| 国内外成人免费激情在线视频网站| 在线中文字幕一区| 欧美激情四色| 久久久999精品免费| 国产精品日韩欧美一区| 99精品国产热久久91蜜凸| 老司机67194精品线观看| 亚洲欧美一区在线| 欧美丝袜第一区| 一区二区三区四区五区精品视频| 欧美成人a∨高清免费观看| 性伦欧美刺激片在线观看| 国产精品高潮呻吟视频| 一区二区日韩| 亚洲精品美女在线观看播放| 美女日韩欧美| 91久久精品美女高潮| 美女在线一区二区| 久久精品国产成人| 国产一区二区三区高清播放| 久久激情视频久久| 亚洲欧美视频一区| 国产精品区一区| 午夜欧美电影在线观看| 亚洲一区二区在线播放| 欧美亚洲不卡| 亚洲主播在线| 亚洲一级黄色av| 国产精品女主播| 欧美一区二区福利在线| 亚洲主播在线播放| 国产偷久久久精品专区| 久久精品九九| 久久九九免费视频| 在线日韩av片| 亚洲国产精品电影| 欧美精品国产一区二区| 99天天综合性| 在线一区二区日韩| 国产精品稀缺呦系列在线| 久久精品国内一区二区三区| 欧美在线视频全部完| 一区二区三区在线看| 欧美成人在线网站| 欧美精品不卡| 亚洲欧美国产高清va在线播| 亚洲在线国产日韩欧美| 国产小视频国产精品| 久热爱精品视频线路一| 欧美r片在线| 夜夜嗨一区二区三区| 一区二区三区视频在线播放| 国产精品网曝门| 麻豆成人在线播放| 欧美肥婆bbw| 午夜日韩电影| 久久一区亚洲| 一区二区三区成人| 亚洲欧美日韩人成在线播放| 伊人精品久久久久7777| 91久久精品国产91久久| 欧美手机在线视频| 久久夜色精品国产欧美乱| 欧美成年视频| 亚洲欧美激情一区| 久久手机免费观看| 亚洲神马久久| 久久黄色级2电影| 一本色道久久88精品综合| 亚洲自拍另类| 亚洲人成艺术| 校园春色综合网| 亚洲美女视频| 欧美在线观看网站| 日韩亚洲在线| 欧美中文字幕在线播放| 亚洲理论电影网| 欧美一区二区三区另类| 亚洲九九精品| 欧美专区亚洲专区| 一区二区三欧美| 久久久久久久成人| 香蕉久久精品日日躁夜夜躁| 美女露胸一区二区三区| 欧美一区中文字幕| 欧美精品三级在线观看| 久久久久一区二区三区| 欧美日韩国产高清视频| 久久综合五月| 国产女人水真多18毛片18精品视频| 欧美激情久久久| 国产综合激情| 在线视频你懂得一区| 亚洲国产精品久久久| 亚洲欧美激情一区| 一区二区免费在线视频| 久久精品欧洲| 欧美在现视频| 欧美日韩专区| 亚洲国产激情| 1000部精品久久久久久久久| 亚洲综合第一| 亚洲已满18点击进入久久| 欧美福利小视频| 欧美电影电视剧在线观看| 国产欧美va欧美va香蕉在| 一本到高清视频免费精品| 亚洲黄一区二区三区| 久久精品视频免费播放| 欧美一区二区观看视频| 国产精品国产三级国产aⅴ浪潮| 亚洲国语精品自产拍在线观看| 精品成人在线| 性高湖久久久久久久久| 午夜在线视频一区二区区别 | 亚洲午夜精品一区二区三区他趣| 麻豆久久婷婷| 理论片一区二区在线| 国产女同一区二区 | 国产精品久久中文| 夜夜夜精品看看| 一本久道久久综合中文字幕| 欧美成人免费网站| 欧美成人一品| 在线视频成人| 久久青青草综合| 久久在精品线影院精品国产| 国产午夜精品视频| 性欧美办公室18xxxxhd| 欧美在线中文字幕| 国产精品综合视频| 亚洲综合电影|