<p align="center">
<img src="https://cdn.rawgit.com/yacir/CollectionViewSlantedLayout/3b5e08c1/Resources/SlantedLayout.svg" alt="CollectionViewSlantedLayout" title="CollectionViewSlantedLayout" width="700"/>
</p>
<p align="center">
<img src="https://img.shields.io/badge/Swift-4.2-orange.svg" alt="Swift 4.2"/>
<a href="https://cocoapods.org/pods/CollectionViewSlantedLayout">
<img src="https://img.shields.io/cocoapods/v/CollectionViewSlantedLayout.svg?style=flat)"/>
</a>
<img src="https://img.shields.io/badge/SPM-✔-blue.svg" alt="SMP ready"/>
<img src="https://img.shields.io/badge/Carthage-✔-blue.svg" alt="Carthage compatible"/>
<img src="https://img.shields.io/cocoapods/p/YBSlantedCollectionViewLayout.svg?style=flat"/>
<img src="https://img.shields.io/cocoapods/l/YBSlantedCollectionViewLayout.svg?style=flat"/>
<br/>
<a href="https://travis-ci.org/yacir/CollectionViewSlantedLayout">
<img src="https://travis-ci.org/yacir/CollectionViewSlantedLayout.svg?branch=master"/>
</a>
<a href="https://travis-ci.org/yacir/CollectionViewSlantedLayout">
<img src="https://codecov.io/gh/yacir/CollectionViewSlantedLayout/branch/master/graph/badge.svg"/>
</a>
<a href="https://www.codacy.com/app/yacir/CollectionViewSlantedLayout?utm_source=github.com&utm_medium=referral&utm_content=yacir/CollectionViewSlantedLayout&utm_campaign=Badge_Grade">
<img alt="codacy badge" src="https://api.codacy.com/project/badge/Grade/e5ae5581b13245199eb7c39cf178adea" />
</a>
<a href="http://clayallsopp.github.io/readme-score?url=yacir%2Fcollectionviewslantedlayout">
<img alt="Score Me" src="https://img.shields.io/badge/dynamic/json.svg?label=ScoreMe&colorB=62c87a&prefix=&suffix=&query=$.score&uri=http%3A%2F%2Freadme-score-api.herokuapp.com%2Fscore.json%3Furl%3Dyacir%2FCollectionViewSlantedLayout" />
</a>
</p>
**CollectionViewSlantedLayout** is a subclass of the [UICollectionViewLayout](https://developer.apple.com/documentation/uikit/uicollectionviewlayout) allowing the display of slanted cells in a [UICollectionView](https://developer.apple.com/documentation/uikit/uicollectionview).
<p align="center">
<img src="https://user-images.githubusercontent.com/2587473/34458447-9f434c8a-edd3-11e7-98b7-f32b4284268d.gif" alt="CollectionViewSlantedLayout" title="CollectionViewSlantedLayout">
</p>
## Features
- [x] Pure Swift 4.
- [x] Works with every UICollectionView.
- [x] Horizontal and vertical scrolling support.
- [x] Dynamic cells height
- [x] Fully Configurable
## Installation
### CocoaPods
CollectionViewSlantedLayout is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:
```ruby
use_frameworks!
pod 'CollectionViewSlantedLayout', '~> 3.1'
```
### Carthage
You can also install it via [Carthage](https://github.com/Carthage/Carthage). To do so, add the following to your Cartfile:
```terminal
github 'yacir/CollectionViewSlantedLayout'
```
## Usage
1. Import `CollectionViewSlantedLayout ` module to your controller
```swift
import CollectionViewSlantedLayout
```
2. Create an instance and add it to your `UICollectionView`.
```swift
let slantedSayout = CollectionViewSlantedLayout()
UICollectionView(frame: .zero, collectionViewLayout: slantedSayout)
```
3. Use the `CollectionViewSlantedCell` class for your cells or subclass it.
Find a demo in the Examples folder.
## Properties
- **slantingSize**:
```swift
@IBInspectable var slantingSize: UInt
```
The slanting size. The default value of this property is `75`.
- **slantingDirection**:
```swift
var slantingDirection: SlantingDirection
```
The slanting direction. The default value of this property is `upward`.
- **slantingAngle**:
```swift
fileprivate(set) var slantingAngle: CGFloat
```
The angle, in radians, of the slanting. The value of this property could be used to apply a rotation transform on the cell's contentView in the `collectionView(_:cellForItemAt:)` method implementation.
```swift
if let layout = collectionView.collectionViewLayout as? CollectionViewSlantedLayout {
cell.contentView.transform = CGAffineTransform(rotationAngle: layout.rotationAngle)
}
```
- **scrollDirection**:
```swift
var scrollDirection: UICollectionViewScrollDirection
```
The scroll direction of the grid. The grid layout scrolls along one axis only, either horizontally or vertically. The default value of this property is `vertical`.
- **isFirstCellExcluded**:
```swift
@IBInspectable var isFirstCellExcluded: Bool
```
Set it to `true` to disable the slanting for the first cell. The default value of this property is `false`.
- **isLastCellExcluded**:
```swift
@IBInspectable var isLastCellExcluded: Bool
```
Set it to `true` to disable the slanting for the last cell. The default value of this property is `false`.
- **lineSpacing**:
```swift
@IBInspectable var lineSpacing: CGFloat
```
The spacing to use between two items. The default value of this property is `10.0`.
- **itemSize**:
```swift
@IBInspectable var itemSize: CGFloat
```
The default size to use for cells. If the delegate does not implement the `collectionView(_:layout:sizeForItemAt:)` method, the slanted layout uses the value in this property to set the size of each cell. This results in cells that all have the same size. The default value of this property is `225`.
- **zIndexOrder**:
```swift
var zIndexOrder: ZIndexOrder
```
The zIndex order of the items in the layout. The default value of this property is `ascending`.
## Protocols
The `CollectionViewDelegateSlantedLayout` protocol defines methods that let you coordinate with a `CollectionViewSlantedLayout` object to implement a slanted layout. The `CollectionViewDelegateSlantedLayout` protocol has the following methods:
```swift
optional func collectionView(_ collectionView: UICollectionView,
layout collectionViewLayout: CollectionViewSlantedLayout,
sizeForItemAt indexPath: IndexPath) -> CGFloat
```
This method asks the delegate for the size of the specified item’s cell.
If you do not implement this method, the slanted layout uses the values in its `itemSize` property to set the size of items instead. Your implementation of this method can return a fixed set of sizes or dynamically adjust the sizes based on the cell’s content.
## Author
[Yassir Barchi](https://yassir.fr)
## Acknowledgement
This framework is inspired by [this prototype](https://dribbble.com/shots/1727594-Slanted-Table-Cells-With-Parallax?_=1456679145403) released by [Matt Bridges](https://dribbble.com/rrridges).
## License
**CollectionViewSlantedLayout** is available under the MIT license. See the LICENSE file for more info.
没有合适的资源?快使用搜索试试~ 我知道了~
iOS-Cell倾斜的效果-26CollectionViewSlantedLayout
共79个文件
swift:13个
plist:11个
json:11个
需积分: 0 0 下载量 44 浏览量
2023-05-20
18:51:15
上传
评论
收藏 2.4MB ZIP 举报
温馨提示
iOS_Cell倾斜的效果_26CollectionViewSlantedLayout
资源推荐
资源详情
资源评论
收起资源包目录
iOS_Cell倾斜的效果_26CollectionViewSlantedLayout.zip (79个子文件)
iOS_Cell倾斜的效果_26CollectionViewSlantedLayout
.DS_Store 8KB
DemoApp.xcworkspace
xcshareddata
swiftpm
configuration
IDEWorkspaceChecks.plist 238B
contents.xcworkspacedata 225B
xcuserdata
edy.xcuserdatad
UserInterfaceState.xcuserstate 26KB
fazhanli.xcuserdatad
UserInterfaceState.xcuserstate 49KB
xcdebugger
Breakpoints_v2.xcbkptlist 140B
Podfile 152B
DemoApp.xcodeproj
project.pbxproj 17KB
xcuserdata
edy.xcuserdatad
xcschemes
xcschememanagement.plist 342B
fazhanli.xcuserdatad
xcschemes
xcschememanagement.plist 342B
project.xcworkspace
xcshareddata
IDEWorkspaceChecks.plist 238B
contents.xcworkspacedata 135B
xcuserdata
fazhanli.xcuserdatad
UserInterfaceState.xcuserstate 5KB
DemoApp
CustomCollectionCell.swift 2KB
Main.storyboard 10KB
Base.lproj
LaunchScreen.storyboard 2KB
covers.plist 1KB
SceneDelegate.swift 2KB
AppDelegate.swift 1KB
ViewController.swift 5KB
Info.plist 2KB
Assets.xcassets
8.imageset
Contents.json 299B
8.jpg 282KB
4.imageset
Contents.json 299B
4.jpg 186KB
Contents.json 63B
6.imageset
6.jpg 301KB
Contents.json 299B
1.imageset
Contents.json 299B
1.jpg 397KB
AppIcon.appiconset
Contents.json 2KB
5.imageset
Contents.json 299B
5.jpg 428KB
2.imageset
2.jpg 354KB
Contents.json 299B
3.imageset
Contents.json 299B
3.jpg 259KB
AccentColor.colorset
Contents.json 123B
7.imageset
Contents.json 299B
7.jpg 210KB
Pods
Pods.xcodeproj
project.pbxproj 33KB
xcuserdata
edy.xcuserdatad
xcschemes
xcschememanagement.plist 476B
fazhanli.xcuserdatad
xcschemes
Pods-DemoApp.xcscheme 2KB
xcschememanagement.plist 571B
CollectionViewSlantedLayout.xcscheme 2KB
.DS_Store 6KB
Manifest.lock 349B
CollectionViewSlantedLayout
LICENSE 1KB
Sources
Internal
CollectionViewSlantedLayoutAttributes.swift 2KB
CollectionViewSlantedMasks.swift 7KB
CollectionViewSlantedCell.swift 2KB
CollectionViewSlantedLayout+Constants.swift 2KB
Extensions
CAShapeLayer+Helpers.swift 2KB
UICollectionView+Helpers.swift 1KB
UICollectionViewLayout+Helpers.swift 2KB
CollectionViewDelegateSlantedLayout.swift 2KB
CollectionViewSlantedLayout.swift 10KB
CollectionViewSlantedLayout.h 1KB
README.md 7KB
Local Podspecs
Headers
Target Support Files
Pods-DemoApp
Pods-DemoApp-frameworks.sh 8KB
Pods-DemoApp-frameworks-Release-output-files.xcfilelist 83B
Pods-DemoApp-acknowledgements.plist 2KB
Pods-DemoApp-dummy.m 128B
Pods-DemoApp-frameworks-Release-input-files.xcfilelist 161B
Pods-DemoApp-Info.plist 828B
Pods-DemoApp-frameworks-Debug-input-files.xcfilelist 161B
Pods-DemoApp.modulemap 114B
Pods-DemoApp-frameworks-Debug-output-files.xcfilelist 83B
Pods-DemoApp-acknowledgements.markdown 1KB
Pods-DemoApp.debug.xcconfig 760B
Pods-DemoApp-umbrella.h 316B
Pods-DemoApp.release.xcconfig 760B
CollectionViewSlantedLayout
CollectionViewSlantedLayout-umbrella.h 386B
CollectionViewSlantedLayout.modulemap 144B
CollectionViewSlantedLayout.xcconfig 539B
CollectionViewSlantedLayout-prefix.pch 195B
CollectionViewSlantedLayout-Info.plist 828B
CollectionViewSlantedLayout-dummy.m 158B
Podfile.lock 349B
共 79 条
- 1
资源评论
GotoLevel
- 粉丝: 23
- 资源: 37
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功