使用 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];
}
但是,我不确定这是否是发送 rect 结构的最佳方式。