在视图之间传递浮动

发布于 2025-01-01 15:27:12 字数 107 浏览 4 评论 0原文

我一直在使用 NSUserDefaults 在我的应用程序中传递浮动。但他们开始不再为我工作了。我刚刚得到南。还有另一种方法可以做同样的事情吗?我一直在尝试一些单例类,但所做的只是使我的应用程序崩溃。

I have been using NSUserDefaults for passing floats all around my apps. But they are starting to not work for me anymore. I just get NAN. Is there another way to do the same thing? I have been toying around with some singleton classes but all that does is crash my app.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

一曲爱恨情仇 2025-01-08 15:27:12

我想通了。我只是取负数的平方根。 NSUserDefaults FTW!
我也让我的单身人士工作得很好。实际上我最终没有使用它,因为我找到了如何从 NSUserDefaults 中存储和提取 NSMutableArray 和 NSMutableDictionary 等对象。

I figured it out. I was just taking the square root of a negative number. NSUserDefaults FTW!
I also got my singleton to work great. I actually ended up not using it because I found how to store and pull objects like NSMutableArray and NSMutableDictionary out of NSUserDefaults.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文