ios - Resize UICollectionViewCell on rotation -


I have takes a UICollectionView entire screen UICollectionView in cells UICollectionView < / Code>, and I use paging.

Adjust I want cells their shape on device rotation to the new UICollectionView I present size isAnimateRotationToInterfaceOrientation: :

  - (minus) Vilanmetroteshntointrfesorianteshn: (UIInterfaceOrientation) Seintrfesopreshn period: (NSTimeInterval) term {{super Vilaanmetroteshntointrfesorianteshn: ToInterfaceOrientation period: period]; [_collectionView Set Calling Quote Layout: [Self-Storage ViewFlowLayoutForOrientation: ToInterfaceOrientation] Animated: Yes]; }  

The collectionViewFlowLayoutForOrientation: being is as follows:

  - (UICollectionViewFlowLayout *) collectionViewFlowLayoutForOrientation: (UIInterfaceOrientation) Orientation {CGSize screenSize = [[UIScreen main screen] border]. Shape; CGFloat width = UIInterfaceOrientationIsLandscape (Orientation)? Max (Screensized.width, screen size. Height): MIN (Screen Size. Width, Screen Size. High); CGFlot height = UINTERFERSITY INDANDANDANDScape (Orientation)? Min (Screensized.width, screen size.heat): maximum (screenized width, screen size.); UICollectionViewFlowLayout * Collections ViewFlowLayout = [[UICollectionViewFlowLayout alloc] init]; [Set CollectionViewFlowLayoutColorline: UICollectionViewScrollDirectionHorizontal]; [Collections viewflowout setIt sizeSize: CGSizeMake (width, height)]; [CollectionViewFlowLayoutSeterminlineline spacing: 0.0f]; [Set CollectionViewFlowLayoutSyninesSet: UIEdgeInsetsZero]; [CollectionViewFlowLayoutSetminentInternSpacing: 0.0F]; Return Collection ViewFlowLayout; }  

This does not work as a purpose

  is not defined by the behavior of UICollectionViewFlowLayout because: Item:  

Most First, I demonstrate that I am probably not completely valid at some height receiving a message in the console UICollectionView should be less than the height of zero section insets up and down values

This is a proper message, like to rotate the animation, screen / UICollectionView is still the frame for the old orientation I want to follow it < / P>

Second, after the rotation, the contentoffset is incorrect because it does not get recalculated again.

I have seen other solutions which invalidate the willRotateToInterfaceOrientation layout in: Duration: , but this does not recalculate contentOffset either. (Zero) willRotateToInterfaceOrientation -

 : I  changing contentOffset  and  contentSize  is as follows, but the results are not perfect either by post : (UIInterfaceOrientation) toInterfaceOrientation period: (NSTimeInterval) period {CGSize fromCollectionViewSize = [self-collectionViewSizeForOrientation: [self-interfaceOrientation]]; CGSize toCollectionViewSize = [Self View ViewSizeForOrientation: toInterfaceOrientation]; CGFloat current page = [_collectionView content offset] .x / [_collectionView limit]. Shape. Width; NSInteger ItemCount = [_collectionView numberOfItemsInSection: 0]; UICollectionViewFlowLayoutInvalidationContext * InvalidContact = [[UICollectionViewFlowLayoutInvalidationContext alloc] init]; [Inwalidshankntest Setkantentsijedjustment: Kgsizemake ((Toklekshnviawsizekvidth - Fromkallekshnviawsizekvidth) * Itemcount, Toklekshnviawsizekhait - Fromkallekshnviawsizekhait)]; [Invalid control set offset adjustment: CGPointMake (current page * toCollectionViewSize.width - [_collectionView content offsets] .x, 0)]; [[_collectionView Collection ViewLayout] Invalid LateAutocontax: Invalidization Containbox]; [Super Vyratoria Interface: Two Interface Orientation Period: Duration]; }  

So, my question is: Does the solution result in the result?

Try adding the [_collectionView invalidateIntrinsicContentSize] line before setting your layout This should be the reason for re-calculating the layout, and, you should get rid of the warning message.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -