2013-06-20 7 views
0

좋아, 2 클래스가 있습니다.클래스의 속성이 변경되지 않음

하나는 모든 속성과 하나는 모든 메서드가 있습니다.

모든 메서드가있는 클래스에서 이것을 호출합니다.

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 클래스

  @property (strong) PropertiesClass *allProperties; 

을에 _allProperties에 대한 호출하는 방법 그리고 여기에 .FirstNumber & & .SecondNumber이 PropertiesClass에 주조하는 방법

  @property (nonatomic, assign) int firstNumber; 
     @property (nonatomic,assign) int secondNumber; 

무엇 오전입니다 내가 빠졌어? 속성이 가치를 얻지 않는 이유는 무엇입니까 ??

감사합니다. 좋은 하루 보내세요!

답변

1

이제 PropertiesClass의 속성을 선언하고이 클래스를 할당하고 초기화하지 않습니다. _allProperties를 사용하기 전에 다음을 수행하여 alloc 및 init을 수행해야합니다. _allProperties = [[PropertiesClass alloc] init];

+0

내가 한 것 : _allProperties = [[PropertiesClass alloc] init]; allMethods의 초기화 메서드에서, 나도 방법을 스위치로 일하는 그것을 초기화하고 그것도 일했다. :디 – user1876553

관련 문제