Subscribe ( )

iPhone Programming Tutorials


 

Forum

You must be logged in to post Login Register

Search 

Help with UITextField Delegate

User Post

7:08 am
September 27, 2008


Colonial94

Noob

posts 3

1

I am trying to develop an app which allows the user to add records to a UITableView.  I have most everything set up, but I have run into a problem when trying to implement the UITextFieldDelegate which I am trying to use for the data entry.  Here's the full setup, any help or pointers would be appreciated:

User clicks the add button from the UITableView which loads a new UITableView (grouped) to be used for data entry.  The cells in this UITableView are custom cells which I developed in Interface Builder – each cell includes a label & a UITextField.  After a good amount of research I figured out how to get the custom cells to load correctly.

The Label & TextField are linked up to a customCellClass which allows me to customize the loaded data at runtime.  Up to this point, everything seems to be working.  The problem is with the TextFieldDelegate setup:

I want to be able to adjust the TableView to show the appropriate cells when the keyboard is activated, so I am trying to setup the TableViewController as the delegate for the TextFieldDelegate.  In order to do this, I set up the TableViewController as the FileOwner for the customCell in IB and linked the TextFieldDelegate up to the FileOwner.  In Xcode I updated the TableViewController declaration to include the <UITextFieldDelegate>, but still can't get the controller to act as the delegate.

When I switch the delegate to be the customCellClass, using the same methods, it seems to work, but then I'm having a tough time figuring out how to access the TableView to adjust it accordingly.

I'm probably overlooking something basic here, but have been wrestling with it for a few hours and would love any pointers if anyone can help.

Thanks!


7:44 am
September 29, 2008


Colonial94

Noob

posts 3

2

Got it working – sort of:

It appears that the mechanism I am using to load the table cells is having inconsistent effects on the setting of the TextField delegate.  When I try to use the view controller it's not being set correctly (getting set to a different, temporary vc), but when I was setting it to the cell itself it was set correctly.  Still not sure why, but for now I am programatically setting the delegate of the TextField after the nib is loaded & it appears to be working.

Search 

About the iCodeBlog forum

Most Users Ever Online:

44


Currently Online:

8 Guests

Forum Stats:

Groups: 2

Forums: 6

Topics: 419

Posts: 893

Membership:

There are 934 Members

There has been 1 Guest

There are 2 Admins

There is 1 Moderator

Top Posters:

bobcubsfan – 54

crazyiez – 30

Uhu – 17

AdeC – 17

Nick – 15

jitesh61 – 12

Administrators: Brandon (88 Posts), Collin (0 Posts)

Moderators: VertigoSol (26 Posts)



©   

  • Posted by on 6 Aug 2008 in Uncategorized
  •   |  
  •   |  
  •   |  
  • Comments Off

Comments are closed.