如何更改选择器视图中的字体大小?
我对 iPhone 编程相当陌生,正在尝试实现双组件 PickerView。此时,选择器在获取使用 Interface Builder 创建的用户输入方面工作良好。但是,我需要更改字体大小以适应每列中的文本长度。我非常感谢任何指向创建具有可调整字体大小的多组件选择器的简单方法的链接。如果使用Interface Builder来创建选择器似乎是不可能的。到目前为止,我还没有找到任何详细解决此问题的代码链接。
提前致谢。
I'm fairly new to iPhone programming and am trying to implement a double-component PickerView. At this point the picker works fine in terms of taking user input, created with Interface Builder. However, I need to change the font size to accommodate the text length in each column. I very much would appreciate any link to a straightforward method to creating a multi-component picker with an adjustable font size. Seems like it is not possible if Interface Builder is used to create the picker. So far I have not found any code links that address this issue in detail.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要实现委托方法...
pickerView:viewForRow:forComponent:reusingView:
...然后更改提供的视图内 UI 元素的字体。我认为默认是 UILabel。或者,您可以提供自己的自定义视图。
You need to implement the delegate method...
pickerView:viewForRow:forComponent:reusingView:
... and then alter the font of the UI element inside the provided view. I think the default is a UILabel. Alternatively, you can provide your own custom view.