+ (void) ShowMessage: (NSString *) message
{
UIWindow * window = [UIApplication sharedapplication].keywindow;
UIView *showview = [[UIView alloc]init];
Showview.backgroundcolor = [Uicolor blackcolor];
Showview.frame = CGRectMake (1, 1, 1, 1);
Showview.alpha = 1.0f;
Showview.layer.cornerRadius = 5.0f;
Showview.layer.masksToBounds = YES;
[Window Addsubview:showview];
UILabel *label = [[UILabel alloc]init];
Cgsize labelsize = [message Sizewithfont:[uifont systemfontofsize:17] Constrainedtosize:cgsizemake (290, 9000)];
Label.frame = CGRectMake (Ten, 5, Labelsize.width, labelsize.height);
Label.text = message;
Label.textcolor = [Uicolor Whitecolor];
Label.textalignment = Nstextalignmentcenter;
Label.backgroundcolor = [Uicolor Clearcolor];
Label.font = [Uifont boldsystemfontofsize:13];
[ShowView Addsubview:label];
Showview.frame = CGRectMake ((screenwidth-labelsize.width-20)/2, labelsize.width+20, labelsize.height+10);
[UIView animatewithduration:2.5 animations:^{
Showview.alpha = 0;
} completion:^ (BOOL finished) {
[ShowView Removefromsuperview];
}];
}
#define SCREENWIDTH [[UIScreen mainscreen] bounds].size.width//get screen width
IOS Simple Tips View