macOS/iOS API解説

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。2010年代に書かれた内容です。今後更新はありません。

目次

compare:

セルを比較します
-(NSComparisonResult)compare:(id)otherCell:

解説

セルの文字列を比較します。大文字小文字の違いは無視します。
【NSComparisonResult】
● NSOrderedAscending レシーバのセルが大きい
● NSOrderedSame 同じ
● NSOrderedDescending レシーバのセルが小さい
otherCellがNSCellクラスでなかったり、セルがテキストタイプセルでなければNSBadComparisonExceptionを起こします。

返り値

( NSComparisonResult )

比較結果

引数

( id )otherCell

比較するセル

フレームワーク

ApplicationKit

クラス

NSCell

Instance Methods

使用可能

10.0

参照

例文

#import "MyObject.h"

@implementation MyObject

- (IBAction)myAction:(id)sender
{
switch ([bCell1 compare:bCell2]){
        case NSOrderedAscending:
            NSLog(@"NSOrderedAscending");
            break;
        case NSOrderedSame:
            NSLog(@"NSOrderedSame");
            break;
        case NSOrderedDescending:
            NSLog(@"NSOrderedDescending");
            break;
        default:
            NSLog(@"default");
        }

}
@end