macOS/iOS API解説

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

目次

setRepresentedObject:

セルにオブジェクトをセットします
-(void)setRepresentedObject:(id)anObject:

解説

セルにオブジェクトをセットします。
プログラマが、一時的にデータを保管するために使うことができます。

返り値

( void )

なし

引数

( id )anObject

オブジェクト

フレームワーク

ApplicationKit

クラス

NSCell

Instance Methods

使用可能

10.0

参照

例文

#import "MyObject.h"

@implementation MyObject

- (IBAction)myAction:(id)sender
{
[bCell1 setRepresentedObject:@"1st text"];
[bCell2 setRepresentedObject:@"2nd text"];
}

- (IBAction)cellPush:(id)sender
{
//[sender setTitle:[sender representedObject]];
[bCell1 setTitle:[bCell1 representedObject]];
[bCell2 setTitle:[bCell2 representedObject]];
}

@end