iOS 9:按钮上的黑色背景,以及某些设备上的性能错误

时间:2015-11-19 18:45:22

标签: ios iphone ipad core-plot

我们有一个案例,其中4个iPad中的3个按预期运行我们的应用程序,然后在未在图表上加载大量(x,y)点的那个,与屏幕截图的唯一区别是黑色背景导航中的“< Back”按钮。它看起来像iOS 5和6上的旧后退按钮? (更新:阅读rmaddy关于“一般>辅助功能”中“按钮形状”设置的评论

enter image description here VS enter image description here

  

版本是9.0.2(13A452),仅限Wi-Fi,而型号是   MD510LL / A

VS

  

版本是9.0.2(13A452),Carrier是Verizon 21.1,而Model是   MD524LL / A

黑色按钮1是运行iOS 9的iPad第4代,只有该设备上有旧的学校黑色背景?我将window.tintColor更改为黑色以修复UIAlertAction错误,其中白色文本不可读,所以也许这解释了其中的一部分?

图形问题

主要关注的是在加载核心图表时,所有x值在一小部分设备的时间间隔增量循环期间保持为零。我之前看过32位设备失败了,第四代是32位。但是,我个人已经测试了iPad第4代,其规格与上面的第二代相同。

我的测试设备上的一切都按预期工作......就Wi-Fi,Verizon / ATT的差异以及这些问题的所有32位/ 64位解释我发现这有用:http://www.everymac.com/systems/apple/ipad/ipad-air-faq/differences-between-ipad-air-ipad-4th-gen.html < / p>

当无法使用wifi时,iOS 9中的某些新设置(如“低功耗模式”)是否会影响使用Verizon数据计划进行网络连接的能力?这就是当前的情况,包括有问题的设备在VPN上。

同样,这是运行相同应用的两个不同设备!具有黑色背景的设备在加载图表数据时出现问题。 iOS 9中是否有新设置会导致设备之间出现这些奇怪的差异/错误?

注意:最近发现一个用户的iPhone 6s +有相同的图形错误,因此不仅仅是iPad相关......

以下是如何从SOAP响应对象填充(x,y)coords:

NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init];
[dateFormat setDateFormat:@"MM/dd/yyyy h:mm:ss a"];

if (unitCount == 0)
    {
        DataHistory_object *dho = [[DataHistory_object alloc] init];
        dho.dataDate = [attributeDict objectForKey:@"Date"];
        NSLog(@"dho.dataDate: %@",dho.dataDate);
        dho.dataValue = [attributeDict objectForKey:@"Value"];
        float dataValue = [dho.dataValue floatValue];

        newDate = [dateFormat dateFromString:dho.dataDate];
        [[NSUserDefaults standardUserDefaults] setObject:dho.dataDate forKey:@"firstDate"];

        //@"start" is defined in a separate class
        if (![[[NSUserDefaults standardUserDefaults] objectForKey:@"start"] isEqualToString:dho.dataDate])
        {
            NSDate *start = [dateFormat dateFromString:[[NSUserDefaults standardUserDefaults] objectForKey:@"start"]];
            firstDate = [dateFormat dateFromString:dho.dataDate];
            NSTimeInterval secondsBetween = [firstDate timeIntervalSinceDate:start];
            interval = secondsBetween;
            NSString *startDate = [NSString stringWithFormat:@"%@",[dateFormat stringFromDate:newDate]];
            NSLog(@"firstDate: %@",startDate);
            NSLog(@"unitCount == 0 if: %d - interval: %f",unitCount,interval);
        }
        else
        {
            NSLog(@"unitCount == 0 else: %d - interval: %f",unitCount,interval);
        }

        if (trendIndex == 0)
        {
            [dataHistoryArray addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
        }
        if (trendIndex == 1) 
        {
            [dataHistoryArray2 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
        }
        if (trendIndex == 2) 
        {
            [dataHistoryArray3 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
        }
        if (trendIndex == 3) 
        {
            [dataHistoryArray4 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
        }
        if (trendIndex == 4) 
        {
            [dataHistoryArray5 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
        }
        if (trendIndex == 5) 
        {
            [dataHistoryArray6 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
        }
        if (trendIndex == 6) 
        {
            [dataHistoryArray7 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
        }

        oldDate = newDate;

        unitCount++;
    }
    else
    {
        DataHistory_object *dho = [[DataHistory_object alloc] init];
        dho.dataDate = [attributeDict objectForKey:@"Date"];
        dho.dataValue = [attributeDict objectForKey:@"Value"];
        float dataValue = [dho.dataValue floatValue];

        newDate = [dateFormat dateFromString:dho.dataDate];

        NSTimeInterval secondsBetween = [newDate timeIntervalSinceDate:oldDate];
        interval = (interval + secondsBetween);
        NSLog(@"unitCount %d - interval: %f",unitCount,interval);

        if (trendIndex == 0) 
        {
            [dataHistoryArray addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
        }
        if (trendIndex == 1)
        {
            [dataHistoryArray2 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
        }
        if (trendIndex == 2) 
        {
            [dataHistoryArray3 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
        }
        if (trendIndex == 3) 
        {
            [dataHistoryArray4 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
        }
        if (trendIndex == 4) 
        {
            [dataHistoryArray5 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
        }
        if (trendIndex == 5) 
        {
            [dataHistoryArray6 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
        }
        if (trendIndex == 6) 
        {
            [dataHistoryArray7 addObject:[NSMutableDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithFloat:interval],@"x",[NSNumber numberWithFloat:dataValue],@"y",nil]];
        }

        oldDate = newDate;

        unitCount++;

    }

以下是数组的加载方式:

-(NSUInteger)numberOfRecordsForPlot:(CPTPlot *)plot {

if ([(NSString *)plot.identifier isEqualToString:@"Blue"])
{
    return [dataHistoryArray count];
}
//...same code for other arrays and colors    

return 0;
}

-(NSNumber *)numberForPlot:(CPTPlot *)plot field:(NSUInteger)fieldEnum recordIndex:(NSUInteger)index {

NSNumber *num;

if ([(NSString *)plot.identifier isEqualToString:@"Blue"])
{
    num = [[dataHistoryArray objectAtIndex:index] valueForKey:(fieldEnum == CPTScatterPlotFieldX ? @"x" : @"y")];
    return num;
}
//...same for other arrays and colors

return 0;
}

我还需要在添加每个绘图后操作图形:

-(void)changePlotRange {
    y.orthogonalCoordinateDecimal = CPTDecimalFromFloat(appDelegate.lowY);
    plotSpace = (CPTXYPlotSpace *)graph.defaultPlotSpace;
    plotSpace.xRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(0.0f) length:CPTDecimalFromFloat([[NSUserDefaults standardUserDefaults] floatForKey:@"secondsBetween"])];
    plotSpace.yRange = [CPTPlotRange plotRangeWithLocation:CPTDecimalFromFloat(appDelegate.lowY) length:CPTDecimalFromFloat(appDelegate.highY-appDelegate.lowY)];
}

2 个答案:

答案 0 :(得分:1)

secondsBetween默认值何时设置?某些设备上可能存在计时问题,导致应用程序检索到错误的值。

在向任何图表添加新数据后,您还可以使用[plotSpace scaleToFitPlots:[graph allPlots]]重新计算绘图空间范围。

答案 1 :(得分:0)

认识到这并不是一个最容易接受答案的问题,我会用我发现的内容更新这篇文章。

一些用户报告图表左侧所有数据的绘图问题是由于那些用户在MILITARY TIME中运行。我使用NSDateFormatter的间隔计算从未考虑过这一点。我最终为NSDateFormatter创建了一个类别,无论日期格式如何,它都按照现有代码的方式处理日期。

至于按钮颜色的差异,Rick Maddy在评论中回答了这个问题,所以我无法接受他的回答:

  

带有黑色按钮的设备启用了&#34;按钮形状&#34; General =&gt;下的选项“设置”应用中的辅助功能。这是在iOS 7中添加的。