Conflicting Parameter Types for Scroll View Delegate

旧时模样 提交于 2019-12-25 02:29:40

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!