Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
GMBase
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
GMBase
Commits
9b7d1d72
Commit
9b7d1d72
authored
May 13, 2020
by
jz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
4d540877
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
730 additions
and
0 deletions
+730
-0
AllLayoutButton.swift
GMBase/Classes/Common/AllLayoutButton.swift
+139
-0
GMAdLabel.swift
GMBase/Classes/Common/GMAdLabel.swift
+59
-0
GMInstallmentView.h
GMBase/Classes/Common/GMInstallmentView.h
+17
-0
GMInstallmentView.m
GMBase/Classes/Common/GMInstallmentView.m
+56
-0
GMInsuranceView.h
GMBase/Classes/Common/GMInsuranceView.h
+12
-0
GMInsuranceView.m
GMBase/Classes/Common/GMInsuranceView.m
+49
-0
GMLiveWelfareView.h
GMBase/Classes/Common/GMLiveWelfareView.h
+112
-0
GMLiveWelfareView.m
GMBase/Classes/Common/GMLiveWelfareView.m
+286
-0
No files found.
GMBase/Classes/Common/AllLayoutButton.swift
0 → 100644
View file @
9b7d1d72
//
// FixHorzontalLayoutButton.swift
// Gengmei
//
// Created by wangyang on 16/5/16.
// Copyright © 2016年 更美互动信息科技有限公司. All rights reserved.
//
import
UIKit
//import GMBaseSwift
/**
* @author licong, 15-09-27 17:09:12
*
* Button同时存在图片和文字时候的排列样式
*
* @since 5.2.0
*/
@objc
public
enum
ImageTitleType
:
Int
{
case
imageLeftTitleRight
=
0
case
imageRightTitleLeft
=
1
case
imageTopTitleBottom
=
2
case
imageBottomTitleTop
=
3
func
isHorizontalLayout
()
->
Bool
{
if
self
.
rawValue
<
2
{
return
true
}
else
{
return
false
}
}
}
/// 注意:不能在tableView或者collectionView中使用
@objcMembers
public
class
AllLayoutButton
:
GMButton
{
public
var
type
=
ImageTitleType
.
imageRightTitleLeft
public
var
space
:
CGFloat
=
5.0
public
var
margin
=
UIEdgeInsets
.
zero
public
convenience
init
(
image
:
UIImage
?,
title
:
String
?,
titleColor
:
UIColor
?,
font
:
UIFont
?)
{
self
.
init
()
setTitle
(
title
,
for
:
.
normal
)
setImage
(
image
,
for
:
.
normal
)
setTitleColor
(
titleColor
,
for
:
.
normal
)
if
font
!=
nil
{
titleLabel
?
.
font
=
font
}
}
override
public
func
layoutSubviews
()
{
super
.
layoutSubviews
()
self
.
titleEdgeInsets
=
UIEdgeInsets
.
zero
self
.
imageEdgeInsets
=
UIEdgeInsets
.
zero
/* 以水平模式来讲解。把titleLabel、image和space看作一个整体square,这个整体的大小正好可以用 intrinsicContentSize 来表示。
centerX是button的中心点
|----------------------------------|
| |
| |--------------| |-------| |
| | Label | s| Image | |
| | | | | |
| |--------------| |-------| |
| |
|----------------------------------|
|centerX
| squareSize |
*/
let
buttonWidth
=
bounds
.
size
.
width
let
buttonHeight
=
bounds
.
size
.
height
let
centerX
=
buttonWidth
/
2.0
let
centerY
=
buttonHeight
/
2.0
let
squareSize
=
intrinsicContentSize
let
squareLeft
=
floor
(
centerX
-
squareSize
.
width
/
2
)
let
squareRight
=
floor
(
centerX
+
squareSize
.
width
/
2
)
let
spuareTop
=
floor
(
centerY
-
squareSize
.
height
/
2
)
let
spuareBottom
=
floor
(
centerY
+
squareSize
.
height
/
2
)
switch
type
{
case
.
imageLeftTitleRight
:
imageView
?
.
left
=
squareLeft
+
margin
.
left
titleLabel
?
.
right
=
squareRight
-
margin
.
right
case
.
imageRightTitleLeft
:
titleLabel
?
.
left
=
squareLeft
+
margin
.
left
imageView
?
.
right
=
squareRight
-
margin
.
right
case
.
imageTopTitleBottom
:
imageView
?
.
top
=
spuareTop
+
margin
.
top
imageView
?
.
centerX
=
centerX
titleLabel
?
.
bottom
=
spuareBottom
-
margin
.
bottom
titleLabel
?
.
width
=
squareSize
.
width
titleLabel
?
.
centerX
=
centerX
case
.
imageBottomTitleTop
:
titleLabel
?
.
top
=
spuareTop
+
margin
.
top
titleLabel
?
.
width
=
squareSize
.
width
titleLabel
?
.
centerX
=
centerX
imageView
?
.
bottom
=
spuareBottom
-
margin
.
bottom
imageView
?
.
centerX
=
centerX
}
}
override
public
var
intrinsicContentSize
:
CGSize
{
var
size
=
super
.
intrinsicContentSize
size
.
width
+=
margin
.
left
+
margin
.
right
size
.
height
+=
margin
.
top
+
margin
.
bottom
let
labelHeight
=
titleLabel
?
.
intrinsicContentSize
.
height
let
labelWidth
=
titleLabel
?
.
intrinsicContentSize
.
width
let
imageViewHeight
=
imageView
?
.
intrinsicContentSize
.
height
let
imageViewWidth
=
imageView
?
.
intrinsicContentSize
.
width
if
type
.
isHorizontalLayout
()
{
size
.
width
+=
space
}
else
{
//竖直image和title竖直排列
size
.
height
=
labelHeight
!
+
imageViewHeight
!
+
space
if
labelWidth
!=
nil
&&
imageViewWidth
!=
nil
&&
labelWidth
!
>
imageViewWidth
!
{
size
.
width
=
labelWidth
!
}
else
{
size
.
width
=
imageViewWidth
!
}
}
return
size
}
// 强制刷新,否则 layout会不正确
override
public
func
setTitle
(
_
title
:
String
?,
for
state
:
UIControl
.
State
)
{
super
.
setTitle
(
title
,
for
:
state
)
self
.
layoutIfNeeded
()
}
// 强制刷新,否则 layout会不正确
override
public
func
setImage
(
_
image
:
UIImage
?,
for
state
:
UIControl
.
State
)
{
super
.
setImage
(
image
,
for
:
state
)
self
.
layoutIfNeeded
()
}
}
GMBase/Classes/Common/GMAdLabel.swift
0 → 100644
View file @
9b7d1d72
//
// GMAdLabel.swift
// Gengmei
//
// Created by Terminator on 2016/12/22.
// Copyright © 2016年 更美互动信息科技有限公司. All rights reserved.
//
import
UIKit
//import GMBaseSwift
@objcMembers
public
class
GMAdLabel
:
GMLabel
{
var
ADText
=
""
{
didSet
{
adLabel
.
text
=
ADText
}
}
var
adLabel
=
GMLabel
()
var
isSHowAD
=
false
{
didSet
{
if
isSHowAD
{
adLabel
.
isHidden
=
false
}
else
{
adLabel
.
isHidden
=
true
}
}
}
required
init
?(
coder
aDecoder
:
NSCoder
)
{
super
.
init
(
coder
:
aDecoder
)
}
public
var
adLabelTop
=
0
{
didSet
{
adLabel
.
snp
.
remakeConstraints
{
(
make
)
in
make
.
left
.
equalTo
(
0
)
make
.
top
.
equalTo
(
adLabelTop
)
}
}
}
override
init
(
frame
:
CGRect
)
{
super
.
init
(
frame
:
frame
)
adLabel
.
isHidden
=
true
adLabel
.
layer
.
cornerRadius
=
3
adLabel
.
clipsToBounds
=
true
adLabel
.
layer
.
borderColor
=
UIColor
.
secondaryVisual
.
cgColor
adLabel
.
layer
.
borderWidth
=
Constant
.
onePixel
adLabel
.
backgroundColor
=
UIColor
.
white
adLabel
.
font
=
UIFont
.
gmFont
(
10
)
adLabel
.
textColor
=
UIColor
.
secondaryVisual
// 设计图是(2, 5, 2, 5),但是由于字体本身上下有空白,所以改为
adLabel
.
paddingEdge
=
UIEdgeInsets
(
top
:
1
,
left
:
5
,
bottom
:
1
,
right
:
5
)
adLabel
.
textAlignment
=
.
center
addSubview
(
adLabel
)
}
}
GMBase/Classes/Common/GMInstallmentView.h
0 → 100644
View file @
9b7d1d72
//
// GMInstallmentView.h
// Gengmei
//
// Created by Terminator on 16/10/23.
// Copyright © 2016年 更美互动信息科技有限公司. All rights reserved.
//
#import "GMView.h"
#import "GMImageView.h"
#import "GMHighlightLabel.h"
@interface
GMInstallmentView
:
GMView
@property
(
nonatomic
,
strong
)
GMHighlightLabel
*
promoteLabel
;
@property
(
nonatomic
,
strong
)
GMImageView
*
icon
;
@end
GMBase/Classes/Common/GMInstallmentView.m
0 → 100644
View file @
9b7d1d72
//
// GMInstallmentView.m
// Gengmei
//
// Created by Terminator on 16/10/23.
// Copyright © 2016年 更美互动信息科技有限公司. All rights reserved.
//
#import "GMInstallmentView.h"
#import <GMKit/GMFont.h>
#import <GMKit/UIColor+GMTheme.h>
#import <GMKit/UIView+LineWithAutolayout.h>
@interface
GMInstallmentView
()
@property
(
nonatomic
,
strong
)
GMView
*
installView
;
@end
@implementation
GMInstallmentView
-
(
void
)
setup
{
[
super
setup
];
_installView
=
[[
GMView
alloc
]
init
];
[
_installView
addTopLineWithLeft
:
15
right
:
-
15
];
[
self
addSubview
:
_installView
];
[
_installView
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
mas_equalTo
(
0
);
make
.
right
.
mas_equalTo
(
0
);
make
.
top
.
mas_equalTo
(
0
);
make
.
height
.
mas_equalTo
(
45
);
}];
_icon
=
[[
GMImageView
alloc
]
init
];
_icon
.
image
=
[
UIImage
imageNamed
:
@"installment_icon"
];
[
_installView
addSubview
:
_icon
];
[
_icon
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
mas_equalTo
(
15
);
make
.
centerY
.
mas_equalTo
(
0
);
}];
_promoteLabel
=
[[
GMHighlightLabel
alloc
]
init
];
[
_promoteLabel
setContentHuggingPriority
:
100
forAxis
:
UILayoutConstraintAxisHorizontal
];
[
_promoteLabel
setContentCompressionResistancePriority
:
1000
forAxis
:
UILayoutConstraintAxisHorizontal
];
_promoteLabel
.
hightlightColor
=
UIColor
.
secondaryVisual
;
_promoteLabel
.
normalColor
=
UIColor
.
bodyText
;
_promoteLabel
.
textColor
=
UIColor
.
bodyText
;
_promoteLabel
.
font
=
[
UIFont
gmFont
:
11
];
_promoteLabel
.
hightlightFont
=
[
UIFont
gmBoldFont
:
11
];
[
_installView
addSubview
:
_promoteLabel
];
[
_promoteLabel
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
equalTo
(
_icon
.
mas_right
).
offset
(
10
);
make
.
right
.
mas_lessThanOrEqualTo
(
-
15
);
make
.
centerY
.
equalTo
(
_icon
.
mas_centerY
);
}];
}
@end
GMBase/Classes/Common/GMInsuranceView.h
0 → 100644
View file @
9b7d1d72
//
// GMInsuranceView.h
// Gengmei
//
// Created by 翟国钧 on 2017/2/13.
// Copyright © 2017年 更美互动信息科技有限公司. All rights reserved.
//
#import "GMView.h"
#import "GMLabel.h"
@interface
GMInsuranceView
:
GMView
@property
(
nonatomic
,
strong
)
GMLabel
*
insuranceLabel
;
@end
GMBase/Classes/Common/GMInsuranceView.m
0 → 100644
View file @
9b7d1d72
//
// GMInsuranceView.m
// Gengmei
//
// Created by 翟国钧 on 2017/2/13.
// Copyright © 2017年 更美互动信息科技有限公司. All rights reserved.
//
#import "GMInsuranceView.h"
#import "GMImageView.h"
#import <GMKit/UIColor+GMTheme.h>
#import <GMKit/UIView+LineWithAutolayout.h>
@interface
GMInsuranceView
()
@property
(
nonatomic
,
strong
)
GMView
*
installView
;
@property
(
nonatomic
,
strong
)
GMImageView
*
icon
;
@end
@implementation
GMInsuranceView
-
(
void
)
setup
{
[
super
setup
];
_installView
=
[[
GMView
alloc
]
init
];
[
_installView
addTopLineWithLeft
:
15
right
:
-
15
];
[
self
addSubview
:
_installView
];
[
_installView
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
mas_equalTo
(
0
);
make
.
right
.
mas_equalTo
(
0
);
make
.
top
.
mas_equalTo
(
0
);
make
.
height
.
mas_equalTo
(
45
);
}];
_icon
=
[[
GMImageView
alloc
]
init
];
_icon
.
image
=
[
UIImage
imageNamed
:
@"welfare_insurance"
];
[
_installView
addSubview
:
_icon
];
[
_icon
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
mas_equalTo
(
15
);
make
.
centerY
.
mas_equalTo
(
0
);
}];
_insuranceLabel
=
[
GMLabel
labelWithTextColor
:
UIColor
.
bodyText
fontSize
:
11
];
[
_installView
addSubview
:
_insuranceLabel
];
[
_insuranceLabel
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
equalTo
(
_icon
.
mas_right
).
offset
(
10
);
make
.
centerY
.
equalTo
(
_icon
.
mas_centerY
);
}];
}
@end
GMBase/Classes/Common/GMLiveWelfareView.h
0 → 100644
View file @
9b7d1d72
//
// GMLiveWelfareView.h
// Gengmei
//
// Created by 汪俊 on 2017/3/30.
// Copyright © 2017年 更美互动信息科技有限公司. All rights reserved.
//
#import "GMImageView.h"
#import "GMInstallmentView.h"
#import "GMInsuranceView.h"
//#import "Gengmei-Swift.h"
@class
AllLayoutButton
;
@class
GMLiveWelfareView
;
@class
GMAdLabel
;
@protocol
GMLiveWelfareViewDelegate
<
NSObject
>
-
(
void
)
didSelectedWelfareView
:
(
GMLiveWelfareView
*
)
welFareView
;
-
(
void
)
didClickedHospitalDetailButton
:(
AllLayoutButton
*
)
button
;
@end
/**
直播和回放页面的美购
*/
@interface
GMLiveWelfareView
:
GMView
@property
(
nonatomic
,
strong
)
GMView
*
welfareContainer
;
/** @brief 美购大图片 */
@property
(
nonatomic
,
strong
)
GMImageView
*
bigIconImage
;
/** @brief 预付价 */
@property
(
nonatomic
,
strong
)
GMImageView
*
yufuImage
;
/** @brief 已售完 */
@property
(
nonatomic
,
strong
)
GMImageView
*
sallOutImage
;
/** @brief 美购标题 */
@property
(
nonatomic
,
strong
)
GMLabel
*
welfareTitle
;
/** @brief 美购简介 */
@property
(
nonatomic
,
strong
)
GMAdLabel
*
welfareContent
;
/** @brief 更美价 */
@property
(
nonatomic
,
strong
)
GMLabel
*
gengmeiPrice
;
/** @brief 市场价 */
@property
(
nonatomic
,
strong
)
GMLabel
*
marketPrice
;
/** @brief 删除线 */
@property
(
nonatomic
,
strong
)
GMLabel
*
deleteLabel
;
/** @brief 人民币(元/元起) */
@property
(
nonatomic
,
strong
)
GMLabel
*
yuanLabel
;
/** @brief 预付款标签 */
@property
(
nonatomic
,
strong
)
GMLabel
*
yufuLabel
;
/** @brief 申请数 */
@property
(
nonatomic
,
strong
)
GMLabel
*
applyNumber
;
/** @brief 剩余多少个*/
@property
(
nonatomic
,
strong
)
GMLabel
*
surplusLabel
;
/** @brief 城市 */
@property
(
nonatomic
,
strong
)
GMLabel
*
cityLabel
;
/** @brief 医生 */
@property
(
nonatomic
,
strong
)
GMLabel
*
doctorLabel
;
/** @brief 机构 */
@property
(
nonatomic
,
strong
)
GMLabel
*
hospitalLabel
;
/**状态栏背景*/
@property
(
nonatomic
,
strong
)
GMView
*
statusBG
;
/** @brief */
@property
(
nonatomic
,
strong
)
UIView
*
surplusBG
;
/** @brief 秒杀价图片*/
@property
(
nonatomic
,
strong
)
GMImageView
*
seckillIcon
;
/** seckill是否隐藏*/
@property
(
nonatomic
,
assign
)
BOOL
isSeckillHidden
;
/**
展示推广label
@author wangjun 16-08-01 in 6.3.0
*/
@property
(
nonatomic
,
assign
)
BOOL
showPromotion
;
/**
分期提示
*/
//@property (nonatomic, strong) GMInstallmentView *installmentView;
/**
保险提示
*/
//@property (nonatomic, strong) GMInsuranceView *insuranceView;
/**
是否展示推分期
*/
//@property (nonatomic, assign) BOOL showInstallment;
/**
是否展示保险
*/
//@property (nonatomic, assign) BOOL showInsurance;
@property
(
nonatomic
,
strong
)
UIImageView
*
hospitalBg
;
@property
(
nonatomic
,
weak
)
id
<
GMLiveWelfareViewDelegate
>
delegate
;
-
(
void
)
show
;
-
(
void
)
hide
;
@end
GMBase/Classes/Common/GMLiveWelfareView.m
0 → 100644
View file @
9b7d1d72
//
// GMLiveWelfareView.m
// Gengmei
//
// Created by 汪俊 on 2017/3/30.
// Copyright © 2017年 更美互动信息科技有限公司. All rights reserved.
//
#import "GMLiveWelfareView.h"
#import "UIView+Layout.h"
#import <GMBase/GMBase-Swift.h>
//#import "GMAdLabel.h"
#import <GMKit/GMKit-umbrella.h>
//#import "AllLayoutButton.swift"
@interface
GMLiveWelfareView
()
@property
(
nonatomic
,
strong
)
AllLayoutButton
*
rightButton
;
@property
(
nonatomic
,
strong
)
GMLabel
*
leftLabel
;
@end
@implementation
GMLiveWelfareView
-
(
void
)
setup
{
[
super
setup
];
__weak
typeof
(
self
)
weakSelf
=
self
;
[
self
setTapActionWithBlock
:
^
{
[
weakSelf
welfareItemDidClicked
];
}];
self
.
backgroundColor
=
UIColor
.
whiteColor
;
_leftLabel
=
[
GMLabel
labelWithTextColor
:
UIColor
.
headlineText
fontSize
:
16
];
_leftLabel
.
text
=
@"相关美购"
;
[
self
addSubview
:
_leftLabel
];
[
_leftLabel
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
mas_equalTo
(
15
);
make
.
top
.
mas_equalTo
(
14
);
}];
_hospitalBg
=
[[
UIImageView
alloc
]
initWithImage
:[
UIImage
imageNamed
:
@"live_hospital_bg"
]];
_hospitalBg
.
userInteractionEnabled
=
YES
;
[
self
addSubview
:
_hospitalBg
];
[
_hospitalBg
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
right
.
mas_equalTo
(
0
);
make
.
top
.
mas_equalTo
(
4
.
5
);
make
.
size
.
mas_equalTo
(
CGSizeMake
(
102
,
33
));
}];
_rightButton
=
[[
AllLayoutButton
alloc
]
initWithImage
:[
UIImage
imageNamed
:
@"live_hospital_arrow"
]
title
:
@"医生主页"
titleColor
:
UIColor
.
whiteColor
font
:
[
UIFont
gmFont
:
15
]];
_rightButton
.
space
=
6
;
_rightButton
.
type
=
ImageTitleTypeImageRightTitleLeft
;
_rightButton
.
enableAdaptive
=
YES
;
_rightButton
.
margin
=
UIEdgeInsetsMake
(
0
,
18
,
0
,
0
);
[
_rightButton
addTarget
:
self
action
:
@selector
(
hospitalDetailAction
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
_hospitalBg
addSubview
:
_rightButton
];
[
_rightButton
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
mas_equalTo
(
0
);
make
.
centerY
.
mas_equalTo
(
_hospitalBg
);
}];
[
self
addHorizontalLineWithTop
:
42
left
:
0
right
:
0
];
_welfareContainer
=
[[
GMView
alloc
]
init
];
// _welfareContainer.backgroundColor = [UIColor redColor];
[
self
addSubview
:
_welfareContainer
];
[
_welfareContainer
mas_makeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
mas_equalTo
(
42
);
make
.
left
.
right
.
mas_equalTo
(
0
);
if
(
UIDevice
.
aspectRatioType
==
GMDeviceAspectRatioTypeWide
){
make
.
bottom
.
mas_equalTo
(
-
18
);
}
else
{
make
.
bottom
.
mas_equalTo
(
0
);
}
}];
_bigIconImage
=
[[
GMImageView
alloc
]
init
];
_bigIconImage
.
layer
.
cornerRadius
=
2
.
5
;
_bigIconImage
.
layer
.
masksToBounds
=
YES
;
_bigIconImage
.
backgroundColor
=
UIColor
.
background
;
[
_welfareContainer
addSubview
:
_bigIconImage
];
_surplusBG
=
[[
UIView
alloc
]
init
];
_surplusBG
.
backgroundColor
=
[[
UIColor
blackColor
]
colorWithAlphaComponent
:
0
.
7
];
[
_bigIconImage
addSubview
:
_surplusBG
];
_statusBG
=
[[
GMView
alloc
]
init
];
[
_bigIconImage
addSubview
:
_statusBG
];
_surplusLabel
=
[
GMLabel
labelWithTextColor
:
UIColor
.
whiteColor
fontSize
:
10
];
_surplusLabel
.
textColor
=
[
UIColor
whiteColor
];
_surplusLabel
.
font
=
[
UIFont
gmFont
:
10
];
[
_statusBG
addSubview
:
_surplusLabel
];
_welfareContent
=
[[
GMAdLabel
alloc
]
init
];
//[GMAdLabel labelWithTextColor:UIColor.headlineText fontSize:14];
_welfareContent
.
textColor
=
UIColor
.
headlineText
;
_welfareContent
.
font
=
[
UIFont
gmFont
:
14
];
_welfareContent
.
numberOfLines
=
2
;
_welfareContent
.
adLabelTop
=
4
;
[
_welfareContainer
addSubview
:
_welfareContent
];
_doctorLabel
=
[[
GMLabel
alloc
]
init
];
_doctorLabel
.
textAlignment
=
NSTextAlignmentLeft
;
_doctorLabel
.
verticalAlignment
=
GMLabelVerticalAlignmentMiddle
;
_doctorLabel
.
font
=
[
UIFont
gmFont
:
12
];
_doctorLabel
.
textColor
=
UIColor
.
auxiliaryTextLight
;
[
_welfareContainer
addSubview
:
_doctorLabel
];
_hospitalLabel
=
[[
GMLabel
alloc
]
init
];
_hospitalLabel
.
textAlignment
=
NSTextAlignmentLeft
;
_hospitalLabel
.
verticalAlignment
=
GMLabelVerticalAlignmentMiddle
;
_hospitalLabel
.
font
=
[
UIFont
gmFont
:
12
];
_hospitalLabel
.
textColor
=
UIColor
.
auxiliaryTextLight
;
[
_welfareContainer
addSubview
:
_hospitalLabel
];
[
_doctorLabel
setContentHuggingPriority
:
252
forAxis
:
UILayoutConstraintAxisHorizontal
];
[
_doctorLabel
setContentCompressionResistancePriority
:
751
forAxis
:
UILayoutConstraintAxisHorizontal
];
[
_hospitalLabel
setContentHuggingPriority
:
251
forAxis
:
UILayoutConstraintAxisHorizontal
];
[
_hospitalLabel
setContentCompressionResistancePriority
:
750
forAxis
:
UILayoutConstraintAxisHorizontal
];
_seckillIcon
=
[[
GMImageView
alloc
]
initWithImage
:[
UIImage
imageNamed
:
@"seckill_shop"
]];
[
_welfareContainer
addSubview
:
_seckillIcon
];
_gengmeiPrice
=
[
GMLabel
labelWithTextColor
:
UIColor
.
secondaryVisual
fontSize
:
15
];
[
_welfareContainer
addSubview
:
_gengmeiPrice
];
_gengmeiPrice
.
font
=
[
UIFont
gmFont
:
15
];
_yuanLabel
=
[
GMLabel
labelWithTextColor
:
UIColor
.
secondaryVisual
fontSize
:
11
];
[
_welfareContainer
addSubview
:
_yuanLabel
];
_marketPrice
=
[
GMLabel
labelWithTextColor
:
UIColor
.
auxiliaryTextLight
fontSize
:
9
];
[
_welfareContainer
addSubview
:
_marketPrice
];
_deleteLabel
=
[
GMLabel
new
];
_deleteLabel
.
backgroundColor
=
UIColor
.
auxiliaryTextLight
;
[
_marketPrice
addSubview
:
_deleteLabel
];
_applyNumber
=
[
GMLabel
labelWithTextColor
:
UIColor
.
auxiliaryTextLight
fontSize
:
11
];
[
_welfareContainer
addSubview
:
_applyNumber
];
//
// _installmentView = [[GMInstallmentView alloc] init];
// _installmentView.layer.masksToBounds = YES;
// [_welfareContainer addSubview:_installmentView];
//
// _insuranceView = [[GMInsuranceView alloc] init];
// _insuranceView.layer.masksToBounds = YES;
// [_welfareContainer addSubview:_insuranceView];
}
-
(
void
)
updateConstraints
{
[
_bigIconImage
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
mas_equalTo
(
15
);
make
.
top
.
mas_equalTo
(
15
);
make
.
size
.
mas_equalTo
(
CGSizeMake
(
100
,
100
));
}];
[
_statusBG
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
mas_equalTo
(
0
);
make
.
bottom
.
equalTo
(
_bigIconImage
.
mas_bottom
).
offset
(
-
8
);
}];
[
_surplusLabel
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
mas_equalTo
(
5
);
make
.
right
.
mas_equalTo
(
-
5
);
make
.
top
.
mas_equalTo
(
0
);
make
.
bottom
.
mas_equalTo
(
0
);
}];
[
_doctorLabel
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
equalTo
(
_bigIconImage
.
mas_right
).
offset
(
15
);
make
.
top
.
equalTo
(
_welfareContent
.
mas_bottom
).
offset
(
5
);
}];
[
_hospitalLabel
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
equalTo
(
_doctorLabel
.
mas_right
).
offset
(
10
);
make
.
right
.
mas_equalTo
(
-
10
);
make
.
top
.
equalTo
(
_doctorLabel
.
mas_top
);
}];
[
_seckillIcon
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
equalTo
(
_bigIconImage
.
mas_right
).
offset
(
15
);
make
.
centerY
.
equalTo
(
_gengmeiPrice
.
mas_centerY
);
make
.
size
.
sizeOffset
(
CGSizeMake
(
25
,
13
));
}];
[
_deleteLabel
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
mas_equalTo
(
0
);
make
.
height
.
mas_equalTo
(
0
.
5
);
make
.
centerY
.
equalTo
(
_marketPrice
.
mas_centerY
).
offset
(
0
);
make
.
width
.
mas_equalTo
(
_marketPrice
.
mas_width
);
}];
[
_applyNumber
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
right
.
mas_equalTo
(
-
10
);
make
.
centerY
.
equalTo
(
_gengmeiPrice
.
mas_centerY
);
}];
[
_yuanLabel
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
equalTo
(
_gengmeiPrice
.
mas_right
).
offset
(
2
);
make
.
bottom
.
equalTo
(
_bigIconImage
.
mas_bottom
).
offset
(
0
);
}];
// [_installmentView mas_remakeConstraints:^(MASConstraintMaker *make) {
// make.top.equalTo(_bigIconImage.mas_bottom).offset(15);
// make.left.right.mas_equalTo(0);
// make.height.mas_equalTo(35);
// }];
// [_insuranceView mas_remakeConstraints:^(MASConstraintMaker *make) {
// make.top.equalTo(_installmentView.mas_bottom).offset(0);
// make.left.right.mas_equalTo(0);
// make.height.mas_equalTo(35);
// }];
[
_marketPrice
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
left
.
equalTo
(
_yuanLabel
.
hidden
?
_gengmeiPrice
.
mas_right
:
_yuanLabel
.
mas_right
).
offset
(
5
);
make
.
bottom
.
equalTo
(
_bigIconImage
.
mas_bottom
).
offset
(
0
);
}];
[
_gengmeiPrice
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
if
(
_isSeckillHidden
)
{
make
.
left
.
equalTo
(
_bigIconImage
.
mas_right
).
offset
(
15
);
}
else
{
make
.
left
.
equalTo
(
_seckillIcon
.
mas_right
).
offset
(
5
);
}
make
.
bottom
.
mas_equalTo
(
_bigIconImage
.
mas_bottom
).
offset
(
2
);
}];
[
_welfareContent
mas_remakeConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
mas_equalTo
(
10
);
if
(
_showPromotion
)
{
make
.
left
.
equalTo
(
_bigIconImage
.
mas_right
).
offset
(
20
);
}
else
{
make
.
left
.
equalTo
(
_bigIconImage
.
mas_right
).
offset
(
15
);
}
make
.
right
.
mas_equalTo
(
-
15
);
}];
// [_installmentView mas_remakeConstraints:^(MASConstraintMaker *make) {
// make.top.equalTo(_bigIconImage.mas_bottom).offset(15);
// make.left.right.mas_equalTo(0);
// if (_showInstallment) {
// make.height.mas_equalTo(35);
// } else {
// make.height.mas_equalTo(0);
// }
// }];
//
// [_insuranceView mas_remakeConstraints:^(MASConstraintMaker *make) {
// make.top.equalTo(_installmentView.mas_bottom).offset(0);
// make.left.right.mas_equalTo(0);
// if (_showInsurance) {
// make.height.mas_equalTo(35);
// } else {
// make.height.mas_equalTo(0);
// }
// }];
[
super
updateConstraints
];
}
-
(
void
)
show
{
self
.
hidden
=
NO
;
[
self
mas_updateConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
mas_equalTo
(
MAINSCREEN_HEIGHT
-
self
.
height
);
}];
[
UIView
animateWithDuration
:
0
.
25
animations
:
^
{
[
self
.
superview
layoutIfNeeded
];
}];
}
-
(
void
)
hide
{
[
self
mas_updateConstraints
:
^
(
MASConstraintMaker
*
make
)
{
make
.
top
.
mas_equalTo
(
MAINSCREEN_HEIGHT
);
}];
[
UIView
animateWithDuration
:
0
.
25
animations
:
^
{
[
self
.
superview
layoutIfNeeded
];
}
completion
:^
(
BOOL
finished
)
{
self
.
hidden
=
YES
;
}];
}
-
(
void
)
welfareItemDidClicked
{
if
([
self
.
delegate
respondsToSelector
:
@selector
(
didSelectedWelfareView
:)])
{
[
self
.
delegate
didSelectedWelfareView
:
self
];
}
}
-
(
void
)
hospitalDetailAction
:
(
AllLayoutButton
*
)
button
{
if
([
self
.
delegate
respondsToSelector
:
@selector
(
didClickedHospitalDetailButton
:)])
{
[
self
.
delegate
didClickedHospitalDetailButton
:
button
];
}
}
@end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment