Skip to content

Commit

Permalink
Adapter iPhoneX
Browse files Browse the repository at this point in the history
  • Loading branch information
zhongwuzw committed Mar 27, 2018
1 parent 2d49052 commit d35aefc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Master

# 1.2.4

* Fix issue that some video from tencent can not play.
* Adapt `iPhoneX`.

# 1.2.3

Expand Down
10 changes: 9 additions & 1 deletion WebBrowser/Browser/Controller/BrowserViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,15 @@ - (void)initializeView{
});

self.browserTopToolBar = ({
BrowserTopToolBar *browserTopToolBar = [[BrowserTopToolBar alloc] initWithFrame:CGRectMake(0, 0, self.view.width, TOP_TOOL_BAR_HEIGHT)];
CGFloat yOrigin = 0;
if ([ZWUtility isIphoneX]) {
yOrigin = 24;
UIView *gapView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.width, yOrigin)];
gapView.backgroundColor = UIColorFromRGB(0xF8F8F8);
[self.view addSubview:gapView];
}

BrowserTopToolBar *browserTopToolBar = [[BrowserTopToolBar alloc] initWithFrame:CGRectMake(0, yOrigin, self.view.width, TOP_TOOL_BAR_HEIGHT)];
[self.view addSubview:browserTopToolBar];

browserTopToolBar.backgroundColor = UIColorFromRGB(0xF8F8F8);
Expand Down
2 changes: 2 additions & 0 deletions WebBrowser/Utils/Helper/ZWUtility.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@
//Objective-C Runtime Method
void MethodSwizzle(Class c,SEL origSEL,SEL overrideSEL);

+ (BOOL)isIphoneX;

@end
4 changes: 4 additions & 0 deletions WebBrowser/Utils/Helper/ZWUtility.m
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,8 @@ void MethodSwizzle(Class c,SEL origSEL,SEL overrideSEL)
}
}

+ (BOOL)isIphoneX{
return (int)[[UIScreen mainScreen] nativeBounds].size.height == 2436;
}

@end

0 comments on commit d35aefc

Please sign in to comment.