When using setCustomView, app freezes
Hey Sam,
Thanks for this great plugin. I'm facing a strange problem when using setCustomView though. I try to load a custom view from a xib file using this code:
// Getting the views from the xib file
NSArray *subviews = [[NSBundle mainBundle] loadNibNamed:@"MiscViews" owner:nil options:nil];
for (UIView *subview in subviews) {
if ([[subview restorationIdentifier] isEqualToString:@"Loading View"]) {
// Creating a new view
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 150)];
// Adding the subview form the xib to this view
[view addSubview:subview];
// Setting the new view as the view for the loading state
[self.tableView.pullToRefreshView setCustomView:subview forState:SVInfiniteScrollingStateLoading];
}
}
But when the state is loading, the app freezes. From my researches, it's because layoutSubviews (from UIScrollView+SVPullToRefresh) is called repeatedly. Not sure why this happens, and my capacities to debug on Objective-C are kind of limited. I know this doesn't happen when I'm just creating a UIView directly from the code, without using a xib.
Has anyone been facing this problem before or has any idea why this happens?
Ah, apparently this issue is reported there to: #169
Tried to come back to a release that worked, and apparently this never worked well. When setCustomView was introduced, the problem was already here.
Why are you using SVInfinite constants on the pull to refresh dialog?