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.
我在这里有这个等式:
gas.text = [[ NSString alloc] initWithFormat:@"$%f", totalDistance *0.000621371/30 *4.00];
我想要 30 和 4.00 一个变量,所以用户可以在设置中随时更改数字。谢谢你!!
将它们创建为 Int 的变量并加倍代替
Int varforInt; double varfordouble; gas.text = [[ NSString alloc] initWithFormat:@"$%f", totalDistance *0.000621371/varforInt *varfordouble];
您可以获取这些变量中的值,它会动态变化。
更新:-获取文本并且有一种方法 intValue 所以使用那个[text intValue]
[text intValue]