實現(xiàn)在.m文件中導(dǎo)入頭文件:#import"Toast+UIView.h"
- (IBAction)changeColor:(id)sender {
//直接調(diào)用顯示活動指示器的方法
[self.view makeToastActivity];
//做一個延時要處理的信息
[NSTimer scheduledTimerWithTimeInterval:2 target:self selector:@selector(show) userInfo:nil repeats:NO];
}
-(void)show
{
//將活動顯示器隱藏
[self.view hideToastActivity];
//調(diào)用提示信息的方法
[self.view makeToast:@"這就是你要顯示的信息" duration:2 position:@"center"];
}