여기 내 코드. CGRectMake(..)
에 두 값을 전달하고 가져 오는 중에 오류가 발생했습니다.Int32 값을 신속하게 CGFloat로 변환하는 방법은 무엇입니까?
let width = CMVideoFormatDescriptionGetDimensions(device.activeFormat.formatDescription as CMVideoFormatDescriptionRef!).width
// return Int32 value
let height = CMVideoFormatDescriptionGetDimensions(device.activeFormat.formatDescription as CMVideoFormatDescriptionRef!).height
// return Int32 value
myLayer?.frame = CGRectMake(0, 0, width, height)
// returns error: '`Int32`' not convertible to `CGFloat`
어떻게 오류를 반환하지
Int32
CGFloat
에 변환 할 수
?
고맙습니다. – iosLearner
32 비트 시스템에서이 변환을하는 것이 안전할까요?'int32'는 (여전히) 32 비트이지만,'CGFloat'도 32 비트입니다. 후자가 부동 소수점이고 [이 답변] (http://stackoverflow.com/a/30260843/1492173)을 고려하면 정밀도가 떨어집니다. 내가 틀렸다면 나를 바로 잡아주세요. –