NSArray lastObject
- (id)lastObject
Return Value of [NSArray lastObject]
The object in the array with the highest index value. If the array is empty, returns nil.
NSArray lastObject example.
NSObject * obj = [[array lastObject] retain];
[array removeLastObject];
// do something with obj (in the same function)
[obj release];
[array removeLastObject];
// do something with obj (in the same function)
[obj release];
Example of [NSArray lastObject].
NSArray* foo = [NSArray arrayWithObject: @"bar"];
id baz = foo.lastObject;
id baz = foo.lastObject;
NSArray lastObject example.
[[NSSortDescriptor alloc] initWithKey: ((MyObject*)managedItems.lastObject).Order
ascending: YES];
Or (better in my opinion)
NSSortDescriptor *rankSortDescriptor = [[NSSortDescriptor alloc] initWithKey: [[managedItems lastObject] Order]
ascending: YES];
ascending: YES];
Or (better in my opinion)
NSSortDescriptor *rankSortDescriptor = [[NSSortDescriptor alloc] initWithKey: [[managedItems lastObject] Order]
ascending: YES];