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
2cf22518e8bc582f8abe86e99b82abcb87009f9c
1 parent
9e9017cf
support safeAreaLayoutGuide
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
6 deletions
Masonry/MASViewConstraint.m
Masonry/View+MASAdditions.h
Masonry/View+MASAdditions.m
Masonry/MASViewConstraint.m
View file @
2cf2251
...
...
@@ -125,7 +125,12 @@ static char kInstalledConstraintsKey;
}
else
if
([
secondViewAttribute
isKindOfClass
:
MAS_VIEW
.
class
])
{
_secondViewAttribute
=
[[
MASViewAttribute
alloc
]
initWithView
:
secondViewAttribute
layoutAttribute
:
self
.
firstViewAttribute
.
layoutAttribute
];
}
else
if
([
secondViewAttribute
isKindOfClass
:
MASViewAttribute
.
class
])
{
_secondViewAttribute
=
secondViewAttribute
;
MASViewAttribute
*
attr
=
secondViewAttribute
;
if
(
attr
.
layoutAttribute
==
NSLayoutAttributeNotAnAttribute
)
{
_secondViewAttribute
=
[[
MASViewAttribute
alloc
]
initWithView
:
attr
.
view
item
:
attr
.
item
layoutAttribute
:
self
.
firstViewAttribute
.
layoutAttribute
];;
}
else
{
_secondViewAttribute
=
secondViewAttribute
;
}
}
else
{
NSAssert
(
NO
,
@"attempting to add unsupported attribute: %@"
,
secondViewAttribute
);
}
...
...
Masonry/View+MASAdditions.h
View file @
2cf2251
...
...
@@ -54,11 +54,24 @@
#if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) || (__TV_OS_VERSION_MIN_REQUIRED >= 110000)
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaLayoutGuide
;
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaLayoutGuideTop
;
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaLayoutGuideBottom
;
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaLayoutGuideLeft
;
@property
(
nonatomic
,
strong
,
readonly
)
MASViewAttribute
*
mas_safeAreaLayoutGuideRight
;
@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
;
#endif
...
...
Masonry/View+MASAdditions.m
View file @
2cf2251
...
...
@@ -136,6 +136,54 @@
#if (__IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) || (__TV_OS_VERSION_MIN_REQUIRED >= 110000)
#pragma mark - safeAreaLayoutGuide
-
(
MASViewAttribute
*
)
mas_safeArea
{
return
[[
MASViewAttribute
alloc
]
initWithView
:
self
item
:
self
.
safeAreaLayoutGuide
layoutAttribute
:
NSLayoutAttributeNotAnAttribute
];
}
-
(
MASViewAttribute
*
)
mas_safeAreaLeading
{
return
[[
MASViewAttribute
alloc
]
initWithView
:
self
item
:
self
.
safeAreaLayoutGuide
layoutAttribute
:
NSLayoutAttributeLeading
];
}
-
(
MASViewAttribute
*
)
mas_safeAreaTrailing
{
return
[[
MASViewAttribute
alloc
]
initWithView
:
self
item
:
self
.
safeAreaLayoutGuide
layoutAttribute
:
NSLayoutAttributeTrailing
];
}
-
(
MASViewAttribute
*
)
mas_safeAreaLeft
{
return
[[
MASViewAttribute
alloc
]
initWithView
:
self
item
:
self
.
safeAreaLayoutGuide
layoutAttribute
:
NSLayoutAttributeLeft
];
}
-
(
MASViewAttribute
*
)
mas_safeAreaRight
{
return
[[
MASViewAttribute
alloc
]
initWithView
:
self
item
:
self
.
safeAreaLayoutGuide
layoutAttribute
:
NSLayoutAttributeRight
];
}
-
(
MASViewAttribute
*
)
mas_safeAreaTop
{
return
[[
MASViewAttribute
alloc
]
initWithView
:
self
item
:
self
.
safeAreaLayoutGuide
layoutAttribute
:
NSLayoutAttributeTop
];
}
-
(
MASViewAttribute
*
)
mas_safeAreaBottom
{
return
[[
MASViewAttribute
alloc
]
initWithView
:
self
item
:
self
.
safeAreaLayoutGuide
layoutAttribute
:
NSLayoutAttributeBottom
];
}
-
(
MASViewAttribute
*
)
mas_safeAreaWidth
{
return
[[
MASViewAttribute
alloc
]
initWithView
:
self
item
:
self
.
safeAreaLayoutGuide
layoutAttribute
:
NSLayoutAttributeWidth
];
}
-
(
MASViewAttribute
*
)
mas_safeAreaHeight
{
return
[[
MASViewAttribute
alloc
]
initWithView
:
self
item
:
self
.
safeAreaLayoutGuide
layoutAttribute
:
NSLayoutAttributeHeight
];
}
-
(
MASViewAttribute
*
)
mas_safeAreaCenterX
{
return
[[
MASViewAttribute
alloc
]
initWithView
:
self
item
:
self
.
safeAreaLayoutGuide
layoutAttribute
:
NSLayoutAttributeCenterX
];
}
-
(
MASViewAttribute
*
)
mas_safeAreaCenterY
{
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
];
}
...
...
Please
register
or
login
to post a comment