GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Coding-iOS/Coding_iOS/Views/ShopGoodsInfoView.m at master · coding/Coding-iOS

Expand file tree

/

ShopGoodsInfoView.m

Copy path
More file actions
More file actions

Latest commit

 

History

History
History
164 lines (132 loc) · 5.68 KB
/

ShopGoodsInfoView.m

Copy path

File metadata and controls

164 lines (132 loc) · 5.68 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
//
// ShopGoodsInfoView.m
// Coding_iOS
//
// Created by liaoyp on 15/11/21.
// Copyright © 2015年 Coding. All rights reserved.
//
#import "ShopGoodsInfoView.h"
#import "DashesLineView.h"
#define FONT(F) [UIFont systemFontOfSize:F]
@interface ShopGoodsInfoView()
{
UIImageView *_coverView;
UILabel *_priceLabel;
UILabel *_titleLabel;
UILabel *_descLabel;
UILabel *_countLabel;
UIButton *_codingCoinView;
}
@end
@implementation ShopGoodsInfoView
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self setUpContentView];
}
return self;
}
- (void)setUpContentView
{
UIView *superView = self;
_coverView = [[YLImageView alloc] initWithFrame:CGRectZero];
_coverView.backgroundColor = [UIColor colorWithHexString:@"0xe5e5e5"];
_coverView.contentMode = UIViewContentModeScaleAspectFill;
_coverView.layer.masksToBounds =YES;
[superView addSubview:_coverView];
_titleLabel = [[UILabel alloc] initWithFrame:CGRectZero];
_titleLabel.font = FONT(15);
_titleLabel.backgroundColor = [UIColor clearColor];
_titleLabel.textColor = kColor222;
[superView addSubview:_titleLabel];
_descLabel = [[UILabel alloc] initWithFrame:CGRectZero];
_descLabel.font = [UIFont systemFontOfSize:14];
_descLabel.numberOfLines = 0 ;
_descLabel.backgroundColor = [UIColor clearColor];
_descLabel.textColor = kColorDark7;
[superView addSubview:_descLabel];
_countLabel = [[UILabel alloc] initWithFrame:CGRectZero];
_countLabel.font = FONT(15);
_countLabel.backgroundColor = [UIColor clearColor];
_countLabel.text = @"ⅹ1";
_countLabel.textColor = kColorBrandBlue;
[superView addSubview:_countLabel];
_codingCoinView = [UIButton buttonWithType:UIButtonTypeCustom];
[_codingCoinView setImage:[UIImage imageNamed:@"shop_coding_coin_icon"] forState:UIControlStateNormal];
[_codingCoinView setTitle:@" 码币 " forState:UIControlStateNormal];
[_codingCoinView setTitleColor:kColorDark7 forState:UIControlStateNormal];
[_codingCoinView.titleLabel setFont:[UIFont systemFontOfSize:14.0]];
[superView addSubview:_codingCoinView];
_priceLabel = [UILabel labelWithFont:[UIFont systemFontOfSize:15] textColor:kColorBrandOrange];
[superView addSubview:_priceLabel];
[_coverView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(superView).offset(15);
make.left.equalTo(superView).offset(12);
make.width.height.mas_equalTo(80);
}];
[_titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(_coverView.mas_top);
make.left.equalTo(_coverView.mas_right).offset(20);
make.right.offset(-(20+13));
}];
[_countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(_titleLabel.mas_centerY);
make.right.equalTo(superView.mas_right).offset(-13);
make.width.offset(20);
}];
[_codingCoinView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(_coverView);
// make.top.equalTo(_titleLabel.mas_bottom).offset(10);
make.left.equalTo(_titleLabel.mas_left);
}];
[_priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.equalTo(_titleLabel);
make.bottom.equalTo(_coverView);
}];
DashesLineView *lineView = [[DashesLineView alloc] init];
lineView.lineColor = kColorDDD;
lineView.backgroundColor = [UIColor clearColor];
[superView addSubview:lineView];
[lineView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(_coverView.mas_bottom).offset(15);
make.left.equalTo(_coverView.mas_left);
make.right.equalTo(superView.mas_right).offset(-12);
make.height.offset(0.5);
}];
[_descLabel mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(lineView.mas_bottom).offset(10);
make.left.right.equalTo(lineView);
}];
[self mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(_coverView.mas_top).offset(-12);
make.bottom.equalTo(_descLabel.mas_bottom).offset(12);
make.width.offset(kScreen_Width);
}];
UIView *bottomLineView = [[UIView alloc] init];
bottomLineView.backgroundColor = kColorDDD;
[superView addSubview:bottomLineView];
[bottomLineView mas_makeConstraints:^(MASConstraintMaker *make) {
make.height.mas_equalTo(kLine_MinHeight);
make.left.right.bottom.equalTo(superView);
}];
}
- (void)configViewWithModel:(ShopGoods *)model
{
_titleLabel.text = [model.name componentsSeparatedByCharactersInSet:[NSCharacterSet characterSetWithCharactersInString:@"¥¥"]].firstObject;
NSString *points_cost = [NSString stringWithFormat:@" %@ 码币",[model.points_cost stringValue]];
[_codingCoinView setTitle:points_cost forState:UIControlStateNormal];
CGFloat price = model.points_cost.floatValue * 50;
if (price - ((int)price) < .1) {
_priceLabel.text = [NSString stringWithFormat:@"¥%.0f", price];
}else{
_priceLabel.text = [NSString stringWithFormat:@"¥%.1f", price];
}
[_coverView sd_setImageWithURL:[model.image urlImageWithCodePathResize:90* 2] placeholderImage:nil];
HtmlMedia *mHtml = [[HtmlMedia alloc] initWithString:model.description_mine showType:MediaShowTypeNone];
[_descLabel ea_setText:mHtml.contentDisplay lineSpacing:5];
// _descLabel.text = mHtml.contentDisplay;
CGFloat height = [self systemLayoutSizeFittingSize:UILayoutFittingExpandedSize].height;
self.frame = CGRectMake(0, 0, kScreen_Width, height);
}
@end
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.