//
|
// FileDownView.m
|
// GoldRich
|
//
|
// Created by WindShan on 2017/2/13.
|
// Copyright © 2017年 WindShan. All rights reserved.
|
//
|
|
#import "AdNoticeView.h"
|
#import "GloriaLabel.h"
|
|
@interface AdNoticeView()<SelectedNoticeDelegate>
|
{
|
|
}
|
|
@property (nonatomic, strong) UIImageView * noticeBK;
|
@property (nonatomic, strong) UIImageView * noticeLogo;
|
@property (nonatomic, strong) UIButton * cancelLookBtn;
|
//@property (nonatomic, strong) UIButton * lookDetailBtn;
|
@property (nonatomic, strong) GloriaLabel * noticeContext;
|
@property (nonatomic, strong) GloriaLabel * noticeTitle;
|
|
@end
|
|
|
@implementation AdNoticeView
|
|
- (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*)cancelLookBtn
|
{
|
if(!_cancelLookBtn)
|
{
|
_cancelLookBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
|
_cancelLookBtn.frame = CGRectMake((258-76)/2, 130, 76, 26);
|
[_cancelLookBtn setBackgroundImage:[UIImage imageNamed:@"cancel_look" ] forState:UIControlStateNormal];
|
[_cancelLookBtn setTitle:@"取 消" forState:UIControlStateNormal];
|
[_cancelLookBtn setTitleColor:kUIColorFromRGB(0x7d7d7d) forState:UIControlStateNormal];
|
//_deleteBtn.backgroundColor = [UIColor redColor]; //上左下右
|
|
_cancelLookBtn.titleLabel.font = [UIFont systemFontOfSize: 12.0];
|
[_cancelLookBtn addTarget:self action:@selector(CancelClickAction) forControlEvents:UIControlEventTouchUpInside];
|
[self.noticeBK addSubview:_cancelLookBtn];
|
}
|
|
return _cancelLookBtn;
|
}
|
|
//-(UIButton*)lookDetailBtn
|
//{
|
// if(!_lookDetailBtn)
|
// {
|
// _lookDetailBtn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
|
// _lookDetailBtn.frame = CGRectMake(258-40-76, 168-52, 76, 26);
|
// [_lookDetailBtn setBackgroundImage:[UIImage imageNamed:@"look_notice" ] forState:UIControlStateNormal];
|
// [_lookDetailBtn setTitle:@"查看详情" forState:UIControlStateNormal];
|
// [_lookDetailBtn setTitleColor:kUIColorFromRGB(0xffffff) forState:UIControlStateNormal];
|
// //_deleteBtn.backgroundColor = [UIColor redColor]; //上左下右
|
//
|
// _lookDetailBtn.titleLabel.font = [UIFont systemFontOfSize: 12.0];
|
// [_lookDetailBtn addTarget:self action:@selector(LookClickAction) forControlEvents:UIControlEventTouchUpInside];
|
//
|
// [_lookDetailBtn setTintColor:RgbColor(253,137,8)];
|
//
|
// [self.noticeBK addSubview:_lookDetailBtn];
|
// }
|
//
|
// return _cancelLookBtn;
|
//}
|
|
-(void)CancelClickAction
|
{
|
[self setHidden:YES];
|
// // 查看文件
|
// if ( _delegate && [_delegate respondsToSelector:@selector(didSelectedNoticeSection:)])
|
// {
|
// [_delegate didSelectedNoticeSection:self.model];
|
// }
|
}
|
|
-(void)LookClickAction
|
{
|
// 查看文件
|
if ( _delegate && [_delegate respondsToSelector:@selector(didSelectedNoticeSection:)])
|
{
|
[_delegate didSelectedNoticeSection:self.model];
|
}
|
}
|
|
- (instancetype)initWithFrame:(CGRect)frame dataModel:(NoticeModel*)model
|
{
|
if (self = [super initWithFrame:frame])
|
{
|
//设置 背景为clear
|
self.backgroundColor = [UIColor clearColor];
|
self.opaque = NO;
|
|
// test
|
//for (int i = 0; i < 10; i++)
|
//{
|
// MyDeviceStatus * status = [[MyDeviceStatus alloc] init];
|
// [self.modelArray addObject:status];
|
//}
|
// 设置界面
|
self.model = model;
|
[self setUIView];
|
}
|
|
return self;
|
}
|
|
|
-(void)setUIView
|
{
|
//self.backgroundColor = [UIColor clearColor];
|
|
self.noticeBK.image = [UIImage imageNamed:@"notice_bg"];
|
self.noticeLogo.image = [UIImage imageNamed:@"img_logo"];
|
|
[self.noticeContext setText:[NSString stringWithFormat:@"昨天的PM2.5状况为差\n请您注意身边的污染源"]];
|
[self.noticeTitle setText:[NSString stringWithFormat:@"摩瑞尔温馨提醒"]];
|
// [self.lookDetailBtn setTitle:@"查看详情" forState:UIControlStateNormal];
|
[self.cancelLookBtn setTitle:@"取 消" forState:UIControlStateNormal];
|
}
|
|
@end
|