我遇到一个简单的问题,我试图从另一个类更改一个类的布尔值,但它没有发生,它返回NO
。
//在推送其他视图控制器之前
-(IBAction)editWOD
{
self.editGirlController= [[AddGirlsView alloc] init];
self.editGirlController.isEditModeON=YES;
self.editGirlController.editgirls=girls;
[self performSegueWithIdentifier:@"editModeGirls" sender:self];
}
添加女孩视图 .h
@interface AddGirlsView : UIViewController
{
BOOL isEditModeON;
}
@property BOOL isEditModeON;
添加女孩视图 .m
@synthesize isEditModeON;
- (void)viewDidLoad
{
[super viewDidLoad];
if (isEditModeON==NO) {
NSLog(@"Edit Mode is OFF");
}
else{
[self populateViewOnEdit];
}
}
代码有什么问题?
+++++++++添加答案+++++++++++++++++++
感谢乔尔,这是答案
-(IBAction)editWOD
{
[self performSegueWithIdentifier:@"editModeGirls" sender:self];
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
if([[segue identifier] isEqualToString:@"editModeGirls"])
{
AddGirlsView *editGirlController = [segue destinationViewController];
editGirlController.isEditModeON=YES;
editGirlController.editgirls=girls;
}
}