NSString을 xcode 3.2에서 double로 올바르게 변환하려면 어떻게해야합니까? 이것은 내 코드 (축약 형)이지만 실행하면 메시지에 (null)이라고 표시됩니다. 내가 도대체 뭘 잘못하고있는 겁니까? 정말 고마워!더블 트러블 슈팅을위한 문자열
@synthesize class1sem1;
-(IBAction)buttonPressed
{
NSString *myString = class1sem1.text;
double myDouble = [myString doubleValue];
NSString *message = [[NSString alloc] initWithFormat:
@"%@", myDouble];
UIAlertView *alert =[[UIAlertView alloc] initWithTitle:@"Result" message:message delegate:nil cancelButtonTitle:@"Great!" otherButtonTitles:nil];
[alert show];
[alert release];
[message release];
}
감사 @! 그런 간단한 해결책! –