很多时候,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];
});
}
这样就可以做出和MBProgressHud相似的效果了.