iOS 仿安卓土司

-(void)showMessage:(NSString*)message

{

UIWindow* window = [UIApplicationsharedApplication].keyWindow;

UIView*showview =  [[UIViewalloc]init];

showview.backgroundColor= [UIColorblackColor];

showview.frame=CGRectMake(1,1,1,1);

showview.alpha=1.0f;

showview.layer.cornerRadius=5.0f;

showview.layer.masksToBounds=YES;

[windowaddSubview:showview];

UILabel*label = [[UILabelalloc]init];

CGSizeLabelSize = [messagesizeWithFont:[UIFontsystemFontOfSize:17]constrainedToSize:CGSizeMake(290,9000)];

label.frame=CGRectMake(10,5, LabelSize.width, LabelSize.height);

label.text= message;

label.textColor= [UIColorwhiteColor];

label.textAlignment=1;

label.backgroundColor= [UIColorclearColor];

label.font= [UIFontboldSystemFontOfSize:15];

[showviewaddSubview:label];

showview.frame=CGRectMake(([UIScreenmainScreen].bounds.size.width- LabelSize.width-20)/2, [UIScreenmainScreen].bounds.size.height-100, LabelSize.width+20, LabelSize.height+10);

[UIViewanimateWithDuration:1.5animations:^{

showview.alpha=0;

}completion:^(BOOLfinished) {

[showviewremoveFromSuperview];

}];

}

你可能感兴趣的:(iOS 仿安卓土司)