Cocoa touch 类上的属性未更改

Cocoa touch 类上的属性未更改,cocoa-touch,cocos2d-iphone,xcode4.5,Cocoa Touch,Cocos2d Iphone,Xcode4.5,好的,我有两门课 一个包含所有属性,一个包含所有方法 在这个类中,我调用了所有的方法 switch (_allProperties.switchNumber) { case 0: CCLOG(@"Saving Info"); CCLOG(@"FirstNumber = %d",numberA); CCLOG(@"SecondNumber = %d",numberB); //I get the correct numb

好的,我有两门课

一个包含所有属性,一个包含所有方法

在这个类中,我调用了所有的方法

    switch (_allProperties.switchNumber) {
    case 0:
        CCLOG(@"Saving Info");
        CCLOG(@"FirstNumber = %d",numberA);
        CCLOG(@"SecondNumber = %d",numberB);
        //I get the correct numbers on the dbg
        _allProperties.firstNumber = numberA;
        _allProperties.secondNumber = numberB;

        CCLOG(@"Properties.FirstNumber = %d",_allProperties.firstNumber);
        CCLOG(@"Properties.SecondNumber = %d",_allProperties.secondNumber);
        //Im getting 0 on both of this logs.
        break;
下面是我调用allMethods类上的_allProperties的方法

           @property (strong) PropertiesClass *allProperties;
下面是.FirstNumber&.SecondNumber是如何在PropertiesClass上强制转换的

         @property (nonatomic, assign) int firstNumber;
         @property (nonatomic,assign) int secondNumber;
我错过了什么?为什么属性没有得到值


谢谢你的时间,祝大家过得愉快

现在我明白了,您仍然声明PropertiesClass的属性,并且不分配和初始化这个类。
在使用_allProperties之前,您应该通过以下方式分配并初始化它:_allProperties=[[PropertiesClass alloc]init]

我做到了:_allProperties=[[PropertiesClass alloc]init];在allMethods的init方法中,nevermind我也在我进行切换的方法上初始化了它,它成功了:D