Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Apr 9, 2008, 06:34 AM   #1
Duke Leto
macrumors regular
 
Join Date: Mar 2008
Editable Table Views

I am making an iPhone application and I know that you can edit the information. (press the edit button, every table view is different , then click on one and voila a keyboard/picker/whatever comes up for you to input data). What do I need to be able to do this. What kinds of classes and functions do I need, and what do they need to be able to do?

Thank you in advance for helping.
Duke Leto is offline   0 Reply With Quote
Old Apr 9, 2008, 07:15 AM   #2
iphoneGuy
macrumors member
 
Join Date: Oct 2007
Location: [[NSLocation alloc] initWithCity: Chicago]
Quote:
Originally Posted by Duke Leto View Post
I am making an iPhone application and I know that you can edit the information. (press the edit button, every table view is different , then click on one and voila a keyboard/picker/whatever comes up for you to input data). What do I need to be able to do this. What kinds of classes and functions do I need, and what do they need to be able to do?

Thank you in advance for helping.
Check out the UI Sampes and the other samples they are very good..
iphoneGuy is offline   0 Reply With Quote
Old Apr 9, 2008, 07:43 AM   #3
Littleodie914
macrumors 68000
 
Littleodie914's Avatar
 
Join Date: Jun 2004
Location: Rochester, NY
There are lots of different way to implement a "edit" function.

Do you want to hit the edit button, then click on one of your TableView's rows and have it pull up an edit window for the object in that row?

Or are you looking for a way to place editable text fields into a table view?
Littleodie914 is offline   0 Reply With Quote
Old Apr 9, 2008, 03:41 PM   #4
Duke Leto
Thread Starter
macrumors regular
 
Join Date: Mar 2008
I would want it to be that when you press the edit button you ca then edit the data in each text field. I recently downloaded the SQLite Books sample code, and I am trying to sift out what I need to know, but if I could get some help here, it would push me forward!
Duke Leto is offline   0 Reply With Quote
Old Apr 10, 2008, 06:56 PM   #5
Duke Leto
Thread Starter
macrumors regular
 
Join Date: Mar 2008
I have watched the tutorial on making the edit button that goes into editMode. I have realized a bit better how this works. My new question here is how would I go about adding cells or editing text in a text field... not that much different of a question I realize, but I do not want this thread to drown unanswered.
Duke Leto is offline   0 Reply With Quote
Old Apr 11, 2008, 10:33 AM   #6
Littleodie914
macrumors 68000
 
Littleodie914's Avatar
 
Join Date: Jun 2004
Location: Rochester, NY
Quote:
Originally Posted by Duke Leto View Post
I have watched the tutorial on making the edit button that goes into editMode. I have realized a bit better how this works. My new question here is how would I go about adding cells or editing text in a text field... not that much different of a question I realize, but I do not want this thread to drown unanswered.
Could you be a bit more specific? To edit text in a textfield, you can usually just use the setText: method.

To add a cell to a table view, (I assume this is how you mean it) you just need to implement the delegate method:

Code:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
And return a cell that includes the data you want to display. A good place to start is like so:

Code:
UISimpleTableViewCell *cell = [[[UISimpleTableViewCell alloc] initWithFrame:CGRectZero] autorelease];

cell.text = @"Howdy!";
return cell;
Littleodie914 is offline   0 Reply With Quote
Old Apr 11, 2008, 12:09 PM   #7
lucasgladding
macrumors 6502
 
Join Date: Feb 2007
Location: Waterloo, Ontario
 
I'm still not sure how much detail I want to get into on the forum with the NDA in effect, but here is how I approached editable text fields.

- use custom UITableViewCell with a UITextField as a subview
- override UITableViewCell setSelected: to call makeFirstResponder on the UITextField
- use the view controller viewDidAppear and viewDidDismiss to get the strings from the UITextFields

This is a somewhat different approach than the SQL example, but it works very well for me and requires very little work to implement. That said, I got a few ideas from the example that really helped.

BTW: Offhand, I think you only need the data source methods of UITableView to get the editing functionality.

Last edited by lucasgladding; Apr 11, 2008 at 12:55 PM.
lucasgladding is offline   0 Reply With Quote
Old Apr 11, 2008, 02:34 PM   #8
Littleodie914
macrumors 68000
 
Littleodie914's Avatar
 
Join Date: Jun 2004
Location: Rochester, NY
Quote:
Originally Posted by lucasgladding View Post
I'm still not sure how much detail I want to get into on the forum with the NDA in effect, but here is how I approached editable text fields.

- use custom UITableViewCell with a UITextField as a subview
- override UITableViewCell setSelected: to call makeFirstResponder on the UITextField
- use the view controller viewDidAppear and viewDidDismiss to get the strings from the UITextFields

This is a somewhat different approach than the SQL example, but it works very well for me and requires very little work to implement. That said, I got a few ideas from the example that really helped.

BTW: Offhand, I think you only need the data source methods of UITableView to get the editing functionality.
Yea, I think that method should also work. For my cells, I did the following:

- use custom UITableViewCell with a UITextField as a subview (like you)
- override UITableViewCell willSelectRowAtIndexPath (or something like that) and return -1, so that the actual cell will never be selected
- make sure that the textfield's bounds are the bounds of the tableviewcell, so that any touch on the cell begins the editing for the textfield

Then, I just maintain a reference to the textfield, and use [textField text] to get the value that the user typed in.
Littleodie914 is offline   0 Reply With Quote
Old Apr 12, 2008, 09:34 AM   #9
Duke Leto
Thread Starter
macrumors regular
 
Join Date: Mar 2008
Thank You! I just wanted an idea of what I needed to do, and I think that gave me a push! Now a skill I need to work on is properly phrasing questions. I seem to have trouble putting things into words.
Duke Leto is offline   0 Reply With Quote
Old Apr 13, 2008, 02:53 AM   #10
maxjg
macrumors member
 
Join Date: Aug 2006
Yeah, I'd certainly look at UIShowcase for this. They've got pretty much everything you'll need there.
maxjg is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Is Safari 7's top sites not editable? Nanasaki OS X Mavericks (10.9) 9 May 4, 2014 07:43 PM
What be the best way to create an app with a list of editable items fstigre iPhone/iPad Programming 14 Nov 24, 2012 07:52 PM
Resolved: User editable .plist for UITableView troop231 iPhone/iPad Programming 9 Nov 22, 2012 11:40 PM
Help!!! is there a way to have the text not be editable? Afbar1114 iPhone/iPad Programming 4 Sep 10, 2012 05:02 PM
Making Editable PDF Textfields/Checkmarks minichrispy Mac Applications and Mac App Store 0 Jun 1, 2012 10:01 PM

Forum Jump

All times are GMT -5. The time now is 02:21 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC