Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion EBBannerView/Classes/EBBannerView.m
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ -(CGFloat)standardHeight{
-(CGFloat)calculatedContentHeight{
CGSize size = CGSizeMake(self.contentLabel.frame.size.width, MAXFLOAT);
NSDictionary *dict = [NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:self.contentLabel.font.pointSize] forKey:NSFontAttributeName];
CGFloat calculatedHeight = [self.contentLabel.text boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin attributes:dict context:nil].size.height;
CGFloat calculatedHeight = ceil([self.contentLabel.text boundingRectWithSize:size options:NSStringDrawingUsesLineFragmentOrigin attributes:dict context:nil].size.height);
return calculatedHeight;
}

Expand Down
27 changes: 26 additions & 1 deletion EBBannerView/Classes/EBBannerWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,47 @@ @implementation EBBannerWindow
+(instancetype)sharedWindow{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
NSSet *scenes = UIApplication.sharedApplication.connectedScenes;
__block UIScene *scene;
[scenes enumerateObjectsUsingBlock:^(UIScene * _Nonnull obj, BOOL * _Nonnull stop) {
if (obj.activationState == UISceneActivationStateForegroundActive && [obj isKindOfClass:[UIWindowScene class]]) {
scene = obj;
*stop = YES;
}
}];
sharedWindow = [[self alloc] initWithWindowScene:(UIWindowScene *)scene];
sharedWindow.userInteractionEnabled = NO;
[sharedWindow setHidden:NO];

#else
sharedWindow = [[self alloc] initWithFrame:CGRectZero];
#endif

sharedWindow.windowLevel = UIWindowLevelAlert;
sharedWindow.layer.masksToBounds = NO;
UIWindow *originKeyWindow = UIApplication.sharedApplication.keyWindow;
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 130000
[sharedWindow makeKeyAndVisible];
#endif

/* fix bug:
EBBannerViewController setSupportedInterfaceOrientations -> Portrait
push to a VC with orientation Left
UITextFiled's pad will show a wrong orientation with Portrait
*/
#if __IPHONE_OS_VERSION_MAX_ALLOWED >= 130000
emptyWindow = [[EBEmptyWindow alloc] initWithWindowScene:(UIWindowScene *)scene];
emptyWindow.frame = CGRectZero;
[emptyWindow setHidden:NO];
#else
emptyWindow = [[EBEmptyWindow alloc] initWithFrame:CGRectZero];
#endif
emptyWindow.windowLevel = UIWindowLevelAlert;
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 130000
[emptyWindow makeKeyAndVisible];
[originKeyWindow makeKeyAndVisible];
#endif
[EBBannerViewController setSupportedInterfaceOrientations:UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscape];
[EBBannerViewController setStatusBarHidden:NO];

Expand Down
Binary file modified demo/.DS_Store
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<key>demo.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
</dict>
</dict>
</dict>
</plist>
Binary file not shown.