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 6914891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:24:20+00:00 2026-05-27T09:24:20+00:00

Hi I tried another code for passing data but it is not working. How

  • 0

Hi I tried another code for passing data but it is not working. How to pass UITextField value on firstview on UITableViewCell on row? Please someone help me on delegate protocol

//
//  first.h
//  TextviewExample
//
//  Created by pradeep.yadav on 12/5/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "second.h"
#import "TextviewExampleAppDelegate.h"

//@class second;



@interface first : UITableViewController <secondDelegate>{

    //TextviewExampleAppDelegate*app;
    //TextviewExampleAppDelegate *check;
    second *secondview;
    NSString                *secondFavoriteColorString;
    //second *value;

}
@property (nonatomic, retain) second *secondview;
@property (copy) NSString   *secondFavoriteColorString;
@end




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

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    }

    // Configure the cell...
    cell.textLabel.text=@"message";
    cell.detailTextLabel.text=secondFavoriteColorString;
    NSLog(@"this second check:%@",secondFavoriteColorString);

    return cell;
}



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


    second *viewTwo = [[second alloc] initWithNibName:@"second" bundle:[NSBundle mainBundle]];
    self.secondview = viewTwo;
    [viewTwo release];
    [self.navigationController pushViewController:self.secondview animated:YES];
}


-(void)setsecond:(NSString*)secondtextview
{
    secondFavoriteColorString = secondtextview;
    NSLog(@"this second check:%@",secondFavoriteColorString);
}


this second class

//
//  second.h
//  TextviewExample
//
//  Created by pradeep.yadav on 12/5/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <UIKit/UIKit.h>
@protocol secondDelegate<NSObject>
@required
-(void)setsecond:(NSString*)secondtextview ;//forIndexPath:(NSIndexPath*)indexPath;



@end


@interface second : UIViewController {
    IBOutlet UITextField *secondtextfield;

    NSString             *favoriteColorString;
id <secondDelegate> delegate;
}
@property (nonatomic,retain)UITextField *secondtextfield;
//@property (nonatomic,assign)id<secondDelegate>delegate;
@property (retain) id delegate;
@property (nonatomic,copy)NSString           *favoriteColorString;

@end



#import "second.h"


@implementation second
@synthesize delegate,secondtextfield,favoriteColorString;


- (void) viewWillDisappear:(BOOL) animated
{
    [[self delegate] setsecond:secondtextfield.text];
    favoriteColorString=secondtextfield.text;
    NSLog(@"thuis check:%@",favoriteColorString);
}


- (BOOL) textFieldShouldReturn: (UITextField *) theTextField
{
    [theTextField resignFirstResponder];

    return YES;
}
  • 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-27T09:24:21+00:00Added an answer on May 27, 2026 at 9:24 am

    I think the trouble is that you have declared the delegate in the second view, and you are trying to call it from the first view. By the time you have returned to the first view, it’s very likely that the second view has been cleaned up.

    What you want to do is declare the delegate methods in the first view controller, and when you create the second view controller, you set the first view controller to be the delegate of the second view controller.

    I created an example project a while ago. It doesn’t deal with a table view, but it demonstrates passing a string back from a second view controller to the first view controller.

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

Sidebar

Related Questions

The title speaks for itself... I've tried to find another question like it but
Passing data from a controller to another controller. this is what i am doing,
How do you convert a System.Drawing.Bitmap image to another type of image? I tried
Tried to map it from Preferences -> Settings -> Keyboard, but the key combo
Tried a bunch of things but I can't get it to work consistently amid
tried to find the answer by googling and in MSDN but with no luck.
Tried examples from 'php.net' but don't understand what's the problem. Any suggestions? <?php $_SESSION['test']
Been researching how to send data from one child view to another child view.
Another, probably simple problem that, having tried for a good few hours now I'm
I been trying to passing this value: // Content to submit to php Others

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.