나는이 질문에 대해 100 번이나 질문했지만 정확히 무엇을 잘못하고 있는지 알 수는 없습니다.보기간에 데이터 전달이 작동하지 않습니다.
이것은 내 두 번째 IOS 응용 프로그램입니다. 내 ViewControllerA의 Button을 눌러 내 ViewControllerB의 Label을 수정하고 싶습니다.
- 나는 나의
ViewControllerB
내 버튼 (ViewControllerA
)에서 스토리 보드에 SEGUE을 만들어 "TestSegue"라고 불렀다. (UIStoryboardSegue *) SEGUE 보낸 사람 : (ID) 보낸 사람 { - (무효) prepareForSegue
:
내가 내 ViewControllerA.m이 코드를 쓴 내 ViewControllerA.h
에 #import "ViewControllerB.h
을 쓴 내 ViewControllerB 아무것도에서 if([segue.identifier isEqualToString:@"TestSegue"]){
ViewControllerB *controller = (ViewControllerB *)segue.destinationViewController;
controller.TestLabel.text = @"TEST!";}}
는
는 에게 는 사람이 뭐를 볼 수 ... TestLabel으로 발생 내가 틀렸어? 사전에
감사
편집 : 지금 작품 rpledge에게 감사드립니다.
새로운 코드 :
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if([segue.identifier isEqualToString:@"TestSegue"]){
ViewControllerB *controller = (ViewControllerB *)segue.destinationViewController;
controller.TestString = @"TEST!";}}
아 ... 당신 말이 맞아요. 그건 바보 같았 어. 고마워요! – Michael