Nimbus NIPagingScrollViewPage how to load from nib?

119 Views Asked by At

When I load views from a nib in a subclass of NIPagingScrollViewPage, the views render fine, but when I swipe back to go to one I've already seen, that view slides in and then disappears. I'm not sure what's causing this and more likely than not, I'm doing something wrong.

In my NIPagingScrollViewPage subclass, I have the following method:

- (id)initWithReuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithFrame:CGRectZero]; 
    if (self) {
        [[NSBundle mainBundle] loadNibNamed:@"EventPageView" owner:self options:nil];
        [self addSubview:self.eventView];
        label = [[UILabel alloc] initWithFrame:self.bounds];
        label.autoresizingMask = UIViewAutoresizingFlexibleDimensions;
        [self addSubview:label];
    }
    return self;
}

With this code, each view in the NiPagingScrollView loads a custom view from the nib and adds an extra label that I add programmatically. They both get rendered fine when im swiping forward through the views, but they flash and disappear when I swipe back to one I've already seen. However, if I comment out these two lines:

[[NSBundle mainBundle] loadNibNamed:@"EventPageView" owner:self options:nil];
[self addSubview:self.eventView]; 

the labels that I'm adding programmatically get displayed just fine. Might I be overlooking something?

0

There are 0 best solutions below