한 컨트롤러에서 다른 컨트롤러로 값을 전달하는 방법 ??? 나는 스토리 보드를 사용한다.segue를 사용하여 다른 컨트롤러로 데이터를 전송합니다. 코드에서
는 내가 처음보기의 강조 표시된 텍스트 뷰에 표시이 싶습니다.
이UIStoryboard *finish = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
UIViewController *viewController = [finish instantiateViewControllerWithIdentifier:@"FinishController"];
viewController.modalPresentationStyle = UIModalPresentationPageSheet;
[self presentModalViewController:viewController animated:YES];
finishcontroller :
이- (void)viewDidLoad
{
self.lblFinishTitle.text=self.FinishTitle;
self.lblFinishDesc.text = self.FinishDesc;
self.lblFinishPoint.text=self.FinishPoint;
[super viewDidLoad];
// Do any additional setup after loading the view.
}
첫 번째보기 :
-(void) prepareForSegue:(UIStoryboardPopoverSegue *)segue sender:(id)sender
{
if ([segue.identifier hasPrefix:@"FinishController"]) {
FinishController *asker = (FinishController *) segue.destinationViewController;
asker.FinishDesc = @"What do you want your label to say?";
asker.FinishTitle = @"Label text";
asker.FinishPoint = @"asdas";
}
}
내가 원하는
전화 코드의 다음 뷰,이 같은 모양을해야한다고 생각 코드 전송을 유발하는 값을 전달하십시오.
빠른 답장을 보내 주셔서 감사합니다. 내가 오류를 깨달았지만 사용할 때 : "[self preformSegueWithIdentifier : @"FinishController "];"오류가 발생합니다 : " 'ViewController'의 표시되지 않는 인터페이스가 selector 'preformSegueWithIdentifier :'를 선언합니다." – Feor
미안하지만, 메서드 시그니처의 일부 ... 두 번째 매개 변수 (보낸 사람)가 필요합니다. 보통 세그가 발생하는 원인으로 전달됩니다 (예 : 단추 ...) 그러나 단추는 직접 세그에 연결될 수 있습니다. 스토리 보드). http://developer.apple.com/library/ios/documentation/uikit/reference/UIViewController_Class/Reference/Reference.html#//apple_ref/doc/uid/TP40006926-CH3-SW83 –
[self performSegueWithIdentifier : @ "Finish" 보낸 사람 : 자기]; 익숙한! 모든 것이 잘됩니다! 고마워요! – Feor