File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change 10
10
11
11
static NSInteger const kCSNotificationViewEmptySymbolViewTag = 666 ;
12
12
13
+ static NSString * const kCSNotificationViewUINavigationControllerWillShowViewControllerNotification = @" UINavigationControllerWillShowViewControllerNotification" ;
14
+
13
15
@interface CSNotificationView ()
14
16
15
17
#pragma mark - blur effect
@@ -126,6 +128,11 @@ - (instancetype)initWithParentViewController:(UIViewController*)viewController
126
128
127
129
}
128
130
131
+ // Notifications
132
+ {
133
+ [[NSNotificationCenter defaultCenter ] addObserver: self selector: @selector (navigationControllerWillShowViewControllerNotification: ) name: kCSNotificationViewUINavigationControllerWillShowViewControllerNotification object: nil ];
134
+ }
135
+
129
136
// Content views
130
137
{
131
138
// textLabel
@@ -155,6 +162,26 @@ - (instancetype)initWithParentViewController:(UIViewController*)viewController
155
162
return self;
156
163
}
157
164
165
+ - (void )dealloc
166
+ {
167
+ [[NSNotificationCenter defaultCenter ] removeObserver: self name: kCSNotificationViewUINavigationControllerWillShowViewControllerNotification object: nil ];
168
+ }
169
+
170
+ - (void )navigationControllerWillShowViewControllerNotification : (NSNotification *)note
171
+ {
172
+ if (self.visible && [self .parentNavigationController isEqual: note.object]) {
173
+
174
+ __block typeof (self) weakself = self;
175
+ [UIView animateWithDuration: 0.1 animations: ^{
176
+ CGRect endFrame;
177
+ [weakself animationFramesForVisible: weakself.visible startFrame: nil endFrame: &endFrame];
178
+ [weakself setFrame: endFrame];
179
+ [weakself updateConstraints ];
180
+ }];
181
+
182
+ }
183
+ }
184
+
158
185
#pragma mark - layout
159
186
160
187
- (void )updateConstraints
You can’t perform that action at this time.
0 commit comments