Skip to content
This repository was archived by the owner on Nov 29, 2022. It is now read-only.
This repository was archived by the owner on Nov 29, 2022. It is now read-only.

DZNEmptyDataSetView Frame Issue #147

@wlisac

Description

@wlisac

DZNEmptyDataSetView sets its frame to the scroll view's bounds. I'm experiencing problems with this when reloading the DZNEmptyDataSetView while the scroll view is scrolled/scrolling.

- (void)didMoveToSuperview
{
    self.frame = self.superview.bounds;

    [UIView animateWithDuration:0.25
                     animations:^{_contentView.alpha = 1.0;}
                     completion:NULL];
}

In my specific case – the refresh control I'm using (SSPullToRefresh) adjusts the scroll view's insets and offsets while reloading and animating. This causes the DZNEmptyDataSetView to be in the "wrong" spot when I reload the DZNEmptyDataSetView during this animation.

The simplest solution for my use case is to do this:

- (void)didMoveToSuperview
{
    CGRect frame = self.superview.bounds;
    frame.origin.y = 0.0f;
    self.frame = frame;

    [UIView animateWithDuration:0.25
                     animations:^{_contentView.alpha = 1.0;}
                     completion:NULL];
}

Do you have any suggestions on how we could add this as an option to the project? We could possibly allow the delegate to provide a DZNEmptyDataSetView subclass to use. We could add an option for using a 0 y origin. (non relative origin?). Even just exposing the DZNEmptyDataSetView as a readonly property would allow a UIScrollView subclass to reposition the subview as needed.

Any thoughts on this would be appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions