내 응용 프로그램에는 두 가지보기가 있습니다. 주보기에는 사용자가 입력해야하는 입력 필드와 두 번째보기에 연결된 단추가 있습니다. 두 번째보기에는 테이블보기가 있는데, 사용자가 행을 선택하면 자동으로 기본보기로 돌아갑니다. 내 문제는 기본보기로 돌아 가면 텍스트 필드의 값이 지워진다는 것입니다. 모든 솔루션? 감사합니다.텍스트 필드에 값 지정 firstview of secondview
두 번째보기 헤더
@class MainViewController;
@interface ListaViewController : UIViewController
<UITableViewDataSource, UITableViewDelegate, UISearchBarDelegate>
{
UITableView *table;
UISearchBar *search;
MainViewController *child;
}
@property (nonatomic, retain) IBOutlet UITableView *table;
@property (nonatomic, retain) IBOutlet UISearchBar *search;
@property (nonatomic, retain) MainViewController *child;
- (IBAction)switchBack:(id)sender;
두 번째보기 구현 :
-(IBAction)switchBack:(id)sender
{
child.selectedCountry = selectedCountry;
child.codiceComune = codiceComune;
[self.navigationController popViewControllerAnimated:YES];
}
먼저보기 :
-(void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
cityField.text = selectedCountry;
}
이 작동하지!
ViewController를 다시 작성하고 있습니다. 어떤 텍스트 필드를 다시 만들고 있습니다. 다시 원래의 viewController로 다시 전환해야합니다. – ader