Reputation: 1091
Here I having two arrays, one array contains names and the other contains some links. I done sorting of name array, but i need to sort the link array with respect to the changes in the name array. I got a method when I went through the documents and that is:
-(void)replaceObjectAtIndex:(NSUInteger)index withObject:(id)anObject{
}
But I don't know how to implement it. Please give any sample code to implement it. I'm not usre it is the right way to do. If there is any please help me.
Thanks.
Upvotes: 0
Views: 298
Reputation: 2722
This method is already implemented for NSMutableArray, why would you overload it ? I think you should create a new class with 2 properties (name and link) and store this class in a unique Array.
@interface myObject {
NSString *name;
NSString *link;
}
@property (nonatomic, retain) NSString *name;
@property (nonatomic, retain) NSString *link;
Upvotes: 1
Reputation: 1958
Is there a reason you can't combine the name and link in a struct or object for sorting together?
Upvotes: 1