Subscribe ( )

iPhone Programming Tutorials

 

Forum

If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!

You must be logged in to post Login Register

Search 

Using ViewController inputs to populate NSMutableArray ? ? ?

User Post

3:17 pm
February 19, 2009


OwenLars

Noob

posts 1

1

I am having problems getting string data from the ViewController into an NSMutableArray.

At the moment my code can take string input with the following code -


*******************************************************

#import <Foundation/Foundation.h>

#import “ViewController.h”

@implementation ViewController;

@synthesize txtTermIn;


-(IBAction) updateText:(id) sender 

{

NSString *text;

text = [[NSString alloc] initWithFormat:@”%@”,txtTermIn.text];

}

********************************************************
So any text that is typed in from the UI gets stored in the NSString text
My problem is that i want to buffer all the String data in an Array, but i cant work out how to pass the Strings on to an Array because Xcode wont let me declare and initialise NSMutableArray from the ViewController.m, i just get a whole load of compiler errors.
I can only declare and initialise it from my main() but that is no good because the ViewController has no access to the main().
Should i be using the AppDelegate.m for this? I beleive i should create a method and pass the String data on to it to populate my NSMutableArray, but my attempts at this have failed as i am still new to this Object Orientated Programming.
Any ideas or advice on this would be greatly appreciated !


About the iCodeBlog forum

Currently Online:

2 Guests

Maximum Online: 25

Forums:

Groups: 2

Forums: 6

Topics: 317

Posts: 757

Members:

There are 670 members

There are 1 guests


Brandon has made 87 posts

Top Posters:

bobcubsfan - 54

crazyiez - 30

VertigoSol - 26

AdeC - 17

Uhu - 17

Administrator: Brandon | Moderators: VertigoSol


© - Version 3.1.4 (Build 357)