2012-07-02 67 views
2

可能重複:
Caret in objective C^符號在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]; 
} 

提前感謝!

+1

塊文字。對於每個區塊來說,幾乎都有一個非阻塞的方法。 –

+0

http://stackoverflow.com/questions/1912023/caret-in-objective-c –

回答

5

^是一個block字面值。文字塊之後的爭執,然後花括號來表示代碼的實際肉:

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

塊文字解釋相當不錯here

相關問題