@property (nonatomic,strong)UIWindow *window;
_window = [[UIWindow alloc]initWithFrame: CGRectMake(0,0,MainScreenWidth, MainScreenHeight)];
_window.backgroundColor = [UIColor clearColor];
// _window.windowLevel = UIWindowLevelAlert+1;
[_window makeKeyAndVisible];//关键语句,显示window
CGFloat x=(MainScreenWidth-(MainScreenWidth-100))/2;
Issut_view=[[UIView alloc]initWithFrame:CGRectMake(x, 200,MainScreenWidth-100, 200)];
Issut_view.layer.borderWidth = 1;
Issut_view.layer.cornerRadius=3;
Issut_view.layer.borderColor = UIColorFromHEXColor(0xdfdfdf, 1).CGColor;
Issut_view.clipsToBounds = YES;
UILabel *label=[[UILabel alloc]initWithFrame:CGRectMake(40, 40, Issut_view.bounds.size.width-80, 80)];
label.textAlignment=NSTextAlignmentCenter;
label.font=[UIFontfontWithName:@"Helvetica"size:13.f];
label.numberOfLines=0;
UIButton *button2=[[UIButton alloc]initWithFrame:CGRectMake(Issut_view.bounds.size.width-125,Issut_view.bounds.size.height-75 , 80, 25)];
UIButton *button=[[UIButton alloc]initWithFrame:CGRectMake(45, Issut_view.bounds.size.height-75, 80, 25)];
button.tag=1;
//添加视图
[Issut_viewaddSubview:label];
[Issut_viewaddSubview:button];
[Issut_viewaddSubview:button2];
//设置button样式
[selfinitButton:button];
[selfinitButton:button2];
Issut_view.backgroundColor=[UIColor colorWithRed:247/255.0 green:247/255.0 blue:247/255.0 alpha:1];
[_window addSubview:Issut_view];
NSString*str=_responseVO.result.Fees;
NSString*dateStr = [NSStringstringWithFormat:@"转入%@,将收取%@元转挂牌费用是否确定转入",_responseVO.result.productName,str];
NSMutableAttributedString *mutAttStr = [[NSMutableAttributedString alloc]initWithString:dateStr];
[mutAttStraddAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:[dateStr rangeOfString:str]]; //根据具体字符串的内容来设置具体部分的颜色
label.attributedText=mutAttStr;
-(void)initButton:(UIButton*)btn
{
btn.clipsToBounds=YES;
btn.layer.cornerRadius=2;
btn.titleLabel.font = [UIFont systemFontOfSize:13];
if(btn.tag==1)
{
[btnsetTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
btn.backgroundColor=RedSegmentTextColor;
[btnsetTitle:@"确认" forState:UIControlStateNormal];
[btnaddTarget:self action:@selector(ConfirmAlertButton:) forControlEvents:UIControlEventTouchUpInside];
}else
{
[btnsetTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
btn.backgroundColor=[UIColor whiteColor];
[btnsetTitle:@"取消" forState:UIControlStateNormal];
[btnaddTarget:self action:@selector(ConfirmAlertButton:) forControlEvents:UIControlEventTouchUpInside];
btn.layer.masksToBounds = YES;
//设置边框的粗细
[ btn.layersetBorderWidth:0.5];
btn.layer.borderColor=[UIColor redColor].CGColor;
}
}
- (void)ConfirmAlertButton:(UIButton*)sender {
_window.hidden=YES;
_window=nil;
}
//取消alertview事件
- (void)DissAlertView:(id)sender {
_window.hidden=YES;//隐藏window
_window=nil;
}