Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Material
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
Material
Commits
159165b9
Unverified
Commit
159165b9
authored
Sep 06, 2016
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
development: added a Divider object to a CollectionViewCell
parent
53a2c6ce
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
33 deletions
+42
-33
Sources/iOS/CollectionView.swift
+3
-3
Sources/iOS/CollectionViewCell.swift
+39
-30
No files found.
Sources/iOS/CollectionView.swift
View file @
159165b9
...
...
@@ -32,7 +32,7 @@ import UIKit
@IBDesignable
open
class
CollectionView
:
UICollectionView
{
/// A preset wrapper around contentInset.
/// A preset wrapper around contentInset.
open
var
contentEdgeInsetsPreset
:
EdgeInsets
{
get
{
return
(
collectionViewLayout
as?
CollectionViewLayout
)
!.
contentInset
...
...
@@ -121,6 +121,6 @@ open class CollectionView: UICollectionView {
open
func
prepareView
()
{
contentScaleFactor
=
Device
.
scale
backgroundColor
=
Color
.
clear
contentInset
=
UIEdgeInsets
.
zero
}
contentInset
=
.
zero
}
}
Sources/iOS/CollectionViewCell.swift
View file @
159165b9
...
...
@@ -33,12 +33,15 @@ import UIKit
@IBDesignable
@objc(CollectionViewCell)
open
class
CollectionViewCell
:
UICollectionViewCell
{
/**
A CAShapeLayer used to manage elements that would be affected by
the clipToBounds property of the backing layer. For example, this
allows the dropshadow effect on the backing layer, while clipping
the image to a desired shape within the visualLayer.
*/
/// A reference to the divider.
open
internal(set)
var
divider
:
Divider
!
/**
A CAShapeLayer used to manage elements that would be affected by
the clipToBounds property of the backing layer. For example, this
allows the dropshadow effect on the backing layer, while clipping
the image to a desired shape within the visualLayer.
*/
open
private(set)
var
visualLayer
:
CAShapeLayer
!
/// An Array of pulse layers.
...
...
@@ -54,10 +57,10 @@ open class CollectionViewCell: UICollectionViewCell {
open
var
pulseAnimation
=
PulseAnimation
.
pointWithBacking
/**
A property that manages an image for the visualLayer's contents
property. Images should not be set to the backing layer's contents
property to avoid conflicts when using clipsToBounds.
*/
A property that manages an image for the visualLayer's contents
property. Images should not be set to the backing layer's contents
property to avoid conflicts when using clipsToBounds.
*/
@IBInspectable
open
var
image
:
UIImage
?
{
didSet
{
...
...
@@ -66,11 +69,11 @@ open class CollectionViewCell: UICollectionViewCell {
}
/**
Allows a relative subrectangle within the range of 0 to 1 to be
specified for the visualLayer's contents property. This allows
much greater flexibility than the contentsGravity property in
terms of how the image is cropped and stretched.
*/
Allows a relative subrectangle within the range of 0 to 1 to be
specified for the visualLayer's contents property. This allows
much greater flexibility than the contentsGravity property in
terms of how the image is cropped and stretched.
*/
@IBInspectable
open
var
contentsRect
:
CGRect
{
get
{
...
...
@@ -82,9 +85,9 @@ open class CollectionViewCell: UICollectionViewCell {
}
/**
A CGRect that defines a stretchable region inside the visualLayer
with a fixed border around the edge.
*/
A CGRect that defines a stretchable region inside the visualLayer
with a fixed border around the edge.
*/
@IBInspectable
open
var
contentsCenter
:
CGRect
{
get
{
...
...
@@ -96,10 +99,10 @@ open class CollectionViewCell: UICollectionViewCell {
}
/**
A floating point value that defines a ratio between the pixel
dimensions of the visualLayer's contents property and the size
of the view. By default, this value is set to the Device.scale.
*/
A floating point value that defines a ratio between the pixel
dimensions of the visualLayer's contents property and the size
of the view. By default, this value is set to the Device.scale.
*/
@IBInspectable
open
var
contentsScale
:
CGFloat
{
get
{
...
...
@@ -176,9 +179,9 @@ open class CollectionViewCell: UICollectionViewCell {
}
/**
An initializer that initializes the object with a NSCoder object.
- Parameter aDecoder: A NSCoder instance.
*/
An initializer that initializes the object with a NSCoder object.
- Parameter aDecoder: A NSCoder instance.
*/
public
required
init
?(
coder
aDecoder
:
NSCoder
)
{
contentsGravityPreset
=
.
ResizeAspectFill
super
.
init
(
coder
:
aDecoder
)
...
...
@@ -186,11 +189,11 @@ open class CollectionViewCell: UICollectionViewCell {
}
/**
An initializer that initializes the object with a CGRect object.
If AutoLayout is used, it is better to initilize the instance
using the init() initializer.
- Parameter frame: A CGRect instance.
*/
An initializer that initializes the object with a CGRect object.
If AutoLayout is used, it is better to initilize the instance
using the init() initializer.
- Parameter frame: A CGRect instance.
*/
public
override
init
(
frame
:
CGRect
)
{
contentsGravityPreset
=
.
ResizeAspectFill
super
.
init
(
frame
:
frame
)
...
...
@@ -274,6 +277,7 @@ open class CollectionViewCell: UICollectionViewCell {
open
func
prepareView
()
{
contentScaleFactor
=
Device
.
scale
prepareVisualLayer
()
prepareDivider
()
}
/// Prepares the visualLayer property.
...
...
@@ -289,4 +293,9 @@ open class CollectionViewCell: UICollectionViewCell {
visualLayer
.
frame
=
bounds
visualLayer
.
cornerRadius
=
cornerRadius
}
/// Prepares the divider.
private
func
prepareDivider
()
{
divider
=
Divider
(
view
:
self
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment