|
@@ -10,13 +10,15 @@
|
|
|
|
|
|
@interface SurfaceSearchView ()
|
|
|
|
|
|
-@property (nonatomic, strong) UIView *bgView;
|
|
|
-@property (nonatomic, strong) TDButton *searchButton;
|
|
|
-@property (nonatomic, strong) UIView *lineView;
|
|
|
+@property (nonatomic, strong) UIView *bgView;
|
|
|
+@property (nonatomic, strong) UIButton *searchButton;
|
|
|
+@property (nonatomic, strong) UIView *lineView;
|
|
|
|
|
|
@property (nonatomic, strong) TDButton *backButton;
|
|
|
@property (nonatomic, strong) TDButton *menuButton;
|
|
|
|
|
|
+@property (nonatomic, strong) UIView *shulineV;
|
|
|
+@property (nonatomic, strong) UIButton *bookBtn;
|
|
|
@end
|
|
|
|
|
|
@implementation SurfaceSearchView
|
|
@@ -28,6 +30,8 @@
|
|
|
if (self) {
|
|
|
[self addSubview:self.bgView];
|
|
|
[self addSubview:self.searchButton];
|
|
|
+ [self addSubview:self.shulineV];
|
|
|
+ [self addSubview:self.bookBtn];
|
|
|
}
|
|
|
return self;
|
|
|
}
|
|
@@ -83,7 +87,12 @@
|
|
|
}
|
|
|
[[self viewController].navigationController popViewControllerAnimated:YES];
|
|
|
}
|
|
|
-
|
|
|
+- (void)bookButtonAction:(UIButton *)sender
|
|
|
+{
|
|
|
+ if (self.bookBlock) {
|
|
|
+ self.bookBlock();
|
|
|
+ }
|
|
|
+}
|
|
|
#pragma mark - setter
|
|
|
- (UIView *)bgView {
|
|
|
if (!_bgView) {
|
|
@@ -96,19 +105,23 @@
|
|
|
|
|
|
- (UIButton *)searchButton {
|
|
|
if (!_searchButton) {
|
|
|
- _searchButton = [TDButton buttonWithType:UIButtonTypeCustom];
|
|
|
+ _searchButton = [UIButton new];
|
|
|
_searchButton.backgroundColor = [UIColor whiteColor];
|
|
|
_searchButton.frame = CGRectMake(16, 7, kGXScreenWidth-32, 38);
|
|
|
- [_searchButton setImage:[UIImage imageNamed:@"searchIcon"] forState:(UIControlStateNormal)];
|
|
|
- [_searchButton setTitleColor:[UIColor hexStringToColor:@"999999"] forState:(UIControlStateNormal)];
|
|
|
- [_searchButton setTitle:@"搜索" forState:(UIControlStateNormal)];
|
|
|
+ NSMutableAttributedString * attStr = [[NSMutableAttributedString alloc] init];
|
|
|
+ NSTextAttachment *attach = [[NSTextAttachment alloc] init];
|
|
|
+ attach.image = [UIImage imageNamed:@"home_sousuo"];
|
|
|
+ attach.bounds = CGRectMake(0, -2, 12, 13);
|
|
|
+ NSAttributedString *collegeStr = [NSAttributedString attributedStringWithAttachment:attach];
|
|
|
+ [attStr appendAttributedString:collegeStr];
|
|
|
+ NSAttributedString *placeStr = [[NSAttributedString alloc] initWithString:@" 输入关键字搜索" attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:13],NSForegroundColorAttributeName:UIColorHex(0xCCCCCC)}];
|
|
|
+ [attStr appendAttributedString:placeStr];
|
|
|
+ [_searchButton setAttributedTitle:attStr forState:UIControlStateNormal];
|
|
|
_searchButton.layer.cornerRadius = 8.f;
|
|
|
_searchButton.layer.borderWidth = 1.0f;
|
|
|
_searchButton.layer.borderColor = [UIColor whiteColor].CGColor;
|
|
|
-// [UIColor hexStringToColor:@"d8d8d8"].CGColor;
|
|
|
- [_searchButton.titleLabel setFont:[UIFont systemFontOfSize:14]];
|
|
|
+ _searchButton.contentEdgeInsets = UIEdgeInsetsMake(0, 12, 0, -10);
|
|
|
_searchButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
|
|
|
- _searchButton.contentEdgeInsets = UIEdgeInsetsMake(0, 10, 0, -10);
|
|
|
[_searchButton addTarget:self action:@selector(searchAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
}
|
|
|
return _searchButton;
|
|
@@ -117,11 +130,28 @@
|
|
|
- (UIView *)lineView {
|
|
|
if (!_lineView) {
|
|
|
_lineView = [UIView new];
|
|
|
- _lineView.backgroundColor = UIColorHex(E6E6E6);
|
|
|
+ _lineView.backgroundColor = UIColorHex(E5E5E5);
|
|
|
}
|
|
|
return _lineView;
|
|
|
}
|
|
|
|
|
|
+- (UIView *)shulineV {
|
|
|
+ if (!_shulineV) {
|
|
|
+ _shulineV = [UIView new];
|
|
|
+ _shulineV.frame = CGRectMake(kGXScreenWidth - 16 - 49.5, 16.5, 0.5, 20);
|
|
|
+ _shulineV.backgroundColor = UIColorHex(E5E5E5);
|
|
|
+ }
|
|
|
+ return _shulineV;
|
|
|
+}
|
|
|
+- (UIButton *)bookBtn {
|
|
|
+ if (!_bookBtn) {
|
|
|
+ _bookBtn = [UIButton new];
|
|
|
+ _bookBtn.frame = CGRectMake(kGXScreenWidth - 16 - 49, 7, 49, 38);
|
|
|
+ [_bookBtn setAttributedTitle:[[NSAttributedString alloc] initWithString:@"书城" attributes:@{NSFontAttributeName:[UIFont systemFontOfSize:13],NSForegroundColorAttributeName:UIColorHex(0x222222)}] forState:UIControlStateNormal];
|
|
|
+ [_bookBtn addTarget:self action:@selector(bookButtonAction:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
+ }
|
|
|
+ return _bookBtn;
|
|
|
+}
|
|
|
- (TDButton *)backButton {
|
|
|
if (!_backButton) {
|
|
|
_backButton = [[TDButton alloc] init];
|