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 08-23-2011, 01:26 PM   #1 (permalink)
Registered Member
 
Join Date: Jul 2011
Posts: 37
ahsan123 is on a distinguished road
Default array data from other viewcontroller

Hello everyone

I have made an application in which I have UITableview and UIView. In UIView I have a text field i which entered data must be save in the UITableView Controller. For this I have done thi:

Code:
Today *today=[[Today alloc]initWithStyle:UITableViewStylePlain];
	AddTasks *add=[[AddTasks alloc]init];
    [today.array insertObject:add.tName.text atIndex:[today.array count]];
	NSUserDefaults *defaults=[NSUserDefaults standardUserDefaults];
	[defaults setObject:today.array forKey:@"todayArray"];
	[defaults synchronize];
Note: TodayTasks is UITableView controller and AddTasks is UIView for entering data.

But I am facing failure in this. Can any one help me.

Thanks
ahsan123 is offline   Reply With Quote
Old 08-23-2011, 01:34 PM   #2 (permalink)
Registered Member
 
Join Date: Jul 2011
Posts: 241
MattW is on a distinguished road
Default

Quote:
Originally Posted by ahsan123 View Post
Hello everyone

I have made an application in which I have UITableview and UIView. In UIView I have a text field i which entered data must be save in the UITableView Controller. For this I have done thi:

Code:
Today *today=[[Today alloc]initWithStyle:UITableViewStylePlain];
	AddTasks *add=[[AddTasks alloc]init];
    [today.array insertObject:add.tName.text atIndex:[today.array count]];
	NSUserDefaults *defaults=[NSUserDefaults standardUserDefaults];
	[defaults setObject:today.array forKey:@"todayArray"];
	[defaults synchronize];
Note: TodayTasks is UITableView controller and AddTasks is UIView for entering data.

But I am facing failure in this. Can any one help me.

Thanks
You're going to have to be a bit more descriptive.... what exactly does 'facing failure' mean? Does the app crash? Does it compile? What happens?
__________________

Highlight PDF text like no other app: iHighlight (now available for iPad and iPhone!)
-----
Create iPhone lists with no typing: Insta-List
-----
Make spelling fun, and create your own tests: iWillSpell
-----
A fast, elegant flashlight app: Insta-Light
-----


FourSixteen Productions
MattW is offline   Reply With Quote
Old 08-23-2011, 01:40 PM   #3 (permalink)
Registered Member
 
Join Date: Jul 2011
Posts: 37
ahsan123 is on a distinguished road
Default

no it doesn't crashes. the failure I am facing is "Data is not being entered"

thanks
ahsan123 is offline   Reply With Quote
Old 08-23-2011, 01:46 PM   #4 (permalink)
Registered Member
 
Join Date: Jul 2011
Posts: 241
MattW is on a distinguished road
Default

Quote:
Originally Posted by ahsan123 View Post
no it doesn't crashes. the failure I am facing is "Data is not being entered"

thanks
Well, seeing as you create 'add' one line before you add it to the UITableView, my guess is that the text field is empty (unless your AddView init() call populates the text field with some data).

You'll need to have some data in your text field before you add it to your table view.
__________________

Highlight PDF text like no other app: iHighlight (now available for iPad and iPhone!)
-----
Create iPhone lists with no typing: Insta-List
-----
Make spelling fun, and create your own tests: iWillSpell
-----
A fast, elegant flashlight app: Insta-Light
-----


FourSixteen Productions
MattW is offline   Reply With Quote
Old 08-23-2011, 02:14 PM   #5 (permalink)
Registered Member
 
Join Date: Jul 2011
Posts: 37
ahsan123 is on a distinguished road
Default

Sorry I did not understand please can you explain please. I do put text in textfield but even then it does not put into the array of UITableView List.

for explaining you:
I have done this in array
Code:
	array=[[NSMutableArray array]retain];
This is TableView array. Means Today's page array
ahsan123 is offline   Reply With Quote
Old 08-23-2011, 02:25 PM   #6 (permalink)
Registered Member
 
Join Date: Jul 2011
Posts: 241
MattW is on a distinguished road
Default

Quote:
Originally Posted by ahsan123 View Post
Sorry I did not understand please can you explain please. I do put text in textfield but even then it does not put into the array of UITableView List.

for explaining you:
I have done this in array
Code:
	array=[[NSMutableArray array]retain];
This is TableView array. Means Today's page array
The text field you're adding will be nil because you've only just created it, so there's no data to add to your array:

Code:
Today *today=[[Today alloc]initWithStyle:UITableViewStylePlain];
AddTasks *add=[[AddTasks alloc]init];

// *** At this point, the text field of add.tName will be blank because you have only just initialized it with the line above.

[today.array insertObject:add.tName.text atIndex:[today.array count]];
__________________

Highlight PDF text like no other app: iHighlight (now available for iPad and iPhone!)
-----
Create iPhone lists with no typing: Insta-List
-----
Make spelling fun, and create your own tests: iWillSpell
-----
A fast, elegant flashlight app: Insta-Light
-----


FourSixteen Productions
MattW is offline   Reply With Quote
Old 08-24-2011, 05:47 AM   #7 (permalink)
Registered Member
 
Join Date: Jul 2011
Posts: 37
ahsan123 is on a distinguished road
Default

Hello MattW

I haven't just created the textfield. Actually I do put data in text field after running the program but when I check the tableview, it shows empty.
It is not being done with this too. It is not showing the string.
Code:
    [today.array insertObject:@"hello" atIndex:[today.array count]];

Last edited by ahsan123; 08-24-2011 at 05:58 AM.
ahsan123 is offline   Reply With Quote
Reply

Bookmarks

Tags
adding data, array, textfield, uitableview, uiview

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: 402
15 members and 387 guests
7twenty7, chiataytuday, cristofercolmbos, dedeys78, fiftysixty, gmarro, iOS.Lover, jonathandeknudt, kilobytedump, Matrix23, raymng, stanny, tymex, UMAD, xerohuang
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,669
Threads: 94,121
Posts: 402,903
Top Poster: BrianSlick (7,990)
Welcome to our newest member, dedeys78
Powered by vBadvanced CMPS v3.1.0

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