当 UIProgressView 已满时加载新视图 [英] Load new view when UIProgressView is full
问题描述
所以我有一个 UIProgressView 可以作为一种加载栏.父 UIView 在导航控制器内,当 UIProgressView 已满时,我想转到导航层次结构中的下一个视图.有关如何执行此操作的任何提示?
So I have a UIProgressView that works as a sort of loading bar. The parent UIView is inside a navigation controller, and when the UIProgressView is full, I want to go to the next view in the navigation hierarchy. Any tips on how to do this?
推荐答案
NSTimer 可能会定期填充您的进度视图,对吗?
Your progress view is probably being filled periodically by an NSTimer, correct?
假设您想在 10 秒内将它填入 10 个部分.
Let's say you want to fill it in ten parts over the course of ten seconds.
每个 NSTimer 滴答都会添加:
Each NSTimer tick would add:
progress = progress + 0.1;
if (progress == 1.0) {
[self.navigationController pushViewController:viewController animated:YES];
}
progress 是控制 UIProgressView 填充率的东西,viewController 是你的 viewController.
Where progress is whatever controls the fill rate of your UIProgressView and viewController is your viewController.
这篇关于当 UIProgressView 已满时加载新视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!