[[NSNotificationCenter defaultCenter] addObserverForName:@"UIWindowDidRotateNotification" object:self queue:nil usingBlock:^(NSNotification *note) {
if ([note.userInfo[@"UIWindowOldOrientationUserInfoKey"] intValue] >= ) {
self.navigationController.navigationBar.frame = (CGRect){, , self.view.frame.size.width, };
}
}];

今天在controller里加了上面的代码,发现不能controller不能释放了,不是因为没有调用

[[NSNotificationCenter defaultCenter] removeObserver:self];

即使调用了上面的代码也没用!

原来又是忘记在block中要用 weak self,不能用self,这里的问题需要仔细想一下再记下来。。。

05-10 16:49
查看更多