macOS/iOS API解説

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

目次

tryToPerform:with:

アクションメッセージを送ってみます
-(BOOL)tryToPerform:(SEL)aSelector:
      with:(id)anObject:

解説

アクションメッセージを送ってみます。

返り値

( BOOL )

YES/NO

引数

( SEL )aSelector

セレクタ

( id )anObject

オブジェクト

フレームワーク

ApplicationKit

クラス

NSApplication

Instance Methods

使用可能

10.0

参照

- respondsToSelector: (NSObject protocol)

例文

#import "Controller.h"

@implementation Controller

- (IBAction)pushButton:(id)sender
{
	[NSApp setDelegate:self];
	[NSApp tryToPerform:@selector(theAction:)
				   with:@"sss"
	 ];
	
}
-(void)theAction:(id)message
{
	NSLog([message description]);
}


@end