All Projects → xaoxuu → NoticeBoard

xaoxuu / NoticeBoard

Licence: MIT license
请使用功能更强大的ProHUD: https://github.com/xaoxuu/ProHUD

Programming Languages

swift
15916 projects
objective c
16641 projects - #2 most used programming language
shell
77523 projects
ruby
36898 projects - #4 most used programming language
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to NoticeBoard

Criollo
A powerful Cocoa web framework and HTTP server for macOS, iOS and tvOS.
Stars: ✭ 229 (+1426.67%)
Mutual labels:  cocoa
panthro
An implementation of XPath 3.0 in Objective-C/Cocoa
Stars: ✭ 45 (+200%)
Mutual labels:  cocoa
trace-cocoa-sdk
Catch bugs before they reach production — get detailed crash reports and monitor how your app is performing across the entire install base.
Stars: ✭ 15 (+0%)
Mutual labels:  cocoa
STCubeTransition
A custom view transition that provides transition between 2 different views with 3D cube rotate effect.
Stars: ✭ 16 (+6.67%)
Mutual labels:  podfile
Tocropviewcontroller
A view controller for iOS that allows users to crop portions of UIImage objects
Stars: ✭ 4,210 (+27966.67%)
Mutual labels:  podfile
OutlineViewDiffableDataSource
Stop looking for NSOutlineViewDiffableDataSource, it’s here 👌
Stars: ✭ 96 (+540%)
Mutual labels:  cocoa
Cacao
Rust bindings for AppKit (macOS) and UIKit (iOS/tvOS). Experimental, but working!
Stars: ✭ 205 (+1266.67%)
Mutual labels:  cocoa
topologic
Visualiser for basic geometric primitives and fractals in arbitrary-dimensional spaces
Stars: ✭ 39 (+160%)
Mutual labels:  cocoa
react-native-macos
Fork of https://github.com/ptmt/react-native-macos with more features
Stars: ✭ 22 (+46.67%)
Mutual labels:  cocoa
articles-ko
Articles for NSHipster.co.kr
Stars: ✭ 18 (+20%)
Mutual labels:  cocoa
XYFSnowAnimation
A category of NSTimer for showing 3D Fluttered animation for iOS, which is used very simply. Lightweight CALayer animation, core animation, 3D transform, performance safety. iOS 3D三维飘落下雪落花动画,轻量级CALayer图层动画,核心动画,3D形变,性能安全,定时器NSTimer分类,直接使用,很简单
Stars: ✭ 15 (+0%)
Mutual labels:  podfile
Xhlaunchad
🔥The screen opening advertising solutions - 开屏广告、启动广告解决方案-支持静态/动态图片广告,mp4视频广告,全屏/半屏广告、兼容iPhone/iPad. 【 Github下载不了/下载慢 可以访问国内下载地址: https://gitee.com/CoderZhuXH/XHLaunchAd】
Stars: ✭ 3,578 (+23753.33%)
Mutual labels:  podfile
objc-lisp-bridge
A portable reader and bridge for interacting with Objective-C and Cocoa
Stars: ✭ 39 (+160%)
Mutual labels:  cocoa
Punic
Clean room reimplementation of Carthage tool
Stars: ✭ 236 (+1473.33%)
Mutual labels:  cocoa
WWDCNotes
WWDCNotes.com content
Stars: ✭ 343 (+2186.67%)
Mutual labels:  cocoa
Carthage
A simple, decentralized dependency manager for Cocoa
Stars: ✭ 14,487 (+96480%)
Mutual labels:  cocoa
nimble-commander
Nimble Commander - dual-pane file manager for Mac
Stars: ✭ 147 (+880%)
Mutual labels:  cocoa
Inspire
主题式Swift开发工具包,包含布局、颜色、字体等。
Stars: ✭ 16 (+6.67%)
Mutual labels:  podfile
AttributedStringWrapper
a simple packaging for NSAttributedString to make the developers easy to use
Stars: ✭ 16 (+6.67%)
Mutual labels:  cocoa
WCSDateRange
Simple date range class.
Stars: ✭ 13 (-13.33%)
Mutual labels:  cocoa

         

一个适用于iOS平台的简单易用的应用内消息通知框架。

screenshot video

导入

pod 'NoticeBoard'

使用

// 创建notice
let notice = Notice.init(title: "标题", icon: UIImage.init(named: "alert-"), body: "正文")
// 发布notice       
NoticeBoard.shared.post(notice, duration: 2)
// 移除某个通知
NoticeBoard.shared.remove(notice)
// 清空
NoticeBoard.shared.clean()

NoticeBoard中的func均提供了同名的class func,等同于NoticeBoard.shared。

个性化设置

// 按钮事件
notice.actionButtonDidTapped { (notice, btn) in
    print("点击了'→'按钮")
}

// 设置颜色主题
notice.themeColor = .init(red: 0.2, green: 0.3, blue: 0.4, alpha: 1)
// 模糊背景(暂时只支持iOS11,在之前的系统会自动改为纯色背景),和纯色背景可以同时使用
notice.blurEffectStyle = .light

快速post

// post一条消息,内容为"Hello World!"
NoticeBoard.post("Hello World!")
NoticeBoard.post("Hello World!", duration: 2)

// post一条指定主题样式的消息
NoticeBoard.post(.error, message: "Something Happend", duration: 5)
NoticeBoard.post(.dark, message: "Good evening", duration: 2)

// post一条指定主题样式并且带标题的消息
NoticeBoard.post(.light, title: "Hello World", message: "I'm NoticeBoard.", duration: 2)

// post一条指定主题样式并且带标题和icon的消息
let img = UIImage.init(named: "alert-circle")
NoticeBoard.post(.light, icon:img, title: "Hello World", message: "I'm NoticeBoard.", duration: 2)

// 对于带有标题的消息,可以设置右边的按钮“→”
NoticeBoard.post(.warning, icon: img, title: "Warning", message: "Please see more info", duration: 0) { (notice, sender) in
    NoticeBoard.post("button tapped", duration: 1)
}

duration参数为0代表无穷大,即不自动消失。

返回值为notice实例,可以随时更改notice。

post进度

设置任意一条 notice 实例的 progress 属性,即时生效。

// 进度为0
notice.progress = 0
// 进度为50%
notice.progress = 0.5
// 进度为100%
notice.progress = 1

post自定义view

notice.rootViewController?.view.addSubview(myView)
NoticeBoard.post(notice)

多个通知的布局

如果同一时间需要存在多个通知,可以根据使用场景选择不同的布局方式:

// 平铺,默认(所有通知都可见,但是通知过多会超出屏幕)
NoticeBoard.shared.layoutStyle = .tile
NoticeBoard.shared.post(notice, duration: 2)

// 取代旧的通知(旧的采用fade动画淡出)
NoticeBoard.shared.layoutStyle = .replace
NoticeBoard.shared.post(notice, duration: 2)

// 移除旧的通知(旧的采用moveout动画移出屏幕)
NoticeBoard.shared.layoutStyle = .remove
NoticeBoard.shared.post(notice, duration: 2)

// 覆盖在旧的通知上层(切勿堆积过多)
NoticeBoard.shared.layoutStyle = .overlay
NoticeBoard.shared.post(notice, duration: 2)

// 堆叠(最新的通知会遮挡旧的通知)
NoticeBoard.shared.layoutStyle = .stack
NoticeBoard.shared.post(notice, duration: 2)

设置Level

默认提供了四种level:

// case low = 4000
// case normal = 4100
// case high = 4200
// case veryHigh = 4300
notice.level = .normal

也可以直接设置任意数值:

notice.windowLevel = 1000

在Swift和Objective-C中使用

NoticeBoard使用Swift4.1语言编写,如需在Objective-C项目中使用,可以采用Objective-CSwift混编的方式,详情请参照示例程序:Example-OC

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].