I'm trying to use SwipeView view, i'm making all like in paging example;
- (void)viewDidLoad{
[super viewDidLoad];
_swipeView.pagingEnabled = YES;
}
- (NSInteger)numberOfItemsInSwipeView:(SwipeView *)swipeView{
return [_items count];
}
- (UIView *)swipeView:(SwipeView *)swipeView viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view{
//create new view if no view is available for recycling
if (view == nil)
{
//don't do anything specific to the index within
//this `if (view == nil) {...}` statement because the view will be
//recycled and used with other index values later
view = [[UIView alloc] initWithFrame:self.swipeView.bounds];
view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
}
//set background color
CGFloat red = arc4random() / (CGFloat)INT_MAX;
CGFloat green = arc4random() / (CGFloat)INT_MAX;
CGFloat blue = arc4random() / (CGFloat)INT_MAX;
view.backgroundColor = [UIColor colorWithRed:red
green:green
blue:blue
alpha:1.0];
return view;
}
- (CGSize)swipeViewItemSize:(SwipeView *)swipeView
{
return self.swipeView.bounds.size;
}
But for some reason i having next issue: 'CALayer position contains NaN: [nan 227]'. On this line of code in SwipeView.m:
view.center = CGPointMake(center.x, _scrollView.frame.size.height/2.0f);
in - (void)setFrameForView:(UIView *)view atIndex:(NSInteger)index;
method
After debugging and trying to find reason of this issue i saw that value of property in SwipeView scrollOffset never sets, and it's nil, then i'm setting _scrollOffset in my viewDidLoad method to 1, for example and it's works, but little messes up scrollOffset. In example of SwipeView everything works perfectly without setting this property to any value, any ideas why? Thanks!
PROJECT - github
Similar questions: - CALayer position contains NaN: [nan -0.5] - How to solve CALayerInvalidGeometry', reason: 'CALayer position contains NaN: [nan nan]?
EDIT:
The problem appears only when i'm pushing view with SwipeView.