美文网首页
iOS 仿安卓土司

iOS 仿安卓土司

作者: MMOTE | 来源:发表于2016-09-21 15:25 被阅读0次

-(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 仿安卓土司

      本文链接:https://www.haomeiwen.com/subject/yveaettx.html