2009-12-09 4 views
1

안녕하세요. 문제가 있습니다. 나는 2 viewcontroller, 처음에는 mapView에 대한 주석의 버튼을 탭하기 위해 "calloutAccessoryControlTapped"함수를 구현하는 mapView가있다. 두 번째에는 UITextView가 있습니다. 주석의 단추를 클릭하면 UITextView의 텍스트를 변경하고 두 번째 컨트롤러에서 SecondViewController를 표시하려고합니다. 여기에 내 코드문제 setText UITextView

(FirstViewController)

헤더는

@interface FirstViewController<MKMapViewDelegate>{ 
IBOutlet MKMapView *mapView; 
SecondViewController *secondV;} 
@end 

구현

@implementation FirstViewController 

- (void)mapView:(MKMapView *)mapView annotationView:(MKAnnotationView *)view calloutAccessoryControlTapped:(UIControl *)control{ 
secondV = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil]; 
NSString *myS = @"some text here"; 
[secondV.myTextView setText:myS]; 
secondview 이에서

// 스위치 [자기 presentModalViewController : secondV 애니메이션 : YES]; @end

(SecondViewController)

헤더

@interface SecondViewController{ 
IBOutlet UITextView *myTextView; 
} 

@property(nonatomic, retain)UITextView *postitTextView; 
- (IBAction)backToMAp; 
- (void)setText:(NSString *)string; 
@end 

구현

@implementation SecondViewController 

- (IBAction)backToMAp{ 

// 맨 먼저 볼 수있는; [자기 dismissModalViewControllerAnimated : YES];} 나 버튼을 눌러이 코드

- (void)setText:(NSString *)string{ 
myTextView.text = string;} 

([자기 presentModalViewController : secondV 애니메이션 : YES]) 처음 주석 번째보기 표시되지만 텍스트 UITextView의 텍스트를 변경하지 마십시오. 다시 FirstView ([self dismissModalViewControllerAnimated : YES];)를 누른 다음 다시 두 번째로 전환하려면 버튼을 누릅니다.

죄송합니다. 스레드와 내 나쁜 영어 !!

스택 감사합니다.

답변

0

나는 myTextView@property로 설정하는 것을 잊지 :

@property(nonatomic, retain)UITextView *myTextView; 

을하고 난 구현에 @syntesize 삽입하는 것을 잊지 :

@syntesize myTextView; 
0

코드에 두 개의 UITextView가 있습니다 (myTextView 및 postitTextView). IB에서는 UIView에서 올바른 것을 얻었습니까?