의 텍스트 필드에 대한 값을 전달 : 두 번째 뷰는 사용자가 행을 선택 테이블 뷰 동안 제보기 빈 텍스트 필드가있다. 행을 터치하면 첫 번째보기의 텍스트 필드에 값을 설정하는 작업이 있습니다. 불행히도 첫 번째보기 필드로 돌아 가면 설정되지 않습니다.I 탐색 컨트롤러 개의 뷰가 처음 볼
@class FirstViewController;
@interface ListaViewController : UIViewController
<UITableViewDataSource, UITableViewDelegate, UISearchBarDelegate>
{
UITableView *table;
UISearchBar *search;
FirstViewController *controller;
}
@property (nonatomic, retain) FirstViewController *controller;
SeconViewController.m FirstViewController.m
#import "FirstViewController.h"
#import "AppDelegate.h"
#import "SecondViewController.h"
@implementation FirstViewController
@synthesize .....
.............
-(void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
self.firstField.text = selectedRow;
}
-(IBAction)showTable:(id)sender
{
SecondViewController *controllerSecond = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
[self.navigationController pushViewController:controllerSecond animated:YES];
}
SecondViewController.h
FirtViewController.h
@interface FirstViewController : UIViewController
{
UITextField *firstField;
UITextField *secondField;
}
@property(nonatomic, retain) IBOutlet UITextField *firstField;
@property(nonatomic, retain) IBOutlet UITextField *secondField;
@property(copy) NSString *selectedRow;
-(IBAction)showTable:(id)sender
:
이
내 코드입니다 - (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSString *selectedRow = [tableData objectAtIndex:indexPath.row];
controller.selectedRow = selectedRow;
[self.navigationController popViewControllerAnimated:YES];
}
을 제시해주십시오.SecondViewController를로드합니다. 바로 여기서 SecondViewController를 First에 연결해야합니다. – Walter
위의 내용을 참조하십시오. 위의 내용을 참조하십시오. – Maurizio