Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在研究一个矩阵计算器,它将一个 mxn 矩阵变成行梯形。为了向用户展示矩阵,我设置了一个 UITextField 的 mxn 网格。一切正常,但唯一的问题是我希望能够将一些元素(即 NSNumbers)显示为分数而不是小数。最好的方法是什么?
分数是带有分数部分的整数,因此只需获取 NSNumber 的整数部分,然后计算分数部分。fe: 2.45 让它成为 2 和 0.45 ,使 0.45 到 45 乘 100,然后简化为 9 乘 20