0
In ViewController 1 ViewController 2에있는 "changeButtonMessage"함수를 호출하여 UILabel의 텍스트를 변경해야합니다. 함수가 호출되고 있지만 NSLog는 작동하지만 레이블은 변경되지 않습니다. 어떤 도움을 주셔서 감사합니다.다른 뷰 컨트롤러에서 함수 호출
UIViewController.view 속성이 아직 액세스되지 않은 경우 개체를 만든 2
@property (nonatomic, retain) IBOutlet UILabel *loadingtxt;
- (IBAction)changeButtonMessage:(id)sender;
@synthesize loadingtxt;
-(void)changeButtonMessage: (NSString*) newMessage {
loadingtxt.text = newMessage;
NSLog(@"Change label to %@",newMessage);
}
답장을 보내 주셔서 감사합니다. View Controller는 ViewController1의 ViewDidLoad에서 ModalViewController'loadingViewController * loadingView = [[[loadingViewController alloc] init] autorelease]로 생성됩니다. loadingView.modalPresentationStyle = UIModalPresentationFormSheet; [self presentModalViewController : loadingView animated : NO]; ' – user1104325
그리고 뷰 컨트롤러에서 뷰를 어떻게 만듭니 까? 연관된 nib 파일이있는 경우 initWithNibName init 메소드를 사용해야 할 수도 있습니다 ... 다시 디버깅하고 txt로드가 nil인지 확인 했습니까? – bandejapaisa