LMGToast 4.1.3

LMGToast 4.1.3

lmgDigital2023维护。



LMGToast 4.1.3

  • Anjani Kumar

Toast for iOS

CocoaPods Version Carthage Compatible

Toast 是一个 Objective-C 分类,它为 UIView 对象类添加了通知。它旨在简单、轻量级且易于使用。大多数通知都可以通过单行代码触发。

使用 Swift?现在有这个库的 Swift 原生移植版可供使用:Toast-Swift

截图

Toast Screenshots

基本示例

// basic usage
[self.view makeToast:@"This is a piece of toast."];

// toast with a specific duration and position
[self.view makeToast:@"This is a piece of toast with a specific duration and position." 
            duration:3.0
            position:CSToastPositionTop];

// toast with all possible options
[self.view makeToast:@"This is a piece of toast with a title & image"
            duration:3.0
            position:[NSValue valueWithCGPoint:CGPointMake(110, 110)]
               title:@"Toast Title"
               image:[UIImage imageNamed:@"toast.png"]
               style:nil
          completion:^(BOOL didTap) {
              if (didTap) {
                  NSLog(@"completion from tap");
              } else {
                  NSLog(@"completion without tap");
              }
          }];
                
// display toast with an activity spinner
[self.view makeToastActivity:CSToastPositionCenter];

// display any view as toast
[self.view showToast:myView];

等等,还有更多!

// create a new style
CSToastStyle *style = [[CSToastStyle alloc] initWithDefaultStyle];

// this is just one of many style options
style.messageColor = [UIColor orangeColor];

// present the toast with the new style
[self.view makeToast:@"This is a piece of toast."
            duration:3.0
            position:CSToastPositionBottom
               style:style];

// or perhaps you want to use this style for all toasts going forward?
// just set the shared style and there's no need to provide the style again
[CSToastManager setSharedStyle:style];

// toggle "tap to dismiss" functionality
[CSToastManager setTapToDismissEnabled:YES];

// toggle queueing behavior
[CSToastManager setQueueEnabled:YES];

// immediately hides all toast views in self.view
[self.view hideAllToasts];

参阅示例项目获取更多信息。

设置说明

CocoaPods

使用CocoaPods安装,请将以下内容添加到您的Podfile文件中

pod 'Toast', '~> 4.1.0'

Carthage

使用Carthage安装,请将以下内容添加到您的Cartfile文件中

github "scalessec/Toast" ~> 4.1.0

运行carthage update --use-xcframeworks来构建框架并链接到Toast.xcframework。然后,使用#import <Toast/Toast.h>

手动操作

  1. UIView+Toast.hUIView+Toast.m添加到您的项目中。
  2. #import "UIView+Toast.h"
  3. 为自己拿一杯冰凉的🍺。

隐私

Toast不收集任何数据。与库相关提供的是一个隐私清单。有关详细信息,请参阅苹果的文档

MIT许可

Copyright (c) 2011-2024 Charles Scalesse.

Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.