【发布时间】:2011-09-21 16:33:39
【问题描述】:
我试图在光标经过视图时更改光标,但我想我没有正确编码它,因为它不起作用。
我有一个 appcontroller 类,在它的 .m 文件中我有这个
- (void) awakeFromNib {
//set up the cursors
NSCursor * handCursor = [NSCursor closedHandCursor];
//make a box
Box* newBox = [[Box alloc] initWithFrame:NSMakeRect(10.0, 10.0, 100.0, 100.0)];
//set up the rect for the cursor change
NSRect rectForCursor = [newBox frame];
[newBox addCursorRect:rectForCursor cursor:handCursor];
//add box to main win
[[mainWin contentView] addSubview:newBox];
}
【问题讨论】:
标签: objective-c nscursor