当前位置: 移动技术网 > IT编程>移动开发>Android > Android 自定义弹出框实现代码

Android 自定义弹出框实现代码

2019年07月24日  | 移动技术网IT编程  | 我要评论

雅典奥运会闭幕式中国8分钟,网络 测速,今日成品油价格

废话不多说了,直接给大家上关键代码了。

- (void)viewdidload
{
[super viewdidload];
// do any additional setup after loading the view.
[self showalertview:@"11111"];
}
//自定义弹出框
-(void)showalertview:(nsstring *)strtiptext
{
uiview *showview=[[uiview alloc]init];
[showview setframe:cgrectmake(100, 100, 120, 35)];
[showview setalpha:0.0f];
[showview setbackgroundcolor:[uicolor blackcolor]];
[showview setclipstobounds:yes];
[[showview layer]setmaskstobounds:yes];
[[showview layer]setcornerradius:5.0f];
uilabel *lbltips=[[uilabel alloc]init];
[lbltips setframe:cgrectmake(0, 0, 120, 35)];
[lbltips settext:strtiptext];
[lbltips settextalignment:nstextalignmentcenter];
[lbltips settextcolor:[uicolor whitecolor]];
[lbltips setbackgroundcolor:[uicolor clearcolor]];
[lbltips setfont:[uifont boldsystemfontofsize:16]];
[showview addsubview:lbltips];
[self.view addsubview:showview];
[uiview animatewithduration:0.5f delay:0.0f options:uiviewanimationoptioncurvelinear animations:^{
showview.alpha=1.0f;
}completion:^(bool finished){
[uiview animatewithduration:1.0f delay:1.0f options:uiviewanimationoptioncurvelinear animations:^{
showview.alpha=0.0f;
}completion:^(bool finished){
;
}];
}];
}

以上所述是小编给大家介绍的android 自定义弹出框实现代码,希望对大家有所帮助

如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复

相关文章:

验证码:
移动技术网