Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 555345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:48:18+00:00 2026-05-13T11:48:18+00:00

My app has a UITextField inside of a table cell. The table cell is

  • 0

My app has a UITextField inside of a table cell. The table cell is build inside of a TableController class which is the table delegate as well. The TableController is a instance variable of a ViewController class.

What I’m trying to do is to send a message to the ViewController instance when the user touches inside the TextField.

This is a code snipped from the TableController:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

        static NSString *CellIdentifier = @"Cell";

        UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

        if (cell == nil) {
                 cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease];
        }

        cell.textLabel.text = @"test";

        UITextField *textField = [[[UITextField alloc] initWithFrame:CGRectMake(1.0, 5.0, 120.0, 25.0)] autorelease];
        textField.text = @"test 2";
        [textField addTarget:self action:@selector(editingStarted) forControlEvents:UIControlEventTouchUpInside];    
        cell.accessoryView = textField;
        return cell;

}

The first problem is that the TableControllers method editingStarted gets never called. The next interesting part will be to send a message to the parent ViewController class.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T11:48:19+00:00Added an answer on May 13, 2026 at 11:48 am

    You could hold a weak reference to your parent view controller… and change the controlEventType to DidBeginEditing…

    Should be something like this;

    In your UITableViewController:

    -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath
    *)indexPath {
    …..
    [textField addTarget: self
    action:@selector(editingStarted:)
    forControlEvents:
    UIControlEventDidBeginEditing];
    ….
    }

    -(void)editingStarted:(id)sender {
    if([delegate respondsToSelector:
    action])
    [delegate
    performSelector: action withObject:
    (UITextField *)sender.text];
    }

    -(void)setDelegate:(id)del withSelector:(SEL)sel {
    delegate =
    del;
    action = sel;
    }

    In your viewController:

    //ViewController.m

    -(void)someMethod {
    [tableController setDelegate: self
    withSelector: @selector(recieve:)];
    }

    -(void)recieve:(NSString *)textFieldString {
    //Do stuff
    }

    Hope this kinda helps… You should know what to declare in .h file.

    ~ Natanavra.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My Django app has a Person table, which contains the following text in a
I'm a Objective-C newbie and I'm currently trying to build an app which has
It appears that each app has access to its own config settings, which could
I work on a app which has only one way to get a working
Is there an easy way to disable a UITextField in code? My app has
My app has three text fields: 1) Username // Initialization code usernameTextField = [[UITextField
App has 4 view controllers; Menu, A, B and C, and a singleton class
A rails app has some files end with .mobile.erb, which is for iPhone. There
My app has many controls on its surface, and more are added dynamically at
My app has a DataGridView object and a List of type MousePos. MousePos is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.