将一些 UILabel 放置在彼此之上并对 iPhone 中的动态尺寸做出反应

发布于 2024-11-09 00:32:53 字数 321 浏览 1 评论 0原文

我从 iPhone 编程开始。我有一个导航控制器,我向其中推送一个新视图。对于这个新视图,我使用 XIB 文件创建了一个新的视图控制器类。在 Interface Builder 中,我在彼此上方添加了一些 UILabels,显示信息。 uilabels 的内容是在运行时定义的,大小应该是动态的。现在我做了一个

[label1 sizeToFit];

并且显示了动态内容!

但是:超出带有新添加文本的 label1 的所有标签现在都被该文本覆盖。我怎样才能让它们向下移动一点,这样它们就不会与 label1 重叠?我必须以编程方式执行此操作吗?

I'm starting with iPhone programming. I have a navigationcontroller, to which I push an new view. For this new view I created a new viewcontroller class with XIB file. in Interface Builder I added some UILabels above each other, showing informations. the content of the uilabels is defined during runtime, the size should be dynamic. right now I do a

[label1 sizeToFit];

and the dynamic content is shown!

BUT: all labels which were beyond the label1 with the newly added text are now covered by this text. How could I manage them to just move down a bit so that they don't overlap with the label1? Fo I have to do this programmatically?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文