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

  • SEARCH
  • Home
  • 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 8878519
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T19:43:52+00:00 2026-06-14T19:43:52+00:00

I have a UITextField in My CustomCell of UITableview and i am using this

  • 0

I have a UITextField in My CustomCell of UITableview and i am using this UITableview as Subview of Mainview.There is another UITableview Which is also on my MainView but i am using this UITableview as Subclass of my MainView.Below image will also be hlepfull to Understand my problem.

enter image description here

As image show that above UITableview is my SubClass UITableviw and Below one Which is single row UITableview with CustomCell having UITextField. Now i want that when i Click on any Cell of SubClass UITableview my UITextField Text is Clear which i have in CustomCell of UITableview.

Note:- To Make my question more easir i have some code which works for me when i have UITextfield Simply on my MainView (not in CustomCell of UITableview).here is my Code.
In Mainview.h file

#import <UIKit/UIKit.h>
#import "Inputtableview.h"
@interface testingViewController : UIViewController<UITextFieldDelegate,UITableViewDelegate,UITableViewDataSource> {
IBOutlet UITextField *txtfinput;
Inputtableview *inputview;
IBOutlet UITableView *inputtbl; 
}
@property (nonatomic, retain) UITextField *txtfinput;
@end

And then in ViewDidload of Mainview.m file

- (void)viewDidLoad {
if (inputview == nil) {
    inputview = [[Inputtableview alloc] init];
}
[inputtbl setDataSource:inputview];
[inputtbl setDelegate:inputview];
    inputview.view = inputview.tableView;
    inputview.myAccessToMaintxtf = txtfinput;
[super viewDidLoad];
}

Now in my Subclass of UITableview.h file

#import <UIKit/UIKit.h>
@interface Inputtableview : UITableViewController<UITableViewDelegate,UITableViewDataSource> {
}
@property (nonatomic, assign) UITextField *myAccessToMaintxtf;
@end

And Finally in My SubClass UITableview.m file

@implementation Inputtableview
@synthesize myAccessToMaintxtf; 


#pragma mark -
#pragma mark Table view delegate

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

UITableViewCell *selectedCell = [tableView cellForRowAtIndexPath:indexPath];
 myAccessToMaintxtf.text=@"";
 }

As i mention Earliar the Above Code works Fine when I have TextField in my MainView,But Did’t know How to fix it When i Want to Clear the text of UITextField in CustomCell of UITableview.Any help Will be Appriated.Thanx in Advance.

  • 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-06-14T19:43:53+00:00Added an answer on June 14, 2026 at 7:43 pm

    Ok, I can’t see how you are connecting “myAccessToMaintxtf”to the textfield in your CustomCell. What I use for getting subviews from my custom cells are “tags”. A tag can be used like an identifier for your subviews. So, if you are using a xib you can set the tag in the settings tab of your textfield, and if you are creating the textfield by code you can set the tag like:

     myAccessToMaintxtf.tag = 11; //11 is and example number, use the number that you want
    

    Then when you want to access to your textfield use:

    theTextFieldToClear = (UITextField*)[theCellWithTheTextFieldToClear viewWithTag:11];
    

    You can find more information about tags in the UIView Class Reference:
    http://developer.apple.com/library/ios/#documentation/uikit/reference/uiview_class/uiview/uiview.html

    Good Luck

    EDIT 2:

    If you are using two tables, and you want to clear a textfield in one table, selecting the other one, i think that you need something to make the link between the indexPath selected in one table and the indexPath for the cell with the textfield. If you are using something like:

    table 1, indexpath:0,0 for celcius;
    table 1, indexpath:0,1 for farenheit;
    table 1, indexpath:0,2 for kelvin;

    and

    table 2, indexpath:0,0 for celcius;
    table 2, indexpath:0,1 for farenheit;
    table 2, indexpath:0,2 for kelvin;

    You just can use the same indexPath to get the cell with the textfield FROM THE OTHER TABLEVIEW (Inputtableview) like:

    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
    {
        UITableViewCell *cellWithTheFieldToClear = [yourInputTableView cellForRowAtIndexPath:indexPath];
        theTextFieldToClear = (UITextField*)[theCellWithTheTextFieldToClear viewWithTag:2];
        theTextFieldToClear.text = @"";
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried this url to insert uitextfield in custom cell but what i
I have a UITextField and suppose there are 5 characters in this textbox for
I have a UITextField subview within one of my UITableView rows. When I tap
Background have a custom UITableCellView in which I'm using a custom UITextField that I've
Situation: Have a UITextField instance which is a subview of a UIScrollView. Need: Screen
I have UITextField in each Cell of UITableview and I have added UIPickerview as
I have a UITextField in which you can enter only numbers and period ,
I have a UITextField but when it overflows I want it to scroll not
I have a UITextField but my users will prefer enter some number in that
I am new in ios development. I have a UITextField. There I set a

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.