在Interface Builder Xib文件中使用自定义大小设计UIView子类自动布局 [英] Design UIView subclass auto layout with custom size in Interface Builder xib file

查看:67
本文介绍了在Interface Builder Xib文件中使用自定义大小设计UIView子类自动布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个UIView子类,其布局在.xib文件中.我将尺寸设置为自由形式,并将尺寸设置为200 x 300.

I have an UIView subclass with its layout in a .xib file. I set the size to freeform and the dimensions to something like 200 x 300.

如何为iPad设置不同的尺寸,以便查看方式"选项正确显示其外观预览?

How can I set different dimensions for iPad so the "View as" option correctly show a preview of how it would look like?

或者,这可以通过其他方式实现吗?也许使用情节提要而不是xib文件?

Or, can this be achieved in a different way? Maybe using a storyboard instead of a xib file?

推荐答案

当然,您可以使其与自动布局兼容,并且可以使用IBDesignable在Interface Builder中进行视觉布局.

Certainly, you can make it compatible with Auto Layout and you can use IBDesignable to do visual layout in Interface Builder.

我有几个示例-包括从XIB文件加载自定义视图-此处: https://github.com/DonMag/IBDesignInspect

I have a couple examples - including loading custom views from XIB files - here: https://github.com/DonMag/IBDesignInspect

这篇关于在Interface Builder Xib文件中使用自定义大小设计UIView子类自动布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆