Skip to content

Commit 52c431c

Browse files
committed
1. 暴露 helper 方法
2. 删除无用代码
1 parent bc3ceeb commit 52c431c

File tree

3 files changed

+2
-53
lines changed

3 files changed

+2
-53
lines changed

Source/TBActionSheet/UIWindow+TBAdditions.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,5 @@
1212

1313
- (UIViewController *)tb_viewControllerForStatusBarStyle;
1414
- (UIViewController *)tb_viewControllerForStatusBarHidden;
15-
- (UIImage *)tb_snapshot;
1615
- (UIViewController *)currentViewController;
1716
@end

Source/TBActionSheet/UIWindow+TBAdditions.m

Lines changed: 0 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -31,56 +31,6 @@ - (UIViewController *)tb_viewControllerForStatusBarHidden
3131
return currentViewController;
3232
}
3333

34-
- (UIImage *)tb_snapshot
35-
{
36-
// source (under MIT license): https://github.com/shinydevelopment/SDScreenshotCapture/blob/master/SDScreenshotCapture/SDScreenshotCapture.m#L35
37-
38-
// UIWindow doesn't have to be rotated on iOS 8+.
39-
BOOL ignoreOrientation = kiOS8Later;
40-
41-
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
42-
43-
CGSize imageSize = CGSizeZero;
44-
if (UIInterfaceOrientationIsPortrait(orientation) || ignoreOrientation) {
45-
imageSize = [UIScreen mainScreen].bounds.size;
46-
} else {
47-
imageSize = CGSizeMake([UIScreen mainScreen].bounds.size.height, [UIScreen mainScreen].bounds.size.width);
48-
}
49-
50-
UIGraphicsBeginImageContextWithOptions(imageSize, NO, 0);
51-
CGContextRef context = UIGraphicsGetCurrentContext();
52-
CGContextSaveGState(context);
53-
CGContextTranslateCTM(context, self.center.x, self.center.y);
54-
CGContextConcatCTM(context, self.transform);
55-
CGContextTranslateCTM(context, -self.bounds.size.width * self.layer.anchorPoint.x, -self.bounds.size.height * self.layer.anchorPoint.y);
56-
57-
// correct for the screen orientation
58-
if (!ignoreOrientation) {
59-
if (orientation == UIInterfaceOrientationLandscapeLeft) {
60-
CGContextRotateCTM(context, (CGFloat)M_PI_2);
61-
CGContextTranslateCTM(context, 0, -imageSize.width);
62-
} else if (orientation == UIInterfaceOrientationLandscapeRight) {
63-
CGContextRotateCTM(context, (CGFloat)-M_PI_2);
64-
CGContextTranslateCTM(context, -imageSize.height, 0);
65-
} else if (orientation == UIInterfaceOrientationPortraitUpsideDown) {
66-
CGContextRotateCTM(context, (CGFloat)M_PI);
67-
CGContextTranslateCTM(context, -imageSize.width, -imageSize.height);
68-
}
69-
}
70-
71-
if([self respondsToSelector:@selector(drawViewHierarchyInRect:afterScreenUpdates:)]) {
72-
[self drawViewHierarchyInRect:self.bounds afterScreenUpdates:NO];
73-
} else {/* iOS 6 */
74-
[self.layer renderInContext:UIGraphicsGetCurrentContext()];
75-
}
76-
77-
CGContextRestoreGState(context);
78-
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
79-
UIGraphicsEndImageContext();
80-
81-
return image;
82-
}
83-
8434
- (UIViewController *)currentViewController
8535
{
8636
UIViewController *viewController = self.rootViewController;

TBActionSheet.podspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Pod::Spec.new do |s|
22
s.name = "TBActionSheet"
3-
s.version = "1.7.0"
3+
s.version = "1.7.1"
44
s.summary = "A Custom&Magical ActionSheet."
55
s.description = <<-DESC
66
TBActionSheet is a small library that allows you to substitute Apple's uncustomizable UIActionSheet, with a beautiful and totally customizable actionsheet that you can use in your iOS app. The default style is iOS9/10, you can make your own style. Enjoy!
@@ -17,7 +17,7 @@ s.platform = :ios, '7.0'
1717
s.requires_arc = true
1818

1919
s.source_files = "Source/**/*.{h,m}"
20-
s.public_header_files = "Source/TBActionSheet/TBActionButton.h", "Source/TBActionSheet/TBActionSheet.h", "Source/TBAlertController/TBAlertController.h"
20+
s.public_header_files = "Source/TBActionSheet/TBActionButton.h", "Source/TBActionSheet/TBActionSheet.h", "Source/TBActionSheet/UIView+TBAdditions.h", "Source/TBActionSheet/UIWindow+TBAdditions.h", "Source/TBAlertController/TBAlertController.h"
2121
s.frameworks = 'Foundation', 'UIKit'
2222

2323
end

0 commit comments

Comments
 (0)