当我将应用程序移动到后台并将其恢复到前台时,我遇到活动指示器冻结的问题.当应用程序移动到后台时,应用程序可以通过网络加载一些数据.因此,我向用户显示活动指示器.我添加了代码以确保任务在后台完成.当应用程序立即进入前台并且数据未完全加载时,微调器停留在屏幕上但它停止旋转.数据完全加载后,微调器就会消失.
知道活动指标冻结的原因以及可能的解决方案.
谢谢.
我有一个UIActivityIndicator在iPhone 3G模拟器/设备上工作得很好,但它不适用于iPhone 4(Retina)的模拟器/设备.我想提一下它是在黑色背景上.
如何加载UIActivityIndicatorView登录页面?就像facebook iPhone App一样.
我有一个在IB中创建的视图.在里面我有一个以编程方式创建的滚动视图.在滚动视图中,我连接到Web服务并获取内容和图像.我想在执行此操作时显示活动指示器.所以我有:
- (void)viewDidLoad
{
[super viewDidLoad];
activityIndicator = [[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];
activityIndicator.frame = CGRectMake(0.0, 0.0, 40.0, 40.0);
activityIndicator.center = self.view.center;
[self.view.window addSubview:activityIndicator];
Run Code Online (Sandbox Code Playgroud)
在添加scrollview之后,我有:
[self.view addSubview:scrollView];
// ADD Scroll View Ends
//Add the Lisitng Image
NSOperationQueue *queue = [NSOperationQueue new];
NSInvocationOperation *operation = [[NSInvocationOperation alloc]
initWithTarget:self
selector:@selector(loadImage)
object:nil];
[queue addOperation:operation];
Run Code Online (Sandbox Code Playgroud)
在loadimage我有:
- (void)loadImage {
[activityIndicator startAnimating];
Run Code Online (Sandbox Code Playgroud)
我试过[self.view.window addSubview:activityIndicator] ;, [self-> ScrollView addSubview:activityIndicator] ;, [self.view addSubview:activityIndicator];
但我无法得到指标显示.任何人都知道可能出错了什么?
这是我的代码......
- (void) threadStartAnimating {
[activityIndicator startAnimating];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
activityIndicator=[[UIActivityIndicatorView alloc] init];
[activityIndicator setActivityIndicatorViewStyle:UIActivityIndicatorViewStyleWhiteLarge];
activityIndicator.center=[self tableView].center;
[[self tableView] addSubview:activityIndicator];
[NSThread detachNewThreadSelector:@selector(threadStartAnimating) toTarget:self withObject:nil];
EventController *eventController = [[EventController alloc] init];
[eventController setEventID:[[lineItems objectAtIndex:[indexPath row]] objectForKey:@"view_event_button_param"]];
[activityIndicator stopAnimating];
[[self navigationController] pushViewController:eventController animated:YES];
}
Run Code Online (Sandbox Code Playgroud)
事件控制器包含一个需要几秒钟才能加载的Web服务.我可以让活动指示器显示的唯一方法是,如果我在那里抛出一个无限循环......我发现了一些例子,提到将它放在一个单独的线程中,但它似乎不起作用.
xcode web-services uiactivityindicatorview pushviewcontroller ios
我只想在动作花费太多时间时启动我的UIActivityIndicator:
- (void) continueLaunch {
//operations
//.....
[activityIndic stopAnimating];
}
//my current method
- (void)lauchApplication {
[activityIndic startAnimating];
[self performSelector:@selector(continueLaunch) withObject:nil afterDelay:0.0f];
}
//what I want to do
- (void)lauchApplication {
if ([self performSelector:@selector(continueLaunch) withObject:nil afterDelay:0.0f]duration > 1 second){
[activityIndic startAnimating];
}
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能做到这一点 ?
我希望我的公司徽标可以显示在活动指示器中,并且可以在我的iPhone应用程序中旋转。我正在努力。谁能向我建议一些除SVProgressHUD之外的第三方库,因为这没有提供任何自定义图像旋转。
如果有人可以建议一个自定义代码,那么也将不胜感激。
ios ×4
iphone ×3
objective-c ×2
cocoa-touch ×1
ios4 ×1
loading ×1
multitasking ×1
swift ×1
web-services ×1
xcode ×1