iOS获取最上层Window
let windows = Array(UIApplication.shared.windows.reversed()) for window in windows { let windowOnMainScreen = window.screen == UIScreen.main let isWindowVisible…
阅读全文 »已阅读 1,213 次let windows = Array(UIApplication.shared.windows.reversed()) for window in windows { let windowOnMainScreen = window.screen == UIScreen.main let isWindowVisible…
阅读全文 »已阅读 1,213 次import UIKit class Utils: NSObject { static func topviewController() -> UIViewController? { var aRoot = UIApplication.shared.keyWindow?.rootViewController wh…
阅读全文 »已阅读 2,233 次使用UIPanGestureRecognizer实现UIView的拖动的时候,需要先给UIView添加手势对象 let gesture = UIPanGestureRecognizer(target: self, action: #selector(move)) gesture.maximumNumberOfTouch…
阅读全文 »已阅读 1,572 次用法去下,只要在Info.plist中配置上对应文件类型就行,如图(以PDF文件作为示例) <key>CFBundleDocumentTypes</key> <array> <dict> <key>CFBundleTypeIconFiles</key&g…
阅读全文 »已阅读 1,358 次使用方法如下: let documentPicker = UIDocumentPickerViewController(documentTypes: [String(kUTTypePDF)], in: UIDocumentPickerMode.open) documentPicker.modalPresentation…
阅读全文 »已阅读 1,007 次今天写了个小Demo,突然来了兴趣把它放到github上去,于是就凭着之前弄过的记忆搞了一下,但就在我准备push到github上的时候报错了,错误如下 ! [rejected] master -> master (non-fast-forward) error: failed to push some refs…
阅读全文 »已阅读 1,081 次iOS 7中使用该方法来自动调整 UIScrollView 的 contentInset 。在iOS 11之后将会使用 UIScrollView 的 contentInsetAdjustmentBehavior 属性来代替该方法。
阅读全文 »已阅读 1,758 次