coc*_*fan 2 cocoa notifications nsnotifications
使用NSRect信息发布通知的最佳方式是什么?
这是我目前的解决方案(使用NSStringFromRect).
- (void)postNotificationForDirtyRect:(NSRect)rect
{
NSDictionary *userInfo =
[NSDictionary dictionaryWithObject: NSStringFromRect(rect)
forKey: ILDirtyRect];
NSNotificationCenter *ncenter = [NSNotificationCenter defaultCenter];
[ncenter postNotificationName: ILDocumentBecomeDirtyRectNotification
object: self
userInfo: userInfo];
}
Run Code Online (Sandbox Code Playgroud)
但是,我不确定这是否是发送rect结构的最佳方法.
| 归档时间: |
|
| 查看次数: |
887 次 |
| 最近记录: |