I am taking a class in writing programs for the iPad, and there is a part in the instructions that ask's me to:
"write a method of type integer (int) called "countNumeric". It's purpose is to count how many of the text fields contain numbers. You need to do the following:
a- Enter the prototype in the "....Viewcontroller.h"file.
-(int) countNumeric;
b-Enter the framework in the "....Viewcontroller.m"file.
-(int)countNumeric {
}
c- Within the framework, write the code to do the following
-define a variable "countr" of type integer.
-Set variable "countr" to zero.
-Using five "if" statements and the "isNumeric" method, check each text field.
-If the text field is numeric, increment variable "countr".
-Return variable "countr"
I am having trouble with part C.
If anyone can help me with this I would be extremely grateful I have been trying to find a solution for the last 2 hours and I have not succeeded, so if you have any solutions for this problem you will save me lots of headaches -Chris
Last edited by chrisfrank; 12-30-2011 at 03:35 PM.
Reason: forgot something
I have to got for about 30 minutes, so I will not be able to respond to anyone's post. But if you have any idea about my question please reply. And if you need to ask me a question I will be able to answer it in a little but. Thanks! -Chris
You said you were having trouble on part C? I'm confused. And even if you are stuck on Part A, I don't know how to make it any clearer except do it outside the braces but before the @end.
__________________
If you are looking for a quality developer, I'm your man. Give me a PM if you are interested.
Oh sorry, I was in a hurry. What I' having a problem with is part C. What I meant by part A would be the first bracket of part C.
So my question is, How do you define a variable in the framework. Sorry about that.
Framework is a really bad word to use in this context. If your class uses that word, be afraid.
We are talking about the body of the method that you're supposed to write. The part between the curly braces.
You need to either buy a book on beginning Objective C programming, open ANY of the sample applications that come with Xcode, or watch ANY video tutorial that shows how to define variables.
That is so basic that the forum is not going to hand it to you on a silver platter. You need to learn how to use the references available to you. I bet if you did a google search on "defining local variables in C" you could find an article on that very subject (in the case of integer variables, Objective C does it exactly like C, so the info you find will be applicable.)
EDIT: I just used the search I listed above, and sure enough, the very first hit includes an example of a C integer local variable.
The new Aaron Hillegass Objective C book would be an excellent choice for you. It starts out assuming you know nothing about programming. The first 75 pages are an introduction to C, which is the basis of Objective C. It takes things at an easy pace, introducing concepts one at a time. If you read the book cover to cover and do the exercises in it, you'll be an intermediate Objective C programmer when you're done.
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.
c- Within the framework, write the code to do the following
-define a variable "countr" of type integer.
-Set variable "countr" to zero.
-Using five "if" statements and the "isNumeric" method, check each text field.
-If the text field is numeric, increment variable "countr".
-Return variable "countr"
I am having trouble with part C.
If anyone can help me with this I would be extremely grateful I have been trying to find a solution for the last 2 hours and I have not succeeded, so if you have any solutions for this problem you will save me lots of headaches -Chris
You might checkout this series on YouTube about learning Objective C:
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.