문제

나는 만들었습니다 NSMutableArray 이렇게 여러 개를 저장하면 CGPoint에스

    safeZonePoints = [NSMutableArray array];
    [safeZonePoints addObject:[NSValue valueWithCGPoint:CGPointMake(234, 160)]];
    [safeZonePoints addObject:[NSValue valueWithCGPoint:CGPointMake(284, 210)]];
    [safeZonePoints addObject:[NSValue valueWithCGPoint:CGPointMake(334, 160)]];
    [safeZonePoints addObject:[NSValue valueWithCGPoint:CGPointMake(284, 10)]];
    [safeZonePoints addObject:[NSValue valueWithCGPoint:CGPointMake(234, 160)]];

이제 나는 NSValue은 배열에서 가져온 것인데 어떻게 변환합니까? NSValue 돌아가다 CGPoint?

도움이 되었습니까?

해결책

다음과 같이 하십시오:

NSValue *cgpointObj = [NSValue valueWithCGPoint:CGPointMake(234, 160)];
CGPoint loc = cgpointObj.pointValue;

다음 링크를 확인하세요. CGPoint에서 NSValue로 및 역방향

귀하의 질문에 답변하기에 충분할 것입니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top