很多时候,iOS开发中需要弹出提示框来提示用户一些信息,但是MBProgressHud的显示可能会导致文字显示不全,这个时候就需要自定义一个弹出框来显示自己需要的文字.
-(void)updataWindows {
windows = [UIApplication sharedApplication].keyWindow;
view = [[UIView alloc]initWithFrame:CGRectMake(40, SCREEN_HEIGHT/2 - 40, SCREEN_WIDTH - 80, 80)];
view.backgroundColor = [UIColor blackColor];
view.layer.masksToBounds = YES;
view.layer.cornerRadius = 8.0f;
label = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, view.bounds.size.width, 80)];
label.numberOfLines = 3;
label.text = @" 您的信息已经重新提交,我们正在在加紧审核,请稍侯 ";
label.textColor = [UIColor whiteColor];
label.textAlignment = NSTextAlignmentCenter;
[windows addSubview:view];
[view addSubview:label];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)),dispatch_get_main_queue(), ^{
//2秒以后移除view
[view removeFromSuperview];
});
}
文/ZsilenceY(简书作者)
原文链接:http://www.jianshu.com/p/a7cd52ce8d08
著作权归作者所有,转载请联系作者获得授权,并标注“简书作者”。