2

重複の可能性:
Objective C のキャレット

Objective-C で ^ 記号は何を意味しますか?

コード:

 GreeRequestServicePopup* requestPopup = [GreeRequestServicePopup popup];
 requestPopup.parameters = parameters;

 requestPopup.willLaunchBlock = ^(id aSender) {
 [[NSNotificationCenter defaultCenter] postNotificationName:@"request_service_popup_will_launch_block" object:nil];

 };

 requestPopup.didLaunchBlock = ^(id aSender) {
[[NSNotificationCenter defaultCenter] postNotificationName:@"request_service_popup_did_launch_block" object:nil];
 };

 requestPopup.willDismissBlock = ^(id aSender) {
 [[NSNotificationCenter defaultCenter] postNotificationName:@"request_service_popup_will_dismiss_block" object:nil];
 };

 requestPopup.didDismissBlock = ^(id aSender) {
 [[NSNotificationCenter defaultCenter] postNotificationName:@"request_service_popup_did_dismiss_block" object:nil];
 };

 requestPopup.cancelBlock = ^(id aSender) {
 [[NSNotificationCenter defaultCenter] postNotificationName:@"request_service_popup_cancel_block" object:nil];
 };

 requestPopup.completeBlock = ^(id aSender) {
 [[NSNotificationCenter defaultCenter] postNotificationName:@"request_service_popup_complete_block" object:nil];
 };

 [self.navigationController showGreePopup:requestPopup];
 }

前もって感謝します!

4

3 に答える 3

5

^ブロックリテラルです。ブロックリテラルの後に引数が続き、その後、コードの実際の内容を示す中括弧が続きます。

| ^          | (id arg)    | {};          |
|:-----------|------------:|:------------:|
| Block      | Parameters  |     Body     |
| literal    |             |              |

ブロックリテラルはここでかなりよく説明されています。

于 2012-07-02T06:29:13.353 に答える
3

^ブロックを意味します。詳細はこちら:http ://developer.apple.com/library/ios/#documentation/cocoa/Conceptual/Blocks/Articles/00_Introduction.html

実際には、これは後で実行されるコードの一部を指定します。

于 2012-07-02T06:29:27.553 に答える
1

それらはブロックです。あなたはここで良い紹介を読むことができます。次に、ブロックプログラミングトピックを読んで詳細を確認してください。

于 2012-07-02T06:29:43.317 に答える