Toggle navigation
Toggle navigation
This project
Loading...
Sign in
ios
/
Masonry
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
iwill
8 years ago
Commit
53a095b89a57256cb0d76a698d1942e351f2a4cd
1 parent
a2f1d063
support safeAreaLayoutGuide - rename
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
68 deletions
Examples/Masonry iOS Examples/MASExampleSafeAreaLayoutGuideViewController.m
Masonry/View+MASAdditions.h
Masonry/View+MASAdditions.m
Examples/Masonry iOS Examples/MASExampleSafeAreaLayoutGuideViewController.m
View file @
53a095b
...
...
@@ -54,66 +54,66 @@
const
CGFloat
size
=
50
.
0
;
[
view1
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
edges
.
equalTo
(
self
.
view
.
mas_safeArea
).
inset
(
10
.
0
)
;
make
.
edges
.
equalTo
(
self
.
view
.
mas_safeArea
LayoutGuide
).
inset
(
10
.
0
)
;
}];
[
view2
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
center
.
equalTo
(
self
.
view
.
mas_safeArea
)
;
make
.
width
.
height
.
equalTo
(
self
.
view
.
mas_safeArea
).
sizeOffset
(
CGSizeMake
(
-
40
.
0
,
-
40
.
0
))
;
make
.
center
.
equalTo
(
self
.
view
.
mas_safeAreaLayoutGuide
)
;
make
.
width
.
height
.
equalTo
(
self
.
view
.
mas_safeAreaLayoutGuide
).
sizeOffset
(
CGSizeMake
(
-
40
.
0
,
-
40
.
0
))
;
}];
[
view3
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
center
.
equalTo
(
self
.
view
.
mas_safeArea
)
;
make
.
width
.
equalTo
(
self
.
view
.
mas_safeArea
).
sizeOffset
(
CGSizeMake
(
-
60
.
0
,
-
60
.
0
))
;
make
.
height
.
equalTo
(
self
.
view
.
mas_safeArea
).
sizeOffset
(
CGSizeMake
(
-
60
.
0
,
-
60
.
0
))
;
make
.
center
.
equalTo
(
self
.
view
.
mas_safeAreaLayoutGuide
)
;
make
.
width
.
equalTo
(
self
.
view
.
mas_safeAreaLayoutGuide
).
sizeOffset
(
CGSizeMake
(
-
60
.
0
,
-
60
.
0
))
;
make
.
height
.
equalTo
(
self
.
view
.
mas_safeAreaLayoutGuide
).
sizeOffset
(
CGSizeMake
(
-
60
.
0
,
-
60
.
0
))
;
}];
[
leftTopView
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
top
.
equalTo
(
self
.
view
.
mas_safeArea
)
;
make
.
left
.
top
.
equalTo
(
self
.
view
.
mas_safeArea
LayoutGuide
)
;
make
.
width
.
height
.
equalTo
(
@
(
size
))
;
}];
[
rightTopView
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
right
.
equalTo
(
self
.
view
.
mas_safeAreaRight
)
;
make
.
top
.
equalTo
(
self
.
view
.
mas_safeAreaTop
)
;
make
.
right
.
equalTo
(
self
.
view
.
mas_safeAreaLayoutGuideRight
)
;
make
.
top
.
equalTo
(
self
.
view
.
mas_safeAreaLayoutGuideTop
)
;
make
.
width
.
height
.
equalTo
(
@
(
size
))
;
}];
[
leftBottomView
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
equalTo
(
self
.
view
.
mas_safeAreaLeft
)
;
make
.
bottom
.
equalTo
(
self
.
view
.
mas_safeAreaBottom
)
;
make
.
left
.
equalTo
(
self
.
view
.
mas_safeAreaLayoutGuideLeft
)
;
make
.
bottom
.
equalTo
(
self
.
view
.
mas_safeAreaLayoutGuideBottom
)
;
make
.
width
.
height
.
equalTo
(
@
(
size
))
;
}];
[
rightBottomView
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
right
.
bottom
.
equalTo
(
self
.
view
.
mas_safeArea
)
;
make
.
right
.
bottom
.
equalTo
(
self
.
view
.
mas_safeArea
LayoutGuide
)
;
make
.
width
.
height
.
equalTo
(
@
(
size
))
;
}];
[
leftView
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
centerY
.
equalTo
(
self
.
view
.
mas_safeArea
)
;
make
.
left
.
centerY
.
equalTo
(
self
.
view
.
mas_safeArea
LayoutGuide
)
;
make
.
width
.
height
.
equalTo
(
@
(
size
))
;
}];
[
rightView
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
right
.
equalTo
(
self
.
view
.
mas_safeAreaRight
)
;
make
.
centerY
.
equalTo
(
self
.
view
.
mas_safeAreaCenterY
)
;
make
.
right
.
equalTo
(
self
.
view
.
mas_safeAreaLayoutGuideRight
)
;
make
.
centerY
.
equalTo
(
self
.
view
.
mas_safeAreaLayoutGuideCenterY
)
;
make
.
width
.
height
.
equalTo
(
@
(
size
))
;
}];
[
topView
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
equalTo
(
self
.
view
.
mas_safeAreaTop
)
;
make
.
centerX
.
equalTo
(
self
.
view
.
mas_safeAreaCenterX
)
;
make
.
top
.
equalTo
(
self
.
view
.
mas_safeAreaLayoutGuideTop
)
;
make
.
centerX
.
equalTo
(
self
.
view
.
mas_safeAreaLayoutGuideCenterX
)
;
make
.
width
.
height
.
equalTo
(
@
(
size
))
;
}];
[
bottomView
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
bottom
.
centerX
.
equalTo
(
self
.
view
.
mas_safeArea
)
;
make
.
bottom
.
centerX
.
equalTo
(
self
.
view
.
mas_safeArea
LayoutGuide
)
;
make
.
width
.
height
.
equalTo
(
@
(
size
))
;
}];
[
centerView
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
center
.
equalTo
(
self
.
view
.
mas_safeArea
)
;
make
.
center
.
equalTo
(
self
.
view
.
mas_safeArea
LayoutGuide
)
;
make
.
width
.
height
.
equalTo
(
@
(
size
))
;
}];
}
...
...
Masonry/View+MASAdditions.h
View file @
53a095b
...
...
@@ -54,24 +54,18 @@
#if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) || (__TV_OS_VERSION_MIN_REQUIRED >= 110000)
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeArea
;
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaLeading
;
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaTrailing
;
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaLeft
;
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaRight
;
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaTop
;
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaBottom
;
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaWidth
;
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaHeight
;
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaCenterX
;
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaCenterY
;
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaLayoutGuide
DEPRECATED_ATTRIBUTE
;
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaLayoutGuideTop
DEPRECATED_ATTRIBUTE
;
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaLayoutGuideBottom
DEPRECATED_ATTRIBUTE
;
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaLayoutGuideLeft
DEPRECATED_ATTRIBUTE
;
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaLayoutGuideRight
DEPRECATED_ATTRIBUTE
;
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaLayoutGuide
;
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaLayoutGuideLeading
;
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaLayoutGuideTrailing
;
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaLayoutGuideLeft
;
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaLayoutGuideRight
;
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaLayoutGuideTop
;
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaLayoutGuideBottom
;
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaLayoutGuideWidth
;
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaLayoutGuideHeight
;
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaLayoutGuideCenterX
;
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaLayoutGuideCenterY
;
#endif
...
...
Masonry/View+MASAdditions.m
View file @
53a095b
...
...
@@ -136,70 +136,50 @@
#if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) || (__TV_OS_VERSION_MIN_REQUIRED >= 110000)
#pragma mark - safeAreaLayoutGuide
-
(
MASViewAttribute
*
)
mas_safeArea
{
-
(
MASViewAttribute
*
)
mas_safeAreaLayoutGuide
{
return
[[
MASViewAttribute
alloc
]
initWithView
:
self
item
:
self
.
safeAreaLayoutGuide
layoutAttribute
:
NSLayoutAttributeNotAnAttribute
];
}
-
(
MASViewAttribute
*
)
mas_safeAreaLeading
{
-
(
MASViewAttribute
*
)
mas_safeAreaL
ayoutGuideL
eading
{
return
[[
MASViewAttribute
alloc
]
initWithView
:
self
item
:
self
.
safeAreaLayoutGuide
layoutAttribute
:
NSLayoutAttributeLeading
];
}
-
(
MASViewAttribute
*
)
mas_safeAreaTrailing
{
-
(
MASViewAttribute
*
)
mas_safeArea
LayoutGuide
Trailing
{
return
[[
MASViewAttribute
alloc
]
initWithView
:
self
item
:
self
.
safeAreaLayoutGuide
layoutAttribute
:
NSLayoutAttributeTrailing
];
}
-
(
MASViewAttribute
*
)
mas_safeAreaLeft
{
-
(
MASViewAttribute
*
)
mas_safeAreaL
ayoutGuideL
eft
{
return
[[
MASViewAttribute
alloc
]
initWithView
:
self
item
:
self
.
safeAreaLayoutGuide
layoutAttribute
:
NSLayoutAttributeLeft
];
}
-
(
MASViewAttribute
*
)
mas_safeAreaRight
{
-
(
MASViewAttribute
*
)
mas_safeArea
LayoutGuide
Right
{
return
[[
MASViewAttribute
alloc
]
initWithView
:
self
item
:
self
.
safeAreaLayoutGuide
layoutAttribute
:
NSLayoutAttributeRight
];
}
-
(
MASViewAttribute
*
)
mas_safeAreaTop
{
-
(
MASViewAttribute
*
)
mas_safeArea
LayoutGuide
Top
{
return
[[
MASViewAttribute
alloc
]
initWithView
:
self
item
:
self
.
safeAreaLayoutGuide
layoutAttribute
:
NSLayoutAttributeTop
];
}
-
(
MASViewAttribute
*
)
mas_safeAreaBottom
{
-
(
MASViewAttribute
*
)
mas_safeArea
LayoutGuide
Bottom
{
return
[[
MASViewAttribute
alloc
]
initWithView
:
self
item
:
self
.
safeAreaLayoutGuide
layoutAttribute
:
NSLayoutAttributeBottom
];
}
-
(
MASViewAttribute
*
)
mas_safeAreaWidth
{
-
(
MASViewAttribute
*
)
mas_safeArea
LayoutGuide
Width
{
return
[[
MASViewAttribute
alloc
]
initWithView
:
self
item
:
self
.
safeAreaLayoutGuide
layoutAttribute
:
NSLayoutAttributeWidth
];
}
-
(
MASViewAttribute
*
)
mas_safeAreaHeight
{
-
(
MASViewAttribute
*
)
mas_safeArea
LayoutGuide
Height
{
return
[[
MASViewAttribute
alloc
]
initWithView
:
self
item
:
self
.
safeAreaLayoutGuide
layoutAttribute
:
NSLayoutAttributeHeight
];
}
-
(
MASViewAttribute
*
)
mas_safeAreaCenterX
{
-
(
MASViewAttribute
*
)
mas_safeArea
LayoutGuide
CenterX
{
return
[[
MASViewAttribute
alloc
]
initWithView
:
self
item
:
self
.
safeAreaLayoutGuide
layoutAttribute
:
NSLayoutAttributeCenterX
];
}
-
(
MASViewAttribute
*
)
mas_safeAreaCenterY
{
-
(
MASViewAttribute
*
)
mas_safeArea
LayoutGuide
CenterY
{
return
[[
MASViewAttribute
alloc
]
initWithView
:
self
item
:
self
.
safeAreaLayoutGuide
layoutAttribute
:
NSLayoutAttributeCenterY
];
}
#pragma mark - DEPRECATED
-
(
MASViewAttribute
*
)
mas_safeAreaLayoutGuide
{
return
[[
MASViewAttribute
alloc
]
initWithView
:
self
item
:
self
.
safeAreaLayoutGuide
layoutAttribute
:
NSLayoutAttributeBottom
];
}
-
(
MASViewAttribute
*
)
mas_safeAreaLayoutGuideTop
{
return
[[
MASViewAttribute
alloc
]
initWithView
:
self
item
:
self
.
safeAreaLayoutGuide
layoutAttribute
:
NSLayoutAttributeTop
];
}
-
(
MASViewAttribute
*
)
mas_safeAreaLayoutGuideBottom
{
return
[[
MASViewAttribute
alloc
]
initWithView
:
self
item
:
self
.
safeAreaLayoutGuide
layoutAttribute
:
NSLayoutAttributeBottom
];
}
-
(
MASViewAttribute
*
)
mas_safeAreaLayoutGuideLeft
{
return
[[
MASViewAttribute
alloc
]
initWithView
:
self
item
:
self
.
safeAreaLayoutGuide
layoutAttribute
:
NSLayoutAttributeLeft
];
}
-
(
MASViewAttribute
*
)
mas_safeAreaLayoutGuideRight
{
return
[[
MASViewAttribute
alloc
]
initWithView
:
self
item
:
self
.
safeAreaLayoutGuide
layoutAttribute
:
NSLayoutAttributeRight
];
}
#endif
#pragma mark - associated properties
...
...
Please
register
or
login
to post a comment