未验证 提交 fc894794 编写于 作者: Y yixiangboy 提交者: GitHub

Merge pull request #380 from DeveloperLY/master

fix: 修复部分 BUG 
......@@ -52,11 +52,11 @@
- (void)show{
self.hidden = NO;
self.frame = CGRectMake(0, 0, DoraemonScreenWidth, IPHONE_STATUSBAR_HEIGHT);
if(IS_IPHONE_X_Series){
_contentLabel.frame = CGRectMake(0, self.doraemon_height-20, DoraemonScreenWidth, 20);
}else{
_contentLabel.frame = CGRectMake(0, 0, DoraemonScreenWidth, IPHONE_STATUSBAR_HEIGHT);
self.frame = CGRectMake(0, 0, DoraemonScreenWidth, IPHONE_STATUSBAR_HEIGHT + 15);
if (IS_IPHONE_X_Series) {
_contentLabel.frame = CGRectMake(0, self.doraemon_height-25, DoraemonScreenWidth, 20);
} else {
_contentLabel.frame = CGRectMake(0, self.doraemon_height-IPHONE_STATUSBAR_HEIGHT, DoraemonScreenWidth, IPHONE_STATUSBAR_HEIGHT);
}
}
......
......@@ -103,7 +103,12 @@ static CGFloat const kColorPickWindowSize = 150;
- (void)updateScreeShotImage {
UIGraphicsBeginImageContext([UIScreen mainScreen].bounds.size);
[[[UIApplication sharedApplication].delegate window].layer renderInContext:UIGraphicsGetCurrentContext()];
// 在部分复杂界面使用此功能调用这个方法的时候,CPU使用率会暴增至90%以上
// https://stackoverflow.com/questions/19066717/how-to-render-view-into-image-faster
// [[[UIApplication sharedApplication].delegate window].layer renderInContext:UIGraphicsGetCurrentContext()];
// 建议使用这个方法
[[[UIApplication sharedApplication].delegate window] drawViewHierarchyInRect:[UIScreen mainScreen].bounds afterScreenUpdates:YES];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
......
......@@ -12,7 +12,7 @@ NS_ASSUME_NONNULL_BEGIN
@interface DoraemonResponseImageModel : NSObject
@property (nonatomic, strong) NSURL *url;
@property (nonatomic, strong) NSData *data;
@property (nonatomic, assign) NSString *size;
@property (nonatomic, copy) NSString *size;
- (instancetype)initWithResponse: (NSURLResponse *)response data:(NSData *) data;
@end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册