Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 12-30-2011, 03:34 PM   #1 (permalink)
Registered Member
 
Join Date: Dec 2011
Posts: 5
chrisfrank is on a distinguished road
Default Help with -(int)

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
chrisfrank is offline   Reply With Quote
Old 12-30-2011, 03:41 PM   #2 (permalink)
Registered Member
 
Join Date: Dec 2011
Posts: 5
chrisfrank is on a distinguished road
Default

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
chrisfrank is offline   Reply With Quote
Old 12-30-2011, 03:42 PM   #3 (permalink)
Just helping out.
 
Domele's Avatar
 
Join Date: Feb 2011
Posts: 2,565
Domele is on a distinguished road
Default

Can you do anything at all from part c? If so, do all that you can and then post the step in part c that you get stuck on.
__________________
If you are looking for a quality developer, I'm your man. Give me a PM if you are interested.

New app - See screenshots and details at www.globaclock.com.

If you want to thank me, click the link. Every click counts. If you want to do more, buy my app. A link is available on my website. Thanks.
Domele is offline   Reply With Quote
Old 12-30-2011, 03:50 PM   #4 (permalink)
Registered Member
 
Join Date: Dec 2011
Posts: 5
chrisfrank is on a distinguished road
Default

I just need a little "hint"

In other words a little help on how to do part A make it easier for me to find out how to do the rest of the question.
chrisfrank is offline   Reply With Quote
Old 12-30-2011, 03:57 PM   #5 (permalink)
Just helping out.
 
Domele's Avatar
 
Join Date: Feb 2011
Posts: 2,565
Domele is on a distinguished road
Default

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.

New app - See screenshots and details at www.globaclock.com.

If you want to thank me, click the link. Every click counts. If you want to do more, buy my app. A link is available on my website. Thanks.
Domele is offline   Reply With Quote
Old 12-30-2011, 04:11 PM   #6 (permalink)
Registered Member
 
Join Date: Dec 2011
Posts: 5
chrisfrank is on a distinguished road
Default

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.
chrisfrank is offline   Reply With Quote
Old 12-30-2011, 04:39 PM   #7 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,005
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by chrisfrank View Post
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.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


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.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is online now   Reply With Quote
Old 12-30-2011, 07:13 PM   #8 (permalink)
JRG
[Cocoa] Developer
 
Join Date: Dec 2011
Posts: 15
JRG is on a distinguished road
Default You're Welcome - Here's a Hint

Quote:
Originally Posted by chrisfrank View Post
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:

Objective C Programming Tutorial - 1 - Setting up Xcode - YouTube

However, here's a hint on part c:

Code:
-(int) countNumeric
{

int countr = 0;

// '== Yes' is redundant and only used for clarity

if([self isNumeric: textField1.text] == YES)
{
countr++;
}

if([self isNumeric: textField2.text] == YES)
{
countr++;
}

...

return countr;

}
Cheers. : )
JRG is offline   Reply With Quote
Old 12-30-2011, 07:41 PM   #9 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,005
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by JRG View Post
You might checkout this series on YouTube about learning Objective C:

Objective C Programming Tutorial - 1 - Setting up Xcode - YouTube

However, here's a hint on part c:

Code:
-(int) countNumeric
{

int countr = 0;

// '== Yes' is redundant and only used for clarity

if([self isNumeric: textField1.text] == YES)
{
countr++;
}

if([self isNumeric: textField2.text] == YES)
{
countr++;
}

...

return countr;

}
Cheers. : )

ARGGGGGGGHHHH! Don't give the guy the code! This is a learning assignment for a class. If you spoon-feed him the answers, he won't learn.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


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.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is online now   Reply With Quote
Reply

Bookmarks

Tags
countr, int, isnumeric, programming, xcode

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 391
13 members and 378 guests
7twenty7, AppsBlogger, Creativ, Dalia, David-T, Duncan C, HemiMG, heshiming, LunarMoon, Murphy, pbart, teebee74, Tomsky
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,676
Threads: 94,127
Posts: 402,915
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jleannex55
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 06:52 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0