- c - 在位数组中找到第一个零
- linux - Unix 显示有关匹配两种模式之一的文件的信息
- 正则表达式替换多个文件
- linux - 隐藏来自 xtrace 的命令
CGRect
和 NSRect
有区别吗?特别是,我想知道原点的位置。有什么我需要了解的重要差异吗?
最佳答案
它们是一样的。 This link有更多信息。复制到此处以供快速引用:
CGRect
is the CoreGraphics equivalent ofNSRect
.They are deliberately made to have the same layout in memory. As such, it is allowed to convert an
NSRect
to aCGRect
by doing this:CGRect cgrect = *(CGRect *)&nsrect;
CoreGraphics also provides a
CGRectMake()
function which works the same asNSMakeRect()
(note the reversal of verb and object in the names) except it returns aCGRect
.
关于objective-c - CGRect 和 NSRect 之间有什么区别吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2151027/
我是 iPhone 编程的新手,目前正在开发 ballsplit 游戏。在这个游戏中,当我的子弹击中任何球时,我希望它产生两个新球。我的子弹和球都是uiimageview。 这是我的代码: if ((
有人对以下任务有好的解决方案吗? 我需要检查一个 CGRect 是否在另一个 CGRect 内部并返回一个 CGPoint,如果矩形窗口在包含的任何维度之外,它会给出偏移量。 提前致谢 最佳答案 Sw
我有一个 CGRect ,我想用 UIEdgeInsets 调整它. 似乎可能有一个内置函数可以做到这一点。我找了一个 CGRectAdjustByInsets或与其他一些功能一起使用 CGRect…
我正在尝试在 UITextField 中移动文本使其垂直对齐正确。我在网上搜索过,一切都指向编辑这些方法: - (CGRect) textRectForBounds:(CGRect)bounds 和
如何创建UnsafePointer?尝试让 mediaBoxPtr = UnsafePointer(mediaBox) 但失败了 func PDFImageData(filter: QuartzFil
在初始化 CGRect 之前,我试图查看 CGRect 是否与数组中的任何其他 CGRect 相交,但我我还没有找到有效的万无一失的方法。 请注意,交集是 CGRect 的数组。任何关于如何做到这一点
@interface some_class : some_parent { } @property (nonatomic, assign) CGRect the_rect; @end ... @im
当我使用 ReactiveCocoa 时,我想观察我的 tableView 的框架,但是出现了一个问题: __block CGRect tmp_rect; [RACObserve(self, self
我在 View 上放置了一个标签, View 的框架是CGRectMake(0,0,270,203)。现在我必须使用 CGRectMake(0,0,800,600) 截取 View 。所以我必须将标签
如何从另一个中减去一个 CGRect?我希望结果 R1 - R2 是不与 R2 相交的 R1 的最大子矩形。 示例 1: +----------------------------------+| +
大家好,我要问一个基本问题,我搜索了很多链接来解决我的问题,但没有一个没有给出确切的结果。这是我的问题: 我想传递矩形值并使用某种转换返回相同的类型,因为我编写了一种方法,但它给了我错误,我知道它可能
如何使用此方法 - (CGRect)textRectForBounds:(CGRect)bounds limitedToNumberOfLines:(NSInteger)numberOfLines 我
看来错误的真正原因是我试图将 Double 乘以 CGFloat。我花了一段时间通过实验才理解这一点,并更新了我的代码以使用下面 v3 的等效项,但我仍然想理解错误消息。 class MyView:
我一直断断续续地使用那种方法,但从未真正理解它们的行为方式。 每次我尝试使用它们时,我发现自己在尝试不同的方面时陷入黑暗,而且它似乎从来没有达到我期望的效果。 为了争论,我正在尝试转换从 UIKeyb
我尝试子类化 UITextField 来绘制自定义占位符。在 iOS 6 中,这工作正常,但在 iOS 7 中,我得到了不同的 CGRect 高度。 UITextField 框架是(0, 0, 500
我是 iOS 编程新手。 我正在阅读一本指南,一本意大利语版的 iOS 书籍。对于第一个应用程序,我必须像这样修改 ViewController.m: #import "ViewController.
我想将 UITableView 中 UITableViewCell subview 中对象的 CGRect “aRect” 转换为 CGRect 相对于 self.view。 问题是 aRect 是相
我试图拖动CGRect,但没有任何反应。矩形保留在同一个地方。这是我的 mouseDragged: 代码: -(void)mouseDragged:(NSEvent *)theEvent{ NSPoi
我正在声明一个按钮: let button = UIButton(frame: CGRect(x: ?, y: ?, width: 50, height: 50)) 但我记下了如何设置 x和 y相对于
我正在声明一个按钮: let button = UIButton(frame: CGRect(x: ?, y: ?, width: 50, height: 50)) 但我记下了如何设置 x和 y相对于
我是一名优秀的程序员,十分优秀!