This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
extension UIViewController { | |
var ft_safeAreaLayoutGuide: UILayoutGuide { | |
if #available(iOS 11.0, *) { | |
return view.safeAreaLayoutGuide | |
} else { | |
let id = "ft_safeAreaLayoutGuide" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)saveScreenshotToDocumentsDirectory | |
{ | |
CGSize imageSize = [[UIScreen mainScreen] bounds].size; | |
if (NULL != UIGraphicsBeginImageContextWithOptions) | |
UIGraphicsBeginImageContextWithOptions(imageSize, NO, 0); | |
else UIGraphicsBeginImageContext(imageSize); | |
CGContextRef context = UIGraphicsGetCurrentContext(); | |
for (UIWindow *window in [[UIApplication sharedApplication] windows]) { | |
if (![window respondsToSelector:@selector(screen)] || [window screen] == [UIScreen mainScreen]) { |