开发者

iOS Tip Calculator [closed]

开发者 https://www.devze.com 2023-02-15 01:01 出处:网络
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetor开发者_开发技巧ical andcannot be reasonably answered in its current form.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetor开发者_开发技巧ical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消