小编Tim*_*wen的帖子

为什么popViewController只能每隔一段时间工作一次

我完全难过,这是情况:

我的应用程序使用Core Location框架获取用户的当前位置,然后将我的服务器ping TrailBehind用于附近有趣的地方并将其显示为列表.没问题.

为了节省电池,我从服务器获取数据后关闭了GPS服务.如果用户在使用应用程序时四处移动并想要一个新列表,则单击导航控制器上的"刷新"并再次激活CLLocation服务,将从服务器检索新的一批数据并重新绘制该表.

当应用程序从我的服务器抓取数据时,我加载了一个带有旋转地球仪的加载屏幕,上面写着"正在加载,请等待",我隐藏了导航栏,因此它们不会"返回".

因此,从服务器获取的初始数据可以完美无缺.

我第一次点击刷新所有代码执行以获取新位置,再次ping服务器以获取新的数据列表并更新单元格.但是,它应该恢复表视图的导航控制器栏,而不是加载表视图,但仍然在主窗口中显示我的加载视图.这只适用于设备,一切都在模拟器中完全正常.

第二次我点击刷新功能正常工作.

我点击刷新的第三次失败如上所述.

我点击刷新的第四次正常工作.

我点击刷新它的第五次失败如上所述.

等等,甚至刷新成功,奇怪的刷新失败.我逐行遍历所有代码,一切似乎正常执行.我其实继续加强对核心指令,庞大的单击"跳过之后"我发现表视图实际上在屏幕上某点CFRunLoopRunSpecific显示,但我然后单击"继续"和我加载视图接手屏幕.

我非常困惑.请帮忙!!非常感谢您的见解.

视频的奇怪行为:

相关守则:

RootViewControllerMethods(这是此TableView项目的基本视图)

- (void)viewDidLoad {
    //Start the Current Location controller as soon as the program starts.  The Controller calls delegate methods
    //that will update the list and refresh
    [MyCLController sharedInstance].delegate = self;
    [[MyCLController sharedInstance].locationManager startUpdatingLocation];
    lv = [[LoadingViewController alloc] initWithNibName:@"Loading" bundle:nil];
    [self.navigationController pushViewController:lv animated:YES];
    [super viewDidLoad];
}



- (void)updateClicked {
    //When the location is successfully updated the UpdateCells method will stop the CL manager …
Run Code Online (Sandbox Code Playgroud)

iphone cocoa-touch uiviewcontroller uinavigationcontroller

6
推荐指数
1
解决办法
7555
查看次数