这是一些代码:
ViewControllerA.h
@interface ViewControllerA: UIViewController {
NSString *myString;
}
@property (nonatomic,retain)NSString *myString;
视图控制器A.m
@implementation ViewControllerA
@synthesize myString;
然后我在导航控制器中推送 ViewControllerB。当我想返回 ViewControllerA ViewControllerB.m
-(IBAction)randomAction(id)sender {
ViewControllerA *myViewController = (ViewControllerA*)[self parentViewController]:
[myViewController setMyString:@"test"]: // HERE IS THE ERROR : "[DMINavigationController setMyString:]:unrecognized selector sent to instance"
[self.navigationController popToViewController:[[self.navigationController viewControllers] objectAtIndex:0] animated:YES]
}
为什么?错误指的是“[DMNavigationController setMyString:]”而不是我的视图控制器是否正常?