ios - 在 UIView 中将 UILabel 的中心向上移动。

标签 ios objective-c label cgrectmake

我正在尝试创建一个 UILabel 并使用 label.center = view.center 将其设置为 View 的中心.但我想将它向上移动 100 像素。

我该怎么做?

像,label.frame = CGRectMake(current-x, 100, 42, 21);
这可能吗?保留x相同,但更改 y ?

最佳答案

这样做:label.center = CGPointMake(view.center.x, view.center.y - 100); .

关于ios - 在 UIView 中将 UILabel 的中心向上移动。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17092758/

相关文章:

ios - 如何在 iOS 中将 UIAlertView 显示为全屏?

ios - NSDate 的解析时间

ios - 在 objective-c 中保持 tableview 单元格上按钮的状态单击

html - 输入中心,标签在左上方

ios - 像 youtube 应用程序一样快速的 UISlider

iphone - UIImagePickerController 选择多个图像

ios - Xcode 8 - IB Designables - 无法呈现和更新自动布局状态,代理崩溃

ios - 如何在缩放的 UIView subview 上计算正确的 CGRect 原点?

ios - 如果使用 "ActiveLabel.swift"标记单词有空格,它将标记失败 - swift

.net - 如何在 .NET 中调整 MS 图表的 x 轴标签的位置?