2012-05-31 14 views
0

이후에 UITextField로 데이터를 보내지 않습니다.이 문제는 지난 며칠 동안 저를 버렸습니다.이 문제는 너무 많은 시간을 낭비하고 있습니다.NSString이 Segue

나는 무슨 일이 일어나고 있는지는 알기 위해 NSLog()를 사용했지만 올바른 것 같지만 왜 데이터를 보내지 않는지 이해할 수 없습니다. PrepareForSegue의 코드는 다음과 같습니다.

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:id 
{ 
    if ([[segue identifier] isEqualToString:@"Confirm"]) { 
     NSLog(@"Preparing to Segue"); 
     SubmitEventsP2 *subEventVC = segue.destinationViewController; 
     NSLog(@"Set destination VC to *subEventVC"); 
     NSDate *choice = [ datePick date]; 
     NSLog(@"Assign date from picker to *choice"); 
     NSDateFormatter *format = [[NSDateFormatter alloc] init]; 
     [format setDateFormat:@"dd/MM/yyy HH:mm"]; 
     NSLog(@"Set the format of date and time"); 
     NSString *formatteddate = [format stringFromDate:choice]; 
     NSLog(@"Store the date format in *formatteddate"); 
     [subEventVC setDateField:formatteddate]; //Incompatible pointer types sending "NSString *" to parameter of type "UITextField *" 
     NSLog(@"Should send the date to the textField"); 
     //  NSString *viewchange = @"SubmitEventsP2" ; 
     NSLog(@"%@",formatteddate); 
    } 
} 

이 문제에 대한 도움을 주시면 감사하겠습니다.

자세한 정보가 필요하면 알려주십시오.

감사

편집 : 질문 을 개정 함.

답변

0

두 가지 :

  1. 당신은 당신의 [subEventVC setdateEvent... 라인 (날짜 자본 D 통지) setDateField를 사용해야 마지막 줄이 있어야한다

  2. % "@

    NSLog (@ ", formatteddate);

편집 :

의 dateField가 텍스트 필드이기 때문에, 당신은 실제로 사용되어야한다 : 나는 총을 뛰어났습니다,이에

[subEventVC.dateField setText:formatteddate]; 
+0

좋아, 답장을 보내 주셔서 너무 빨리, 완료, 나는 너무 많은 실수로 setDateField에 빠뜨린 것 같습니다. 작전 ... 왜 내가 다른 문제가 생겼는지 궁금해. 개정되었습니다. –

+0

답변을 업데이트했습니다. – lnafziger

+0

OK, SubmitEventP2에 getter 메소드가 없습니다. 그것은 내가 뭔가를 위임해야한다는 것을 의미합니까? 나는 이것에 관해 많은 가이드를 보았다. 그리고 나는 혼란 스럽다. –

0

subEventVC에서 NSString 속성을 먼저 먹은 다음 해당 클래스의 viewDidLoad에서 textField로로드 해보십시오. 아직 작성되지 않았기 때문에 textField를 업데이트 할 수 없다고 생각됩니다.

+0

신경 끄시을 @Inafziger하여 위의 답을 읽고 물어 보지 못한 것을 대답했다. – diatrevolo