UIActivity Indicator-加载视图
我正在尝试向我的项目添加一些标题。因此,当我的应用程序加载时,它应该显示我的标题屏幕,其中活动指示器旋转,3秒后它应该推动导航控制器。基本上我会在第一个视图控制器上有一个图像。所以,在IB中我添加了一个图像视图并设置了图像。请帮助我,如何在第一个视图控制器加载后加载第二个视图控制器。
基本上请告诉我如何在特定时间延迟后推送导航控制器,而无需任何按钮或任何其他控件。
感谢您的宝贵时间..
编辑
- (void)viewDidLoad {
[super viewDidLoad];
[indicator startAnimating];
timer=[NSTimer scheduledTimerWithTimeInterval: 3.0 target:self selector:@selector(loadNextView) userInfo:nil repeats: YES];
}
-(void)loadNextView
{
TabBarControllers *tabBar=[[TabBarControllers alloc]initWithNibName:@"TabBarControllers" bundle:nil];
[self.navigationController pushViewController:tabBar animated:YES];
[indicator stopAnimating];
}
I am trying to add some titles to my project. So, when my app gets loaded it should show my title screen with activity indicator spinning and after 3seconds it should push the navigation controller. Basically I will have an image on the first view controller. So, in IB I added an image view and set the image. Please help me guys how to load second view controller after the first view controller gets loaded..
Basically please tell me how to push navigation controller after particular time delay without any buttons or any other controls in it..
Thanks for all your time..
EDIT
- (void)viewDidLoad {
[super viewDidLoad];
[indicator startAnimating];
timer=[NSTimer scheduledTimerWithTimeInterval: 3.0 target:self selector:@selector(loadNextView) userInfo:nil repeats: YES];
}
-(void)loadNextView
{
TabBarControllers *tabBar=[[TabBarControllers alloc]initWithNibName:@"TabBarControllers" bundle:nil];
[self.navigationController pushViewController:tabBar animated:YES];
[indicator stopAnimating];
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
看一下 NSObject 的 PerformSelector:withObject:afterDelay: 方法。您应该能够指定 3 秒的延迟来执行该操作。
Take a look at the NSObject's performSelector:withObject:afterDelay: method. You should able to specify 3 seconds delay to perform the action.
还有许多 iPhone 示例代码,它们使用 NSTimer 在指定的延迟后调用任何对象上的任何方法。只需创建一个方法来停止活动指示器并推送下一个控制器,并在第一个视图中启动活动指示器后通过 3 秒 NSTimer 调用该方法。
There's also lots of iPhone example code that uses an NSTimer to call any method on any object after a specified delay. Just create a method to stop the activity indicator and push your next controller, and call that method via a 3 second NSTimer after starting the activity indicator in your first view.