| | |
| | | } |
| | | |
| | | func setRx(){ |
| | | NotificationCenter.default.rx.notification(UIDevice.orientationDidChangeNotification).take(until:self.rx.deallocated).subscribe {[weak self] _ in |
| | | let orient = UIDevice.current.orientation |
| | | var desc = "" |
| | | // switch orient { |
| | | // case .portrait :desc = Localized("屏幕正常竖向") |
| | | // case .portraitUpsideDown:desc = Localized("屏幕倒立") |
| | | // case .landscapeLeft:desc = Localized("屏幕左旋转") |
| | | // case .landscapeRight:desc = Localized("屏幕右旋转") |
| | | // default:break |
| | | // } |
| | | |
| | | if !desc.isEmpty{ |
| | | self?.receiverNotification(orient: orient, desc: desc) |
| | | } |
| | | }.disposed(by: disposeBag) |
| | | } |
| | | |
| | | func setUI(){ |
| | |
| | | |
| | | deinit { |
| | | LogInfo(String(format: "%@ 已释放", NSStringFromClass(self.classForCoder).components(separatedBy: ".").last!)) |
| | | } |
| | | |
| | | |
| | | /// 屏幕旋转:当设备方向改变,需要对UI进行重新布局,子类重写此方法 |
| | | @objc open func receiverNotification(orient:UIDeviceOrientation,desc:String){ |
| | | LogInfo(desc) |
| | | refreshUI() |
| | | } |
| | | |
| | | } |