Latest 0.9
License MIT
Platforms ios 7.0, requires ARC


HWToast can display a toast with custom views in a flexible way.



You can make a toast easily with a maker:

[HWToast showToastWithMaker:^(HWToastMaker *maker) {
    // Superview of the toast. If the baseView is nil, the toast will be added to a new window over the screen.
    maker.baseView = nil;

    // The toast view. It could be a text toast(HWTextToastView) 、 a loading toast(HWLoadingToastView) or other HWToastView.
    maker.contentView = [[HWTextToastView alloc] initWithText:text];

    // The toast will disappear after duration. Default value is 0 and it will be on the screen permanently.
    maker.duration = 0.2f;

    // Should it be dismissed on taped. Default is NO.
    maker.shouldDismissOnTaped = YES;

    // Whether the dismiss will be animated.
    maker.dismissAnimated = YES;

    // The callback will be called after the toast been taped.
    maker.tapCallback = ^(UIView *view){
        NSLog(@"You touched me!");

    // The toast's position according to baseView
    maker.position = HWToastPositionBottom;

    // The offset relative to the position.
    maker.offsset = UIOffsetMake(0, -100);

You can also abstract the maker block into class methods:

@implementation HWToastTool

+(void)showToastWithText:(NSString*)text {
    [HWToast showToastWithMaker:^(HWToastMaker *maker) {
        maker.contentView = [[HWTextToastView alloc] initWithText:text];
        maker.duration = 2.0f;


And call like this:

[HWToastTool showToastWithText:@"Hi, I'm a toast from HWToastTool!"];


You can make your custom toast view inheriting from HWToastView.

Just like HWTextToastViewHWLoadingToastView and HWPieChartToastView.

Latest podspec

    "name": "HWToast",
    "version": "0.9",
    "summary": "Show a toast with custom views in a flexible way.",
    "description": "HWToast can display a toast with custom views in a flexible way. You can make a toast easily in a block.",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "callmewhy": ""
    "platforms": {
        "ios": "7.0"
    "source": {
        "git": "",
        "tag": "0.9"
    "source_files": "Classes/**/*.{h,m}",
    "resources": "Classes/HWToastImage.bundle",
    "requires_arc": true

Pin It on Pinterest

Share This