问题
I have the function:
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale
The declaration is copied from the documentation. However, I am getting a "convicting parameter types
" warning 'CGFLoat' (aka double) vs 'float'.
Changing the float to a CGFloat
does not make the warning go away. How do I fix?
回答1:
The (current) online documentation is actually wrong (or not up-to-date). It is documented in the iOS 7.0 API Diffs that the declaration of the delegate method has changed to
- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView
withView:(UIView *)view
atScale:(CGFloat)scale; // <-- "CGFloat" instead of "float"
On 64-bit architectures (such as arm64), CGFloat
is defined as a double
and
therefore different from a float
.
来源:https://stackoverflow.com/questions/23093752/conflicting-parameter-types-for-scroll-view-delegate