Note that there are some explanatory texts on larger screens.

plurals
  1. POsetContentOffset loses precision?
    primarykey
    data
    text
    <p>I have an application where I need to initialize the <code>contentOffset</code> of a <code>UIScrollView</code> to a certain value. I notice when I set the <code>contentOffset</code>, it rounds the points up to the nearest integers. I've tried using both <code>setContentOffset</code> and <code>setContentOffset:animated</code> and still get the same result. When I try to manually add the <code>contentOffset</code> onto the frame origin, I don't get the result I want. Anyone know anyway around this?</p> <pre><code>UIScrollView *myScrollViewTemp = [[UIScrollView alloc] initWithFrame: CGRectMake(CropThePhotoViewControllerScrollViewBorderWidth, CropThePhotoViewControllerScrollViewBorderWidth, self.myScrollViewBorderView.frame.size.width - (CropThePhotoViewControllerScrollViewBorderWidth * 2), self.myScrollViewBorderView.frame.size.height - (CropThePhotoViewControllerScrollViewBorderWidth * 2))]; [self setMyScrollView: myScrollViewTemp]; [[self myScrollView] setAutoresizingMask: UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight]; [[self myScrollView] setShowsVerticalScrollIndicator: NO]; [[self myScrollView] setShowsHorizontalScrollIndicator: NO]; [[self myScrollView] setBouncesZoom: YES]; [[self myScrollView] setDecelerationRate: UIScrollViewDecelerationRateFast]; [[self myScrollView] setDelegate:self]; [[self myScrollViewBorderView] addSubview: [self myScrollView]]; [myScrollViewTemp release]; UIImageView *myImageViewTemp = [[UIImageView alloc] initWithImage: self.myImage]; [self setMyImageView: myImageViewTemp]; [[self myScrollView] addSubview:[self myImageView]]; [[self myScrollView] setContentSize: [self.myImage size]]; [[self myScrollView] setMinimumZoomScale: self.previousZoomScale]; [[self myScrollView] setMaximumZoomScale: 10]; [[self myScrollView] setZoomScale: self.previousZoomScale animated:NO]; [[self myScrollView] setContentOffset: self.contentOffset animated:NO]; [myImageViewTemp release]; </code></pre> <p>UPDATE: Updated code.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload