GithubHelp home page GithubHelp logo

pikacode / ebbannerview Goto Github PK

View Code? Open in Web Editor NEW
683.0 683.0 120.0 15.34 MB

Just 1 line:Show a banner the same as iOS 9~13 Notification, or show a custom view. 只需一行代码:展示跟 iOS 系统一样的推送通知横幅,或展示一个自定义的 view。支持横屏、自动适应各种机型、自动声音/震动。

License: MIT License

Ruby 9.39% Objective-C 47.30% Swift 43.30%

ebbannerview's Introduction

Hi,世界 😈

  •  Focusing on iOS Development
  • 🔨 Creator of applications and frameworks
  • 🗣️ Learning the Japanese language now
  • 🗾 East Blue. I came, therefore I see.

ebbannerview's People

Contributors

djroser avatar jbdamiano avatar pikacode avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ebbannerview's Issues

iOS14依然会崩溃哦

image

EBBannerView更新到1.1.2版本, 在应用内收到推送,过几秒种就仍然会崩溃,
从图片左边的调用栈看,一直调用
-(UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
直至崩溃

xcode10.3 编译报错

EBBannerView.xib:-1: Failed to find or create execution context for description '<IBCocoaTouchPlatformToolDescription: 0x7fbbb197dc20> System content for IBCocoaTouchFramework-NineOneAndLater <IBScaleFactorDeviceTypeDescription: 0x7fbbb1990920> scaleFactor=2x'. These intermediate objects were non-nil: (

显示提示框后状态条文字颜色不正确

我在demo里的SystemStyleViewController.m文件的viewDidLoad方法中加入下列代码
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
将状态条文字改为白色,在显示提示框后状态条文字颜色被修改为黑色

横竖屏问题

可否暴露一个支持横竖屏的方法,出现弹窗后页面状态栏就会滑动,但是需求不能滑

sharedWindow.m里面
[EBBannerViewController setSupportedInterfaceOrientations:UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscape];
默认横竖屏都支持

iOS 12 beta 闪退

*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </Users/eagle/Library/Developer/CoreSimulator/Devices/07D4020A-3F02-4401-8F6C-7CBE2F9CB6FB/data/Containers/Bundle/Application/66A18A55-B7B2-4483-9530-B03C9746EB2F/demo.app> (loaded)' with name 'EBBannerViewController''

Dark Mode Issue

I am not able to read contents when my phone is in dark mode

image

iOS12崩溃-label:bug.

+(instancetype)bannerViewWithStyle:(EBBannerViewStyle)style{ __block EBBannerView *bannerView; [sharedBannerViews enumerateObjectsUsingBlock:^(EBBannerView * _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) { if (obj.maker.style == style) { bannerView = obj; } }]; if (bannerView == nil) { bannerView = [[NSBundle bundleForClass:self.class] loadNibNamed:@"EBBannerView" owner:nil options:nil][style-9]; [[NSNotificationCenter defaultCenter] addObserver:bannerView selector:@selector(applicationDidChangeStatusBarOrientationNotification) name:UIApplicationDidChangeStatusBarOrientationNotification object:nil]; [bannerView addGestureRecognizer]; [sharedBannerViews addObject:bannerView]; } return bannerView; }

12 -9 崩溃

在有UIAlertView弹出后,keyWindow会被替换为emptyWindow

在有UIAlertView弹出后,因为UIEmptywindow的alertLevel为2000,keyWindow会被替换为emptyWindow,这会导致项目中有[UIApplication sharedApplication].keywindow addsubView:xxView];的控件被添加到emptyWindow上,以至于这些控件无法交换和销毁。

提几点优化建议

1、点击推送栏回调不友好(应该返回userinfo,由外部自己处理),不然通过 NSNotification 里拿到的只是 content,一点用也没有,谁也不会拿着 content 去做跳转的。那我也不想在弹出推送栏之前先使用成员变量把跳转进行保存,因为很有可能被后面来的推送给覆盖掉。
2、应该要支持下,当多个推送来时要怎么处理,是pendding住后面的推送还是忽略后面的推送。
3、既然iOS 10已经支持了,如果可以话可以把iOS10的部分封装到你的框架内部,这点你可以自己考虑是否合适,可能封装的工作量会增大很多。

状态条颜色修改不正确

我在demo里的SystemStyleViewController.m文件的viewDidLoad方法中加入下列代码
self.navigationController.navigationBar.barStyle = UIBarStyleBlack;
将状态条文字改为白色,在显示提示框后状态条文字颜色被修改为黑色

怎么获取推送内容啊 make.content

上个版本还可以
[EBForeNotification handleRemoteNotification:userInfo soundID:1312]; 直接userInfo
现在
EBBannerView *banner = [EBBannerView bannerWithBlock:^(EBBannerViewMaker *make) {
make.style = EBBannerViewStyleiOS9;//指定系统样式,不指定自动依据系统显示不同样式
make.style = 9;//展示 iOS9 样式
make.content = @"MINE eye hath played the painter and hath stelled";
}];
怎么办啊

iOS14崩溃问题修改建议

if (@available(iOS 13.0, *)) {
    NSEnumerator *frontToBackWindows = [UIApplication.sharedApplication.windows reverseObjectEnumerator];
    for (UIWindow *window in frontToBackWindows) {
        BOOL windowOnMainScreen = window.screen == UIScreen.mainScreen;
        BOOL windowIsVisible = !window.hidden && window.alpha > 0;
        BOOL windowLevelNormal = window.windowLevel == UIWindowLevelNormal;
        if (windowOnMainScreen && windowIsVisible && windowLevelNormal) {
            return [window hitTest:point withEvent:event];
            break;
        }
    }
// return [UIApplication.sharedApplication.keyWindow hitTest:point withEvent:event];
}

这样取最上层window而不是直接拿keyWindow.

关于UIView animateWithDuration weakSelf的疑问

WEAK_SELF(weakSelf); CGFloat originHeight = self.contentLabel.frame.size.height; [UIView animateWithDuration:_maker.animationDuration animations:^{ weakSelf.frame = CGRectMake(weakSelf.fixedX, weakSelf.fixedY, weakSelf.fixedWidth, weakSelf.standardHeight + weakSelf.calculatedHeight - originHeight + 1); } completion:^(BOOL finished) { weakSelf.frame = CGRectMake(weakSelf.fixedX, weakSelf.fixedY, weakSelf.fixedWidth, weakSelf.standardHeight + weakSelf.calculatedHeight - originHeight + 1); }];
楼主你好,看到这里你写的weakSelf我想问下,为什么用weakSelf,这里应该并不具有循环强引用

请问如何清除全部通知???

你好,试以下方法,都无法清除通知栏显示的通知;
UIApplication.shared.cancelAllLocalNotifications()

也无法获取通知;
let locals = UIApplication.shared.scheduledLocalNotifications

// 使用代码
image

// 清除代码
image

custom的使用问题

使用了最新版本,选择了custom style后,点击top,出现顶部banner。
再点击banner上的close按钮后,页面变得没有反应,应该是window的问题,还需要修改一下。

旧项目Xcode13无法显示

最近更新了xocde13 发现无法显示了 目前使用1.1.0版本,通过调试时发现keyWindow是没有大小的,目前我改变了下源码,暂时解决了显示问题
+(instancetype)sharedWindow{
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedWindow = [UIApplication sharedApplication].delegate.window;
return sharedWindow;
}
项目中用到的功能不多目前解决了我的问题
同时非常感谢作者!!!

iOS14崩溃

SEGV_ACCERR EBBannerWindow hitTest:withEvent:

使用cocoapods导入项目会引起闪退

原因,在pods中的xib不是属于mainbundle的

修改:
EBBannerView.m 46行
NSBundle *bundle = [NSBundle bundleForClass:self.class];

EBBannerViewController.m 19行
NSBundle *bundle = [NSBundle bundleForClass:self.class];

可以解决

适配iPhoneX

还没有适配iPhoneX,肯请大大早日适配

建议

如果ios8系统加入此工程,推送的内容多行时,UI会有些错位
建议修改下计算行高的逻辑

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.