How to create progress bar programmatically?
I created a view with a progress bar with an IBOutlet. Whenever开发者_如何学Go 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?
UIProgressView *progressView = [[UIProgressView alloc] init];
progressView.frame = CGRectMake(100,100,100,20);
[self.view addSubview:progressView];
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.
You can rotate the progress bar to vertical by the below code:
progressView.transform= CGAffineTransformMakeRotation( M_PI * 0.5 );
you have to set the property of size in IB then is't work fine see in below image
this work for both orientations
精彩评论