iCarousel icon indicating copy to clipboard operation
iCarousel copied to clipboard

problem with central offset in the iCarousel container

Open TXF opened this issue 12 years ago • 3 comments

Hello Nick got stuck with the content alignment into iCarousel View using iCarouselTypeLinear type of animation. So, all that I want to create an iCarousel instance with custom views and attach it to the UITableViewCell. All look fine except only the the content position of a group of my views within iCarousel container. When views is inserted there remains some empty offsets from left and right from my views. As you wrote in your manual, default alignment is center (contentOffset = CGSizeZero). I was trying to change this situation, adjusting contentOffset with negative value. It decreases left offset but unfortunately increases right one. I also tried to set certain value for the iCarousel view frame directly in code, but no use. It calculates it automatically, thus redundant offsets are always present. Looks like I's trying everything I could, changed contentmode, autosizing mask, etc
I believe,a solution might be quite simple Thanks -1

TXF avatar May 13 '13 17:05 TXF

I suggest using my SwipeView library instead, with alignment set to edge mode. iCarousel isn't designed to work that way.

nicklockwood avatar May 13 '13 17:05 nicklockwood

Thank you for your quick answer Nick. I changed iCarousel to SwipeView and the grid became looking properly.

Of course this topic is closed, but I've noticed some strange behaviour concerned with 2 interconnected methods in SwipeView:

1)- (NSInteger)numberOfItemsInSwipeView:(SwipeView *)swipeView; 2) - (UIView *)swipeView:(SwipeView *)swipeView viewForItemAtIndex:(NSInteger)index reusingView:(UIView *)view;

My problem relates to these methods are invoked twice. It looks like 2 subsequent [someTableView reloadData] (if it was in case of UITableView). Before writing you I've checked all my code once again to be definitely sure. I do not confident if this second "reload" exactly need or it's a kind of a bug. Moreover I created a new clear project and added there your SwipeView and set 2 breakpoints in each of methods. Outcome: 2 invocations. Your Code sets number of Views in the grid and then creates each of view gradually. When the last view is ready, code "jumps" into numberOfItemsInSwipeView and performs all the work once again.

I'd be very appreciate for you If you could help me with that hindrance(and I'm sorry for my "crooked" english. I hope you will get what I mean)

TXF avatar May 14 '13 19:05 TXF

I got the same issue of content offset, i have resolved it. just set the leading constraint of your carouselView with NSLayout constraint and in code set the constant of NSLayoutConstraint value in -ve values. (I have set the constant to be -50) and its working fine.

Sabiyana avatar Mar 16 '20 06:03 Sabiyana