如何以编程方式创建进度条?
我使用 IBOutlet 创建了一个带有进度条的视图。每当我将视图旋转到横向模式时,它都不会旋转。因此,我需要以编程方式创建进度条。
我该怎么做?
I created a view with a progress bar with an IBOutlet. Whenever I rotate the view to landscape mode, it is not rotated. So, I need to create the progress bar programmatically.
How can I do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
应该让你开始。
我会阅读苹果文档中有关视图和视图控制器的内容。 iPhone OS 的 View 编程指南针对您想要执行的操作提供了相当多的细节。如果您还没有阅读 iPhone 应用程序编程指南和 iPhone 开发指南,我会先阅读。
所有这些文档都可以在developer.apple.com 上以及Xcode 的帮助系统中找到。
Should get you started.
I would read up on views and view controllers in Apple's documentation. The View Programming Guide for iPhone OS goes into quite a bit of detail for what you want to do. If you have not read the iPhone Application Programming Guide and the iPhone Development Guide I would do so first.
All of these documents are available on developer.apple.com, and also in the help system of Xcode.
您可以通过以下代码将进度条旋转为垂直:
progressView.transform= CGAffineTransformMakeRotation( M_PI * 0.5 );
You can rotate the progress bar to vertical by the below code:
progressView.transform= CGAffineTransformMakeRotation( M_PI * 0.5 );
您必须在 IB 中设置 size 属性,然后才能正常工作,请参见下图
这对两者都适用方向
you have to set the property of size in IB then is't work fine see in below image
this work for both orientations