SwipeView icon indicating copy to clipboard operation
SwipeView copied to clipboard

Is this proper way to add UIImageView, last item not full image, breaking on rotation

Open Tagalong opened this issue 8 years ago • 1 comments

I followed the paging example. This is my code in - (UIView *)swipeView:(SwipeView *)swipeView viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view. I'm having issues with aspectFit not working, lag on swiping, and image not filling entire view or two partial images filling the view. Also, when I rotate I sometimes get 2 partial images filling the view.

`if (view == nil)

{
    view = [[UIView alloc] initWithFrame:self.swipeView.bounds];

    view.translatesAutoresizingMaskIntoConstraints = NO;

    view.backgroundColor = [UIColor clearColor];

    UIImageView *imageView = [[UIImageView alloc] initWithFrame:view.bounds];
    NSDictionary *imageViewsDictionary = @{@"view" : view, @"imageView" : imageView};
    imageView.translatesAutoresizingMaskIntoConstraints = NO;
    imageView.tag = 1;
    [view addSubview:imageView];
    imageView.contentMode = UIViewContentModeScaleAspectFit;
    imageView.bounds = view.bounds;
    [view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[imageView]|" options:0 metrics:nil views:imageViewsDictionary]];
    [view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|[imageView]|" options:0 metrics:nil views:imageViewsDictionary]];
}`

The last "page" in the swipe view is always a half page img_0718

Tagalong avatar Oct 16 '15 04:10 Tagalong