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 11-16-2009, 11:29 PM   #1 (permalink)
Registered Member
 
Join Date: Nov 2009
Posts: 21
keano is on a distinguished road
Default Updating a label in a cell

Hello,

I will like to update a particular label in all the table cells (using an array) whenever the user taps the return button on the keyboard.

I have already created a setLabel(NSString *) method in the table cell class. However, I can’t seem to call this method from the textFieldShouldReturn method (when the user taps the return key).

I also tried to call the cellForRowAtIndexPath method in the textFieldShould Return method using the following lines:

For LOOP
cell1 = [[self tableView] cellForRowAtIndexPath: counter]

However, the application always hangs because an exception is thrown.

Will appreciate any help, thank you =)
keano is offline   Reply With Quote
Old 11-16-2009, 11:34 PM   #2 (permalink)
Will Work for Food!
 
itzdark's Avatar
 
Join Date: Apr 2009
Posts: 579
itzdark is on a distinguished road
Send a message via AIM to itzdark Send a message via MSN to itzdark
Default

Quote:
Originally Posted by keano View Post
Hello,

I will like to update a particular label in all the table cells (using an array) whenever the user taps the return button on the keyboard.

I have already created a setLabel(NSString *) method in the table cell class. However, I can’t seem to call this method from the textFieldShouldReturn method (when the user taps the return key).

I also tried to call the cellForRowAtIndexPath method in the textFieldShould Return method using the following lines:

For LOOP
cell1 = [[self tableView] cellForRowAtIndexPath: counter]

However, the application always hangs because an exception is thrown.

Will appreciate any help, thank you =)
[tableView reloadData];
that will call cellforrow and any others that the tableview uses to set its cells/rows/sections
__________________

Check out my apps

Developers, check out study buddy. I use it everytime I code. It's great for those late night coding sessions.
Unofficial Ad Hoc Distribution Guide || Join my cooperative ad hoc testing group
iSoothe Promotional Video
Contact Me
itzdark is offline   Reply With Quote
Old 11-16-2009, 11:43 PM   #3 (permalink)
Registered Member
 
Join Date: Nov 2009
Posts: 21
keano is on a distinguished road
Default

Quote:
Originally Posted by itzdark View Post
[tableView reloadData];
that will call cellforrow and any others that the tableview uses to set its cells/rows/sections

Hi,

Thank you for your quick reply.

What I will like to do is to update a particular label in all the table cells using a new array of data. If I am to reload the data, how do I tell the cell that I have a new set of data for the label?

*Hope I am making sense here, it is all quite new to me, thank you again =)
keano is offline   Reply With Quote
Old 11-16-2009, 11:46 PM   #4 (permalink)
Will Work for Food!
 
itzdark's Avatar
 
Join Date: Apr 2009
Posts: 579
itzdark is on a distinguished road
Send a message via AIM to itzdark Send a message via MSN to itzdark
Default

Quote:
Originally Posted by keano View Post
Hi,

Thank you for your quick reply.

What I will like to do is to update a particular label in all the table cells using a new array of data. If I am to reload the data, how do I tell the cell that I have a new set of data for the label?

*Hope I am making sense here, it is all quite new to me, thank you again =)
Well are u wanting to switch to a different array or just change the value in the array its already using?
__________________

Check out my apps

Developers, check out study buddy. I use it everytime I code. It's great for those late night coding sessions.
Unofficial Ad Hoc Distribution Guide || Join my cooperative ad hoc testing group
iSoothe Promotional Video
Contact Me
itzdark is offline   Reply With Quote
Old 11-17-2009, 12:13 AM   #5 (permalink)
Registered Member
 
Join Date: Nov 2009
Posts: 21
keano is on a distinguished road
Default

Quote:
Originally Posted by itzdark View Post
Well are u wanting to switch to a different array or just change the value in the array its already using?
I will actually like to switch to a different array ...
keano is offline   Reply With Quote
Old 11-17-2009, 12:24 AM   #6 (permalink)
Registered Member
 
Join Date: Nov 2009
Posts: 21
keano is on a distinguished road
Default

Quote:
Originally Posted by itzdark View Post
Well are u wanting to switch to a different array or just change the value in the array its already using?
Hello,

Your question actually created the idea that I could just change the value in the array and then reload the data.

I have tried it and it worked.

Just want to say a sincere thanks because it is a problem that I have been stuck in for some time (Yes, I am quite a noob
keano is offline   Reply With Quote
Old 11-17-2009, 02:18 AM   #7 (permalink)
Will Work for Food!
 
itzdark's Avatar
 
Join Date: Apr 2009
Posts: 579
itzdark is on a distinguished road
Send a message via AIM to itzdark Send a message via MSN to itzdark
Default

anytime
__________________

Check out my apps

Developers, check out study buddy. I use it everytime I code. It's great for those late night coding sessions.
Unofficial Ad Hoc Distribution Guide || Join my cooperative ad hoc testing group
iSoothe Promotional Video
Contact Me
itzdark is offline   Reply With Quote
Reply

Bookmarks

Tags
cell, label, table, update

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: 344
13 members and 331 guests
akacaj, alexP, ClerurcifeDer, Duncan C, givensur, glenn_sayers, GraffitiCircus, guusleijsten, JmayLive, NetGuru, Paul Slocum, Punkjumper, yys
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,649
Threads: 94,114
Posts: 402,883
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Anwerbl
Powered by vBadvanced CMPS v3.1.0

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