Skip to content

Commit

Permalink
Merge pull request didi#380 from DeveloperLY/master
Browse files Browse the repository at this point in the history
fix: 修复部分 BUG
  • Loading branch information
yixiangboy authored Jan 2, 2020
2 parents d8083a6 + e9b223b commit fc89479
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
10 changes: 5 additions & 5 deletions iOS/DoraemonKit/Src/Core/CommonUI/StateBar/DoraemonStateBar.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ - (void)becomeKeyWindow{

- (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);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,12 @@ - (NSString *)colorAtPoint:(CGPoint)point {

- (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();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit fc89479

Please sign in to comment.