2010-12-19 5 views
0

NSStringの配列をソートしようとしていますが、実際にパラメータを@selectorメソッドに渡す方法がわかりません。ここに私がやろうとしている理由があります2つの引数でカスタムセレクタを使用して配列を並べ替える

//After the optional: id like to pass a UITextField.text but not sure how. 
NSArray *sortedSection = [wordSection sortedArrayUsingSelector:@selector(sortValue:optional:)]; 

私が使用しようとしている方法はここにあります。

- (NSComparisonResult) sortValue:(NSString *)otherString optional:(NSString *)otherLetters; 

ご協力いただきまして誠にありがとうございます。

答えて

2

これは役に立ちますか?

NSArray *tm; 
NSSortDescriptor *name = [NSSortDescriptor sortDescriptorWithKey:@"name" ascending:YES]; 
NSSortDescriptor *age = [NSSortDescriptor sortDescriptorWithKey:@"age" ascending:YES]; 
[tm sortedArrayUsingDescriptors:[NSArray arrayWithObjects:name, age, nil]]; 

は本当にあなたがソートする好きなものを、wordSectionであるかを理解していないとUITextField.text

でいくらになるでしょう
関連する問題