Hello! I am a newbie in developing apps in iphone and I have a problem with our first project. It is a calculator but with a different touch. We are going to solve the equality of trigonometric functions, but before we can do the comparison in solving the equality, I must solve the concatenating problem. I cannot concatenate the strings coming from the buttons. For example, button1 = "cos"; button2 = "x". When I click the button1, the screen will show cos, but when I click button2 the string "cos" in the screen will be replaced by the string "x" of button2. What should I do to concatenate them? I think stringAppendingByString will not be the solution, I already tried it and it did not work.
Hello! I am a newbie in developing apps in iphone and I have a problem with our first project. It is a calculator but with a different touch. We are going to solve the equality of trigonometric functions, but before we can do the comparison in solving the equality, I must solve the concatenating problem. I cannot concatenate the strings coming from the buttons. For example, button1 = "cos"; button2 = "x". When I click the button1, the screen will show cos, but when I click button2 the string "cos" in the screen will be replaced by the string "x" of button2. What should I do to concatenate them? I think stringAppendingByString will not be the solution, I already tried it and it did not work.
The NSString class has a bunch of methods that let you combine strings.
My guess is that you really want a method like stringWithFormat. That takes a C style format string (but with added format specifiers that are specific to Objective C) and lets you create a new string from the format string plus other inputs.
Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.
The NSString class has a bunch of methods that let you combine strings.
My guess is that you really want a method like stringWithFormat. That takes a C style format string (but with added format specifiers that are specific to Objective C) and lets you create a new string from the format string plus other inputs.
Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.
I was about to edit my reply, because this is what happens.. i got the wrong image... Attachment 3623
and it is still the same.. 'cos' was replaced by 'x' in the screen...
Please post bigger images, and the code that the image shows as text in code blocks. I can't read those tiny images.
I can't read the code in the screen-shot you posted, but I can see that you have at least 4 warnings. Those warnings tell you that something is wrong with your code. Fix them and your problems may well go away.
Ignoring compiler warnings is a very bad idea, especially if you don't understand the reason for them. I have had to live with warnings in a project because they were caused by code that was out of my control, but other than that, our company has a zero tolerance policy for compiler warnings.
Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.
The link was kinda helpful. Thanks!
But I didn't get the local declaration..hides instance variable. I followed the answer but the problem is that it makes the new declared variable unused... And when I fixed the unused, the problem with the local declaretion appears again. What should I do?
The link was kinda helpful. Thanks!
But I didn't get the local declaration..hides instance variable. I followed the answer but the problem is that it makes the new declared variable unused... And when I fixed the unused, the problem with the local declaretion appears again. What should I do?
Post the code that is showing the "local declaration hides instance variable" warning. Not an illegible screen-shot, the code, inside a code block. Tell us in words which line is giving the warning, and also a description of what the code does that is wrong.
Also post the .h file for the module who's code you are posting.
Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.