Commit 3ad1ceee authored by admin's avatar admin

去掉商场搜索

parent e818d8b4
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x",
"filename" : "white_background@2x.png"
},
{
"idiom" : "universal",
"scale" : "3x",
"filename" : "white_background@3x.png"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
...@@ -41,4 +41,5 @@ ...@@ -41,4 +41,5 @@
@property (nonatomic, weak) id<TreeNodeDelegate> nodeDelegate; @property (nonatomic, weak) id<TreeNodeDelegate> nodeDelegate;
@property (nonatomic) UIButton *foldButton; @property (nonatomic) UIButton *foldButton;
@property (nonatomic) CheckBoxButton *titleButton; @property (nonatomic) CheckBoxButton *titleButton;
@property (nonatomic, strong) UIImageView *arrowImageView;
@end @end
...@@ -135,6 +135,39 @@ ...@@ -135,6 +135,39 @@
NSLayoutConstraint *tableBottom = [NSLayoutConstraint constraintWithItem:_titleButton attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0]; NSLayoutConstraint *tableBottom = [NSLayoutConstraint constraintWithItem:_titleButton attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self addConstraint:tableBottom]; [self addConstraint:tableBottom];
if (_arrowImageView) {
[_arrowImageView removeFromSuperview];
_arrowImageView = nil;
}
self.arrowImageView = [[UIImageView alloc] init];
_arrowImageView.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:_arrowImageView];
if (self.nodeData.levelDeep == 1) {
_arrowImageView.image = [UIImage imageNamed:@"arrow_down"];
NSLayoutConstraint *arrowWidth = [NSLayoutConstraint constraintWithItem:_arrowImageView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:12.5];
[self addConstraint:arrowWidth];
} else if (self.nodeData.levelDeep == 2) {
_arrowImageView.image = [UIImage imageNamed:@"grey-trilateral_down"];
NSLayoutConstraint *arrowWidth = [NSLayoutConstraint constraintWithItem:_arrowImageView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:11];
[self addConstraint:arrowWidth];
} else if (self.nodeData.levelDeep == 3){
//_arrowImageView.image = [UIImage imageNamed:@"white_background"];
_arrowImageView.hidden = YES;
NSLayoutConstraint *arrowWidth = [NSLayoutConstraint constraintWithItem:_arrowImageView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:15];
[self addConstraint:arrowWidth];
}
NSLayoutConstraint *arrowTop = [NSLayoutConstraint constraintWithItem:_arrowImageView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:21.5];
[self addConstraint:arrowTop];
NSLayoutConstraint *arrowRight = [NSLayoutConstraint constraintWithItem:_arrowImageView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self addConstraint:arrowRight];
NSLayoutConstraint *arrowHeight = [NSLayoutConstraint constraintWithItem:_arrowImageView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:7.5];
[self addConstraint:arrowHeight];
} }
......
...@@ -10,6 +10,8 @@ ...@@ -10,6 +10,8 @@
#import "TreeNodeCell.h" #import "TreeNodeCell.h"
#import "SelectYetTableViewCell.h" #import "SelectYetTableViewCell.h"
#define kTreeNodeCell @"nodelCell"
@interface TreeView () <SelectYetDelegate> @interface TreeView () <SelectYetDelegate>
@property (nonatomic) NSArray *nodeArray; @property (nonatomic) NSArray *nodeArray;
@end @end
...@@ -51,6 +53,7 @@ ...@@ -51,6 +53,7 @@
-(void)configSelf { -(void)configSelf {
self.dataSource = self; self.dataSource = self;
self.delegate = self; self.delegate = self;
[self registerClass:[TreeNodeCell class] forCellReuseIdentifier:kTreeNodeCell];
self.rowHeight = UITableViewAutomaticDimension; self.rowHeight = UITableViewAutomaticDimension;
self.estimatedRowHeight = 50.0; self.estimatedRowHeight = 50.0;
} }
...@@ -93,9 +96,10 @@ ...@@ -93,9 +96,10 @@
cell.textLabel.font = [UIFont systemFontOfSize:15.0]; cell.textLabel.font = [UIFont systemFontOfSize:15.0];
return cell; return cell;
} else { } else {
TreeNodeCell *cell = [tableView dequeueReusableCellWithIdentifier:@"nodeCell"]; TreeNodeCell *cell = [tableView dequeueReusableCellWithIdentifier:kTreeNodeCell];
if (cell == nil) { if (cell == nil) {
cell = [[TreeNodeCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"nodeCell"]; cell = [[TreeNodeCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:kTreeNodeCell];
} }
cell.nodeDelegate = self; cell.nodeDelegate = self;
...@@ -128,9 +132,21 @@ ...@@ -128,9 +132,21 @@
} }
// 用插入和删除函数就会产生动画 // 用插入和删除函数就会产生动画
if (node.nodeData.isExpand == NO) { if (node.nodeData.isExpand == NO) {
[UIView animateWithDuration:0.2 animations:^{
node.arrowImageView.transform = CGAffineTransformIdentity;
node.arrowImageView.transform = CGAffineTransformMakeRotation(0);
}];
[self deleteRowsAtIndexPaths:indexArray withRowAnimation:(UITableViewRowAnimationTop)]; [self deleteRowsAtIndexPaths:indexArray withRowAnimation:(UITableViewRowAnimationTop)];
} }
else { else {
[UIView animateWithDuration:0.2 animations:^{
node.arrowImageView.transform = CGAffineTransformIdentity;
node.arrowImageView.transform = CGAffineTransformMakeRotation(-M_PI);
}];
[self insertRowsAtIndexPaths:indexArray withRowAnimation:(UITableViewRowAnimationBottom)]; [self insertRowsAtIndexPaths:indexArray withRowAnimation:(UITableViewRowAnimationBottom)];
} }
......
...@@ -218,7 +218,9 @@ ...@@ -218,7 +218,9 @@
if (!_treeView) { if (!_treeView) {
_treeView = [[TreeView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - 64 - 70)]; _treeView = [[TreeView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - 64 - 70)];
_treeView.treeDelegate = self; _treeView.treeDelegate = self;
_treeView.tableHeaderView = self.headerView; // _treeView.tableHeaderView = self.headerView;
_treeView.tableFooterView = [UIView new];
[self.view addSubview:_treeView]; [self.view addSubview:_treeView];
} }
return _treeView; return _treeView;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment