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
Jonas Budelmann
12 years ago
Commit
f6c37cc33bb78d10782652023e867a73b6890732
1 parent
245d1a66
fix animated example
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
6 deletions
MasonryExamples/MasonryExamples/MASExampleAnimatedView.m
MasonryExamples/MasonryExamples/MASExampleAnimatedView.m
View file @
f6c37cc
...
...
@@ -12,6 +12,7 @@
@property
(
nonatomic
,
strong
)
NSMutableArray
*
animatableConstraints
;
@property
(
nonatomic
,
assign
)
int
padding
;
@property
(
nonatomic
,
assign
)
BOOL
animating
;
@end
...
...
@@ -80,16 +81,21 @@
-
(
void
)
didMoveToSuperview
{
[
self
layoutIfNeeded
];
[
self
startAnimatingWithInvertedInsets
:
NO
];
if
(
self
.
superview
)
{
self
.
animating
=
YES
;
[
self
animateWithInvertedInsets
:
NO
];
}
}
-
(
void
)
willMoveToSuperview
:
(
UIView
*
)
newSuperview
{
if
(
!
newSuperview
)
{
[
self
.
layer
removeAllAnimations
]
;
self
.
animating
=
NO
;
}
}
-
(
void
)
startAnimatingWithInvertedInsets
:
(
BOOL
)
invertedInsets
{
-
(
void
)
animateWithInvertedInsets
:
(
BOOL
)
invertedInsets
{
if
(
!
self
.
animating
)
return
;
int
padding
=
invertedInsets
?
100
:
self
.
padding
;
UIEdgeInsets
paddingInsets
=
UIEdgeInsetsMake
(
padding
,
padding
,
padding
,
padding
);
for
(
id
<
MASConstraint
>
constraint
in
self
.
animatableConstraints
)
{
...
...
@@ -99,9 +105,8 @@
[
UIView
animateWithDuration
:
1
animations
:
^
{
[
self
layoutIfNeeded
]
;
}
completion
:
^
(
BOOL
finished
)
{
if
(
finished
)
{
[
self
startAnimatingWithInvertedInsets
:
!
invertedInsets
]
;
}
//repeat!
[
self
animateWithInvertedInsets
:
!
invertedInsets
]
;
}];
}
...
...
Please
register
or
login
to post a comment