@property (nonatomic, retain) IBOutlet UILabel *labelupdate01; @property (nonatomic, retain) IBOutlet UILabel *labelupdate02; @property (nonatomic, assign) ViewController *aViewController;
Well, start by changing these properties to (non-atomic, weak). This is a more correct approach. And it is not recommended to check the display of one of the model classes in the MVC template. So, your logic in + (void)updatedisplay does not make sense to me, I think it should be something like +(NSString *) getStringToDisplay with the functionality implied in func. label name and text are updated in vc code based on the received string.
But just to answer your question the way you asked:
The right way is to do this as suggested or passed the viewcontroller to your newclass instance during initialization, so that your specific view manager is already initialized.
As with most objects, you do not get the active active view manager, doing:
ViewController *labelupdate02; labelupdate02.labelupdate02.text = @"Update from NewClass";
labelupdate02 is not initialized here. But even if you subsequently select and run it, you will not get the active view controller that you want to update, but just another instance of the viewcontroller.
source share