nicklockwood/SwipeView

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

Tagalong opened this issue · 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 : Have you solved this issue? Did you've found any workaround?