如何将NSRect更改为CGRect? [英] How to change NSRect to CGRect?
本文介绍了如何将NSRect更改为CGRect?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
-(void)drawRect : (NSRect)rect
{
imgRect.orgin = NSZeroPoint;
imgRect.size = [appleImage size];
drawRect = [self bounds];
[appleRect drawInRect:appleRect
fromRect:imgRect
operation:NSCompositeSourceOver
fraction:1.0];
...
}
<
I'm trying this but it's not easy and driving me crazy.
如何将NSRect类型代码更改为CGRect类型代码?
How to change NSRect type code to CGRect type code ?
plz帮助!
ps。我已经知道.. NSRect - > CGRect,NSZeroPoint - > CGRectZero
ps. i already know.. NSRect -> CGRect , NSZeroPoint -> CGRectZero
推荐答案
只需使用这些2 Cocoa
Just use these 2 Cocoa (no iOS) functions:
CGRect NSRectToCGRect(NSRect nsrect);
NSRect NSRectFromCGRect(CGRect cgrect);
看看这里深化主题: http://cocoadev.com/CGRect
这篇关于如何将NSRect更改为CGRect?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文