Display items in different styles(List, Grid, Bloc

2019-08-13 13:50发布

问题:

i am new to xamarin ios. i want to implement display items in different styles (List,Grid,Blocks) in view controller. I tried with table view cell, But i am unable to make it proper. Please find the below images. When ever we click on icons (List icon, grid icon, Block icon) we need to display the different styles view in same view controller. Please suggest me how to make it possible.

Thanks in advance.

回答1:

As you are talking about view controllers and table view cells I assume you are not working with Xamarin Forms. This means you are creating a native iOS user interface and what you are trying to accomplish can be done with a UICollectionView. In particular you want to use the performBatchUpdates:completion: method, which allows you to animate reload and move operations.

  • Xamarin example: https://github.com/xamarin/monotouch-samples/tree/master/CircleLayout
  • Very good and comprehensive tutorial (Objective-C): https://www.objc.io/issues/12-animations/collectionview-animations/
  • There are two videos about collection views from the WWDC 12 which I suggest you too see: https://developer.apple.com/videos/wwdc2012/
  • Introduction to collection view tutorial (Swift): https://www.raywenderlich.com/78550/beginning-ios-collection-views-swift-part-1
  • Tutorial on animations while dragging collection view elements (Swift): http://nshint.io/blog/2015/07/16/uicollectionviews-now-have-easy-reordering/