Forums
New posts
Articles
Product Reviews
Policies
FAQ
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Menu
Log in
Register
Install the app
Install
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Easy iPad Point Of Sale Application
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Mark FX" data-source="post: 1585823" data-attributes="member: 211556"><p>The first thing that jumps out at me about your code, is that you are trying to assign a floating point number to an integer variable.</p><p></p><p>In your code you have this.\</p><p></p><p></p><p></p><p>Then this.</p><p></p><p></p><p></p><p>Tryt changing your subtotaal variable to a float like this, and then see what happens.</p><p>Also if your assing a whole number to it, then assign it like this.</p><p></p><p>[CODE]</p><p>float subtotaal;</p><p></p><p>- (IBAction)Eenbol</p><p>{</p><p>subtotaal += 1.0;</p><p>[subtotaalLbl setText: [NSString stringWithFormat:@"%.2f", subtotaal]];</p><p>}[/CODE]</p><p></p><p>You may also notice that I've changed the stringWithFormat: methods tokens, so that it displays a float number with two decimal places.</p><p></p><p>Regards Mark</p></blockquote><p></p>
[QUOTE="Mark FX, post: 1585823, member: 211556"] The first thing that jumps out at me about your code, is that you are trying to assign a floating point number to an integer variable. In your code you have this.\ Then this. Tryt changing your subtotaal variable to a float like this, and then see what happens. Also if your assing a whole number to it, then assign it like this. [CODE] float subtotaal; - (IBAction)Eenbol { subtotaal += 1.0; [subtotaalLbl setText: [NSString stringWithFormat:@"%.2f", subtotaal]]; }[/CODE] You may also notice that I've changed the stringWithFormat: methods tokens, so that it displays a float number with two decimal places. Regards Mark [/QUOTE]
Verification
Name this item. 🍎
Post reply
Forums
macOS & iOS Developer Playground
macOS - Development and Darwin
Easy iPad Point Of Sale Application
Top