简体   繁体   English

为什么我在不同的设备中获得不同的CGFloat价值

[英]why I am getting different CGFloat value in different devices

Hi my CGFloat value shows different value according to device . 嗨,我的CGFloat值根据设备显示不同的值。

I am using cocos2d game for iPhone 我正在为iPhone使用cocos2d游戏

I am trying to print dt value 我正在尝试打印DT

In iPhone 5 it shows 0.0166666675 在iPhone 5中显示0.0166666675

But in iPhone 6 it show 5.0176358830256065E-315 但在iPhone 6中显示5.0176358830256065E-315

I am using this code 我正在使用此代码

-(void)update:(CGFloat)dt {
static CGFloat time = 0;
time += dt;
 if (time >= 3) {
    [self unscheduleUpdate];
    time = 0;
    if ([self getChildByTag:999].visible)
    {
        [self hideGuide];
    }
} }

You got different results because CGFloat value is different for 32bit & 64bit devices, 您得到了不同的结果,因为32位和64位设备的CGFloat值不同,

typedef float CGFloat;// 32-bit
typedef double CGFloat;// 64-bit

I think this will help you 我想这对你有帮助

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 什么是“(UIView)-> CGFloat”? 我正在尝试获取 CGFloat 值 - What is a "(UIView) -> CGFloat"? I am trying to get a CGFloat value 为不同的设备获取相同的uibutton中心值 - Getting the same center value of uibutton for different devices 为什么使用2个不同的字符串的UIImageRepresentation出现错误? - Why am I getting an error with UIImageRepresentation with 2 different strings? 为什么在iPhone 4s和iPhone 5中获得不同的输出? - why I am getting different output in iPhone 4s and iPhone 5? 即使我不动也能获得不同的位置 - getting different location even if I am not moving 为什么每次尝试使用iOS SDK解密AES数据时都会得到不同的结果? - Why am I getting different results each time I try to decrypt AES data with the iOS SDK? 为什么在模拟器中使用iPad或iPhone会得到不同的结果? - Why am I getting different results depending on whether I use an iPad or and iPhone in the Simulator? 为什么同一应用在不同设备上的大小不同 - Why is the same app different sizes on different devices 为什么不同设备的单个应用程序的日期不同? - Why the date are different in single app for different devices? 为什么我得到此NSDate的空值? - why am I getting a null value for this NSDate?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM