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

逛奔的蝸牛

我不聰明,但我會很努力

   ::  :: 新隨筆 ::  ::  :: 管理 ::
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://m.shnenglu.com/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);
posted on 2011-12-02 00:13 逛奔的蝸牛 閱讀(1452) 評論(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>
            亚洲天堂网在线观看| 欧美在线|欧美| 亚洲手机视频| 免费观看成人鲁鲁鲁鲁鲁视频| 欧美三级免费| 制服丝袜激情欧洲亚洲| 国产精品日韩欧美一区二区| 亚洲黄色一区| 牛牛影视久久网| 久久免费99精品久久久久久| 国产日产欧美a一级在线| 亚洲一区在线观看视频| 99国产精品久久久| 欧美日韩在线第一页| 99国产精品99久久久久久| 亚洲国产精品福利| 欧美在线关看| 韩国精品主播一区二区在线观看| 欧美一级午夜免费电影| 欧美大片专区| 久久免费视频在线| 精品69视频一区二区三区 | 欧美一区激情视频在线观看| 亚洲视频在线观看一区| 国产精品成人一区二区艾草| 亚洲欧美中文日韩在线| 亚洲欧美亚洲| 伊伊综合在线| 亚洲人成艺术| 国产精品―色哟哟| 久久蜜桃香蕉精品一区二区三区| 欧美专区日韩视频| 91久久精品一区二区别| 亚洲毛片在线看| 国产精品一区二区黑丝| 久久久欧美精品sm网站| 噜噜噜躁狠狠躁狠狠精品视频| 亚洲日本一区二区三区| 在线视频免费在线观看一区二区| 国产精品亚发布| 老鸭窝毛片一区二区三区| 欧美aaa级| 亚洲欧美成人网| 久久精品人人做人人爽电影蜜月 | 欧美成人午夜视频| 欧美精品1区2区| 欧美一区二区私人影院日本| 欧美中文在线观看| 亚洲美女一区| 欧美亚洲午夜视频在线观看| 亚洲激情网站免费观看| 一区二区国产精品| 在线播放豆国产99亚洲| 一区二区三区.www| 亚洲国产99| 亚洲资源av| 亚洲伦理在线观看| 欧美在线观看视频一区二区三区| 日韩香蕉视频| 久久九九国产精品| 亚洲小视频在线观看| 久久久久国产精品一区| 另类酷文…触手系列精品集v1小说| 亚洲精品一区二区三区蜜桃久| 亚洲一区二区三区免费观看| 亚洲国产成人在线| 亚洲欧美精品| 日韩亚洲一区二区| 久久精品夜色噜噜亚洲a∨| 亚洲午夜黄色| 欧美精品一区二区三区久久久竹菊| 久久久久国产免费免费| 欧美日韩免费一区二区三区视频| 午夜视频在线观看一区| 欧美激情第三页| 美女脱光内衣内裤视频久久网站| 国产精品chinese| 亚洲国产欧美国产综合一区| 国产亚洲精品高潮| 亚洲一区欧美| 91久久久精品| 亚洲第一中文字幕在线观看| 亚洲高清网站| 国产一区二区成人| 亚洲视频碰碰| 亚洲天堂成人| 欧美另类在线观看| 亚洲黄色一区| 亚洲精品久久久久久下一站| 久久天天躁夜夜躁狠狠躁2022| 久久国产日韩| 国产视频自拍一区| 性欧美video另类hd性玩具| 午夜影院日韩| 国产乱码精品一区二区三区忘忧草| 中文亚洲字幕| 亚洲欧美日韩在线播放| 国产精品久久福利| 亚洲专区免费| 久久嫩草精品久久久久| 好看的日韩视频| 久久综合给合久久狠狠色| 欧美激情小视频| 99国产精品国产精品毛片| 欧美巨乳波霸| 亚洲无线一线二线三线区别av| 亚洲欧美日韩系列| 国产日韩欧美中文在线播放| 欧美一级午夜免费电影| 久久久久久亚洲精品杨幂换脸| 红桃视频一区| 欧美成va人片在线观看| 99www免费人成精品| 性久久久久久| 伊人狠狠色丁香综合尤物| 卡通动漫国产精品| 日韩网站在线观看| 欧美一区二区高清在线观看| 国内自拍亚洲| 欧美激情小视频| 亚洲视频在线观看网站| 久久九九免费| 亚洲人成高清| 国产精品免费在线| 久久一区亚洲| 99re热精品| 国产精品女主播在线观看| 欧美一区视频在线| 亚洲国产精品激情在线观看| 亚洲午夜av在线| 激情久久影院| 欧美金8天国| 午夜精品www| 亚洲国产清纯| 久久黄色小说| 亚洲日本激情| 国产精品一区二区在线| 久久久久看片| 一区二区三区国产精品| 欧美在线视屏| 亚洲三级视频在线观看| 国产精品永久免费观看| 欧美成人网在线| 午夜精品一区二区三区四区| 亚洲国产视频一区| 久久久噜噜噜久久中文字免| 在线综合亚洲| 亚洲国产精品一区在线观看不卡| 国产精品xxxav免费视频| 久久综合久久久久88| 亚洲视频一区二区在线观看 | 国产精品qvod| 久久精品99国产精品酒店日本| 99在线热播精品免费| 欧美成人综合一区| 久久久久国产精品一区二区| 亚洲自啪免费| 亚洲久久成人| 一区二区三区在线观看视频| 国产精品户外野外| 免费日韩av| 久久久久久一区二区三区| 亚洲一区二区三区四区五区黄 | 欧美视频在线免费看| 久久午夜av| 欧美在线一二三| 亚洲男人影院| 亚洲一区bb| 一本大道久久a久久精二百| 欧美高清在线| 欧美gay视频激情| 久久九九热免费视频| 欧美一二三区在线观看| 午夜精品福利一区二区三区av| 这里只有精品视频| 亚洲最快最全在线视频| 最新日韩在线视频| 亚洲人成人99网站| 亚洲国产一区二区精品专区| 狠狠色综合日日| 国产日韩欧美视频| 国产视频精品免费播放| 国产精品老牛| 国产精品一区毛片| 国产欧美日韩| 国产午夜精品美女视频明星a级| 国产日韩欧美在线观看| 国产午夜精品理论片a级探花| 国内成人在线| 亚洲第一成人在线| 亚洲国产精品专区久久| 亚洲毛片网站| 玖玖玖国产精品| 欧美99在线视频观看| 欧美国产日韩一区二区在线观看| 免费欧美在线| 欧美视频一区二区三区…| 国产精品亚洲综合久久| 狠狠久久婷婷| 亚洲人成小说网站色在线|