I have a tip calculator that displays the tip in USD in a label. This works fine.
I want to make that the user can divide the tip amout(on label) to how much persons they are. So for example if the tip is 5 USD , and the user is with five people , then he is able to divide the tip amount to 5 , wich gives a tip of 1 USD per person. Could someone help me please ?
If I understand your question correctly then this should help you:
In your header you will have an IBOutlet hooked up to your label (NSTextField)
IBOutlet NSTextField *myLabel;
Then somewhere in your implementation:
float myFloat = [[myLabel stringValue] floatValue];
Now that you have the float value of your label you can do your math on it.
Hope this helps.
精彩评论