废话不多说了,直接给大家上关键代码了。 - (void)viewDidLoad { [super viewDidLoad]; // Do any additional set
废话不多说了,直接给大家上关键代码了。
- (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 自定义弹出框实现代码,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对编程网网站的支持!
您可能感兴趣的文章:Android实现可输入数据的弹出框Android使用Dialog风格弹出框的ActivityAndroid 多种简单的弹出框样式设置代码Android中自定义PopupWindow实现弹出框并带有动画效果高仿iOS的Android弹出框Android 仿微信朋友圈点赞和评论弹出框功能Android编程实现仿QQ发表说说,上传照片及弹出框效果【附demo源码下载】android控件封装 自己封装的dialog控件android中ProgressDialog与ProgressBar的使用详解Android自定义弹出框dialog效果
--结束END--
本文标题: Android 自定义弹出框实现代码
本文链接: https://www.lsjlt.com/news/24238.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-01-21
2023-10-28
2023-10-28
2023-10-27
2023-10-27
2023-10-27
2023-10-27
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0