I am trying to do a slideshow display of items and I have an issue where there is a mysterious padding added to the first cell(on the left side) and last cell(right side) as shown below and demonstrated by the black box
DataSource datasource = new DataSource(Vcollection, PageControl, this);
Vcollection.Source = datasource;
doRefreshList = true;
Vcollection.CollectionViewLayout = new UICollectionViewFlowLayout()
{
ItemSize = Vcollection.Frame.Size,
HeaderReferenceSize = new CGSize(0, 0),
SectionInset = UIEdgeInsets.Zero,
ScrollDirection = UICollectionViewScrollDirection.Horizontal,
MinimumInteritemSpacing = 0f, // minimum spacing between cells
MinimumLineSpacing = 0f,
SectionInsetReference = UICollectionViewFlowLayoutSectionInsetReference.ContentInset,
};
Vcollection.ContentInset = UIEdgeInsets.Zero;
Vcollection.ScrollIndicatorInsets = UIEdgeInsets.Zero;
Vcollection.ContentOffset = new CGPoint(0f, 0f);
this.AutomaticallyAdjustsScrollViewInsets = false;
This is my code where I tried to rectify the issue, but to no avail. How can I remove this padding?
------------------EDIT --------------------- Replacing the last 4 lines with
VehicleCollectionView.ContentInset = new UIEdgeInsets(0, -20, 0, 0);
VehicleCollectionView.ContentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentBehavior.Never;
Works, however pagination is still off. attempting to scroll through the collectionview shows huge offsets as shown below where pagination is stuck between 2 items