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
Nikolay Tymchenko
11 years ago
Commit
d656dddaa91025bc7e3653bff5184a24c8361bd8
1 parent
2438fe90
Added an actual implementation for mas_ relation methods
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
11 deletions
Masonry/MASConstraint.h
Masonry/MASConstraint.m
Masonry/MASConstraint.h
View file @
d656ddd
...
...
@@ -192,11 +192,16 @@
@interface
MASConstraint
(
AutoboxingSupport
)
/**
* Dummy methods to aid autocompletion
* Aliases to corresponding relation methods (for shorthand macros)
* Also needed to aid autocompletion
*/
-
(
MASConstraint
*
(
^
)(
id
attr
))
mas_equalTo
;
-
(
MASConstraint
*
(
^
)(
id
attr
))
mas_greaterThanOrEqualTo
;
-
(
MASConstraint
*
(
^
)(
id
attr
))
mas_lessThanOrEqualTo
;
/**
* A dummy method to aid autocompletion
*/
-
(
MASConstraint
*
(
^
)(
id
offset
))
mas_offset
;
@end
\ No newline at end of file
...
...
Masonry/MASConstraint.m
View file @
d656ddd
...
...
@@ -30,18 +30,36 @@
};
}
-
(
MASConstraint
*
(
^
)(
id
))
mas_equalTo
{
return
^
id
(
id
attribute
)
{
return
self
.
equalToWithRelation
(
attribute
,
NSLayoutRelationEqual
);
};
}
-
(
MASConstraint
*
(
^
)(
id
))
greaterThanOrEqualTo
{
return
^
id
(
id
attribute
)
{
return
self
.
equalToWithRelation
(
attribute
,
NSLayoutRelationGreaterThanOrEqual
);
};
}
-
(
MASConstraint
*
(
^
)(
id
))
mas_greaterThanOrEqualTo
{
return
^
id
(
id
attribute
)
{
return
self
.
equalToWithRelation
(
attribute
,
NSLayoutRelationGreaterThanOrEqual
);
};
}
-
(
MASConstraint
*
(
^
)(
id
))
lessThanOrEqualTo
{
return
^
id
(
id
attribute
)
{
return
self
.
equalToWithRelation
(
attribute
,
NSLayoutRelationLessThanOrEqual
);
};
}
-
(
MASConstraint
*
(
^
)(
id
))
mas_lessThanOrEqualTo
{
return
^
id
(
id
attribute
)
{
return
self
.
equalToWithRelation
(
attribute
,
NSLayoutRelationLessThanOrEqual
);
};
}
#pragma mark - MASLayoutPriority proxies
-
(
MASConstraint
*
(
^
)())
priorityLow
{
...
...
@@ -103,6 +121,11 @@
};
}
-
(
MASConstraint
*
(
^
)(
id
offset
))
mas_offset
{
// Will never be called due to macro
return
nil
;
}
#pragma mark - NSLayoutConstraint constant setter
-
(
void
)
setLayoutConstantWithValue
:
(
NSValue
*
)
value
{
...
...
@@ -131,16 +154,6 @@
return
self
;
}
#pragma mark - Autocompletion dummies
-
(
MASConstraint
*
(
^
)(
id
attr
))
mas_equalTo
{
return
nil
;
}
-
(
MASConstraint
*
(
^
)(
id
attr
))
mas_greaterThanOrEqualTo
{
return
nil
;
}
-
(
MASConstraint
*
(
^
)(
id
attr
))
mas_lessThanOrEqualTo
{
return
nil
;
}
-
(
MASConstraint
*
(
^
)(
id
offset
))
mas_offset
{
return
nil
;
}
#pragma mark - Abstract
-
(
MASConstraint
*
(
^
)(
CGFloat
multiplier
))
multipliedBy
{
methodNotImplemented
();
}
...
...
Please
register
or
login
to post a comment