Please do not post the same thing multiple times. The board software automatically flags certain posts as needing moderator attention. This happens the most often for new users. I'm pretty sure this is made clear at the time you attempt to post. Posting the same thing over and over again just makes that many more posts the moderators have to weed through later. This makes us sad. Don't make us sad. If your post/thread doesn't appear, just wait a while. Don't post it again. If it hasn't shown up by the next day, then you can try again. I normally go through posts in the mornings, and try to check a few times throughout the day, but I'm not here 24/7. There will typically be a significant delay before posts are approved. Just be patient.
I would like to set up a view controller with a 2-component picker where each side contains the same 7 objects. Each object carries the same value for both components. The user would make a selection from each side, enter a value in a provided text field (and optionally tap a "Calculate" button). A calculation would occur using that value and the values from the two picker component objects that were selected and the results would be displayed in a label.
For example, each picker contains the letters a - g. Each letter carries the value of 1 - 7 respectively, for each side of the picker. The user selects "b" and "d" and enters 10. The calculated result of 10 * 2 / 4 = 5 is displayed.
It sounds simple enough. I've found tutorials for doing calculations using values associated with a 1-component picker as well as working with 2-component pickers, but nothing for doing calculations with 2-component pickers. My experience with Xcode is somewhat short. I have solved many problems by following related examples and modifying them to do what I need. So, please be gentle.
As a general matter, I think you will find that you will get better results in forum posts if you attempt a solution yourself and post specific questions when you are unable to get yourself unstuck. First, as a newbie coder this will keep you from being deprived of the valuable learning experience of reading documentation and tinkering on your code. Second, it will mean that you will have a much wider pool of potential respondents. People are more likely to have the time / brainpower to respond to discrete questions than broader "explain this to me" requests.
In that vein, I suggest as a starting point you break down your problem into a list of distinct tasks. Reduce each task into smaller tasks wherever possible. Then go down the list of tasks. Implement the ones you can.
When you get to a task you don't know how to do, give it your best shot. If you have no idea how to do the small task, search for examples/tutorials. If you have a general idea of how to do it, but you need help knowing which function to call or which class to use, check out the Apple documentation. Apple's developer library is located here: https://developer.apple.com/library/ios/navigation/
Finally, if you can't finish the task yourself, post in a forum. By this time you should be able to clearly outline a) what you want the code to do. b) what your code is currently doing. c) how you are testing this. This will not only allow others to understand what you are trying to do and to help you, but it will also give you the benefit of forcing you to analyze your code. Often the effort of describing your problem statement in the manner I described will be enough for you to realize what is going wrong -- or at least, this will happen once you get the hang of it.
Does this sound involved? Sure, it is at first. But it's just like learning any other skill. The more you put it into practice, the more efficient you will become, and the more skilled you will be at avoiding mistakes in the first place. If your goal is to learn to program iOS apps, then this will help you do so much more effectively (and much more quickly!) than asking for someone else to give you instructions each time you encounter a new task.
So, having said all that, try first breaking your problem down. You've made a good start in that you know you want two pickers and you want to perform some calculations based on user input. Just go a little further -- since you know you want two pickers, you need to determine how to get the data from each picker. Then you need to determine how to convert the data into the form you need. I'll let you take it from there.
Thanks for the advice. I had actually tried that method on another forum before I found this one and got no response whatsoever. What I've picked up so far comes from general and specific searches for information in everything from books, to Apple's developer resources, to online forums like this, to web tutorials. Following is what I've got so far in the way of ViewController.m code for the specific screen in question. I posted the whole thing as I suspect that only posting a small snippet could leave out an important factor critical to solving the case. As you can see, I've got the basics in place to deal with calculations from a single-component picker, as well as calculations from multiple field entries. Where I'm stuck is how to define arrays that are identical for two picker components and how to incorporate values from those two components into one calculation. One of the two methods I was working on is commented out. Any help would be greatly appreciated.
Replies
In that vein, I suggest as a starting point you break down your problem into a list of distinct tasks. Reduce each task into smaller tasks wherever possible. Then go down the list of tasks. Implement the ones you can.
When you get to a task you don't know how to do, give it your best shot. If you have no idea how to do the small task, search for examples/tutorials. If you have a general idea of how to do it, but you need help knowing which function to call or which class to use, check out the Apple documentation. Apple's developer library is located here: https://developer.apple.com/library/ios/navigation/
Finally, if you can't finish the task yourself, post in a forum. By this time you should be able to clearly outline a) what you want the code to do. b) what your code is currently doing. c) how you are testing this. This will not only allow others to understand what you are trying to do and to help you, but it will also give you the benefit of forcing you to analyze your code. Often the effort of describing your problem statement in the manner I described will be enough for you to realize what is going wrong -- or at least, this will happen once you get the hang of it.
Does this sound involved? Sure, it is at first. But it's just like learning any other skill. The more you put it into practice, the more efficient you will become, and the more skilled you will be at avoiding mistakes in the first place. If your goal is to learn to program iOS apps, then this will help you do so much more effectively (and much more quickly!) than asking for someone else to give you instructions each time you encounter a new task.
So, having said all that, try first breaking your problem down. You've made a good start in that you know you want two pickers and you want to perform some calculations based on user input. Just go a little further -- since you know you want two pickers, you need to determine how to get the data from each picker. Then you need to determine how to convert the data into the form you need. I'll let you take it from there.
Good luck!
- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome- Spam
- Abuse
- Troll
0 • Off Topic Insightful Disagree Dislike Like Awesome