欢迎光临
我们一直在努力

SwiftMessages

建站超值云服务器,限时71元/月

SwiftMessages

项目介绍:

SwiftMessages是一款在在屏幕的顶部或底部状态栏的形式显示简短消息的iOS库

DEMO 下载:





UsageBasics[Objective-C] 查看源文件 复制代码

SwiftMessages.show(view: myView)

Although you can show any instance of UIView, SwiftMessages provides a MessageView classand assortment of nib-based layouts that should handle most cases:
[Objective-C] 查看源文件 复制代码

// Instantiate a message view from the provided card view layout. SwiftMessages searches for nib
// files in the main bundle first, so you can easily copy them into your project and make changes.
let view = MessageView.viewFromNib(layout: .CardView)

// Theme message elements with the warning style.
view.configureTheme(.Warning)

// Add a drop shadow.
view.configureDropShadow()

// Set message title, body, and icon. Here, we're overriding the default warning
// image with an emoji character.
view.configureContent(title: "Warning", body: "Consider yourself warned.", iconText: "")

// Show the message.
SwiftMessages.show(view: view)


You may wish to use the view provider variant show(viewProvider to ensure thatyour UIKit code is executed on the main queue:
[Objective-C] 查看源文件 复制代码

SwiftMessages.show {
    let view = MessageView.viewFromNib(layout: .CardView)
    // ... configure the view
    return view
}


The SwiftMessages.Config struct provides numerous configuration options that can be passed to show():
[Objective-C] 查看源文件 复制代码

var config = SwiftMessages.Config()

// Slide up from the bottom.
config.presentationStyle = .Bottom

// Display in a window at the specified window level: UIWindowLevelStatusBar
// displays over the status bar while UIWindowLevelNormal displays under.
config.presentationContext = .Window(windowLevel: UIWindowLevelStatusBar)

// Disable the default auto-hiding behavior.
config.duration = .Forever

// Dim the background like a popover view. Hide when the background is tapped.
config.dimMode = .Gray(interactive: true)

// Disable the interactive pan-to-hide gesture.
config.interactiveHide = false

// Specify a status bar style to if the message is displayed directly under the status bar.
config.preferredStatusBarStyle = .LightContent

SwiftMessages.show(config: config, view: view)

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » SwiftMessages
分享到: 更多 (0)