Mbprogresshud Prompt for auto-wrapping in iOS development

Source: Internet
Author: User

1. First of all, because the development needs to prompt a lot of information, can not display complete, demand requirements, display complete, automatic line wrapping and other functions; the developer needs to rewrite the three-party code as follows:

First step:

You must import the mbprogresshud three-party library in your project: Https://github.com/jdg/MBProgressHUD

Of course, you can also use Cocoapods to integrate third-party libraries, simply say the steps:

1.

The folder can be dragged to a DOS window using drag-and-drop files.

CD Project Path

2.

pod Search three-party library name (copy the required three-party library version)

3.

Vim Podfile write in Inside

Here 8.0 represents the minimum supported version of your app

Platform:ios ,'8.0'

Target: Project name do

pod ' Mbprogresshud ' , ' ~> 0.9.2 '

End

4.

sudo xcode-select--switch/applications/xcode.app

5.

Pod Install--verbose--no-repo-update

or : Pod install

Second Step: Import the header file of the three-party library

#import "MBProgressHUD.h"

The third step: the following code

/*

contains time, text , picture hint box

For multi-line text display

*/

-(void) Showmessagetitle: (nsstring *) title Anddelay: (int) timeint andimage: (nsstring *) imagestr{

mbprogresshud *hud = [mbprogresshud showhudaddedto: [uiapplication Sharedapplication]. Keywindow animated:YES];

Hud. userinteractionenabled = YES;

Hud. backgroundcolor = [uicolor clearcolor];

Hud. animationtype = mbprogresshudanimationzoomout;

Hud. Detailslabeltext = title;

Hud. Square = NO;

Hud. mode = mbprogresshudmodecustomview;

uiimageview *imageview = [[uiimageview alloc] initwithframe:cgrectmake( 0, 0, + )];

ImageView. image = [UIImage imagenamed: imagestr];

Hud. CustomView = imageView;

[Hud Hide:YES afterdelay: timeint];

}

/*

Contains time , text prompt box

Suitable for single-line text display

*/

-(void) Showmessagetitle: (nsstring *) title Anddelay: (int) timeint{

mbprogresshud *hud = [mbprogresshud showhudaddedto: [uiapplication Sharedapplication]. Keywindow animated:YES];

Hud. userinteractionenabled = YES;

Hud. backgroundcolor = [uicolor clearcolor];

Hud. animationtype = mbprogresshudanimationzoomout;

Hud. Detailslabeltext = title;

Hud. Square = NO;

Hud. mode = mbprogresshudmodetext;

[Hud Hide:YES afterdelay: timeint];

}

Operation Result:

Mbprogresshud Prompt for auto-wrapping in iOS development

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.