//
|
// SysTipsView.m
|
// GoldRich
|
//
|
// Created by WindShan on 2017/2/13.
|
// Copyright © 2017年 WindShan. All rights reserved.
|
//
|
|
#import "SysTipsView.h"
|
#import "GloriaLabel.h"
|
|
@interface SysTipsView()<SelectedActionDelegate>
|
{
|
|
}
|
|
@property (nonatomic, strong) UIImageView * noticeBK;
|
@property (nonatomic, strong) UIImageView * noticeLogo;
|
@property (nonatomic, strong) UIButton * cancelBtn;
|
@property (nonatomic, strong) UIButton * sureBtn;
|
@property (nonatomic, strong) GloriaLabel * noticeContext;
|
@property (nonatomic, strong) GloriaLabel * noticeTitle;
|
|
@end
|
|
|
@implementation SysTipsView
|
|
- (UIImageView *)noticeLogo
|
{
|
if (!_noticeLogo)
|
{
|
_noticeLogo = [[UIImageView alloc] initWithFrame:CGRectMake((258-32)/2, 50, 32, 12)];
|
[self.noticeBK addSubview:_noticeLogo];
|
}
|
|
return _noticeLogo;
|
}
|
|
|
- (UIImageView *)noticeBK
|
{
|
if (!_noticeBK)
|
{
|
_noticeBK = [[UIImageView alloc] initWithFrame:CGRectMake((SCREEN_WIDTH-258)/2, (SCREEN_HEIGHT-168)/2-64, 258, 168)];
|
[self.noticeBK setUserInteractionEnabled:YES];
|
[self addSubview:_noticeBK];
|
}
|
|
return _noticeBK;
|
}
|
|
- (GloriaLabel *) noticeTitle
|
{
|
if(!_noticeTitle)
|
{
|
_noticeTitle = [[GloriaLabel alloc] initWithFrame:CGRectMake(0,10,258, 20)];
|
_noticeTitle.font = [UIFont systemFontOfSize:16];
|
_noticeTitle.textAlignment = UITextAlignmentCenter;
|
_noticeTitle.textColor = kUIColorFromRGB(0xffffff);
|
[self.noticeBK addSubview:_noticeTitle];
|
}
|
|
return _noticeTitle;
|
}
|
|
- (GloriaLabel *) noticeContext
|
{
|
if(!_noticeContext)
|
{
|
_noticeContext = [[GloriaLabel alloc] initWithFrame:CGRectMake(20, 80,258-40, 40)];
|
_noticeContext.font = [UIFont systemFontOfSize:14];
|
_noticeContext.textAlignment = UITextAlignmentCenter;
|
//自动折行设置
|
_noticeContext.lineBreakMode = UILineBreakModeWordWrap;
|
_noticeContext.numberOfLines = 0;
|
_noticeContext.textColor = kUIColorFromRGB(0x414141);
|
[self.noticeBK addSubview:_noticeContext];
|
}
|
|
return _noticeContext;
|
}
|
|
|
-(UIButton*)cancelBtn
|
{
|
if(!_cancelBtn)
|
{
|
_cancelBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
|
_cancelBtn.frame = CGRectMake(30, 125, 76, 26);
|
[_cancelBtn setBackgroundImage:[UIImage imageNamed:@"cancel_look" ] forState:UIControlStateNormal];
|
[_cancelBtn setTitle:@"取 消" forState:UIControlStateNormal];
|
[_cancelBtn setTitleColor:kUIColorFromRGB(0x7d7d7d) forState:UIControlStateNormal];
|
//_deleteBtn.backgroundColor = [UIColor redColor]; //上左下右
|
|
_cancelBtn.titleLabel.font = [UIFont systemFontOfSize: 12.0];
|
[_cancelBtn addTarget:self action:@selector(CancelClickAction) forControlEvents:UIControlEventTouchUpInside];
|
[self.noticeBK addSubview:_cancelBtn];
|
}
|
|
return _cancelBtn;
|
}
|
|
-(UIButton*)sureBtn
|
{
|
if(!_sureBtn)
|
{
|
_sureBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
|
_sureBtn.frame = CGRectMake(258-76-30, 125, 76, 26);
|
[_sureBtn setBackgroundImage:[UIImage imageNamed:@"look_notice" ] forState:UIControlStateNormal];
|
[_sureBtn setTitle:@"确定" forState:UIControlStateNormal];
|
[_sureBtn setTitleColor:kUIColorFromRGB(0xffffff) forState:UIControlStateNormal];
|
//_deleteBtn.backgroundColor = [UIColor redColor]; //上左下右
|
|
_sureBtn.titleLabel.font = [UIFont systemFontOfSize: 12.0];
|
[_sureBtn addTarget:self action:@selector(SureClickAction) forControlEvents:UIControlEventTouchUpInside];
|
|
[_sureBtn setTintColor:RgbColor(253,137,8)];
|
|
[self.noticeBK addSubview:_sureBtn];
|
}
|
|
return _sureBtn;
|
}
|
|
-(void)CancelClickAction
|
{
|
[self setHidden:YES];
|
// 查看文件
|
if ( _delegate && [_delegate respondsToSelector:@selector(didSelectedAction:)])
|
{
|
[_delegate didSelectedAction:0];
|
}
|
}
|
|
-(void)SureClickAction
|
{
|
// 查看文件
|
if ( _delegate && [_delegate respondsToSelector:@selector(didSelectedAction:)])
|
{
|
[_delegate didSelectedAction:1];
|
}
|
}
|
|
- (instancetype)initWithFrame:(CGRect)frame tipsTitle:(NSString*)title tipsContext:(NSString*)context;
|
{
|
if (self = [super initWithFrame:frame])
|
{
|
//设置 背景为clear
|
self.backgroundColor = [UIColor clearColor];
|
self.opaque = NO;
|
|
|
[self setUIView:title tipsContext:context];
|
}
|
|
return self;
|
}
|
|
|
-(void)setUIView:(NSString*)title tipsContext:(NSString*)context;
|
{
|
//self.backgroundColor = [UIColor clearColor];
|
self.noticeBK.image = [UIImage imageNamed:@"notice_bg"];
|
self.noticeLogo.image = [UIImage imageNamed:@"img_logo"];
|
|
[self.noticeContext setText:context];
|
[self.noticeTitle setText:title];
|
[self.sureBtn setTitle:@"确 定" forState:UIControlStateNormal];
|
[self.cancelBtn setTitle:@"取 消" forState:UIControlStateNormal];
|
}
|
|
@end
|