2014-02-13 3 views
-5

방법?스트레이트 업 NSNumber를 NSString으로 변환

@property (nonatomic, strong) NSNumber *seasonRoundN; 
@property (nonatomic, strong) NSString *seasonRound; 

하는 .m

_weMeetAgain = [NSNumber numberWithInt:13]; 
_seasonRound = [NSString stringWithFormat:_weMeetAgain]; // incompatible :S 

더 나은 참조 살펴 보았다해야 .H

가 :

_weMeetAgain = [NSNumber numberWithInt:17]; 
_seasonRound = [NSString stringWithFormat:@"%@", _weMeetAgain]; 

도움말 (아래 답변) : P를, 감사합니다.

+4

'_seasonRoung = [_weMeetAgain stringValue];' – Larme

답변

5
[NSString stringWithFormat:@"%d", [_weMeetAgain intValue]] 
5

는 간단히의 NSNumber 인스턴스 방법 stringValue를 사용합니다.

_seasonRound = [_weMeetAgain stringValue]; 
관련 문제