xcode - How do I make 2 labels add together with each other? -


Hello I'm new to Xcode and I'm trying to create an app where you press a button and the number above go; And I have 2 buttons and 2 labels. I have found that 2 labels will be counted, but now I want to add the number of both the labels and display it in a different label. Is there any line that I can add to the buttons so that they can count in other labels or do I need a different action and / or button?

Thanks

straight up:

  Int sum = [[label 1 text] intValue] + [[label2 text] intValue]; Label3.text = [NSString stringWithFormat: @ "% @", sum];   

Should work, just make sure to change the points I am using.

Comments