简体   繁体   中英

scrollViewDidEndZooming bug for iOS between iPhone and iPad

So I found this very amusing bug:

if scale is (double) this code works as it should FOR IPHONE but not iPAD- the label gets updated to the new high quality scale.

- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(double)scale {

    scrollView.contentScaleFactor = scale;

    self.label.contentScaleFactor = scale;
}

if scale is (float) this code works as it should FOR iPAD but not iPHONE- the label gets updated to the new high quality scale.

- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView *)view atScale:(float)scale {

    scrollView.contentScaleFactor = scale;

    self.label.contentScaleFactor = scale;
}

So like wt.. so anyone have alternative solution to get scrollViewDidEndZooming scale to work for both (other than having 2 view controller classes)?

The signature of this delegate method should be:

- (void)scrollViewDidEndZooming:(UIScrollView * nonnull)scrollView
                       withView:(UIView * nullable)view
                        atScale:(CGFloat)scale

The type of scale is CGFloat.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM