Commit 7c37e110 authored by admin's avatar admin

排序 筛选接口完成

parent c0e7f861
{
"images" : [
{
"orientation" : "portrait",
"idiom" : "ipad",
"minimum-system-version" : "7.0",
"extent" : "full-screen",
"scale" : "2x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"minimum-system-version" : "7.0",
"extent" : "full-screen",
"scale" : "1x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"minimum-system-version" : "7.0",
"extent" : "full-screen",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"minimum-system-version" : "7.0",
"subtype" : "retina4",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"minimum-system-version" : "7.0",
"extent" : "full-screen",
"scale" : "1x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "filter_after@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "filter_after@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "iconfont-duigou@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "iconfont-duigou@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "sort_icon_after@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "sort_icon_after@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
{
"images" : [
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "736h",
"filename" : "launch_bg_6plus-2.png",
"minimum-system-version" : "8.0",
"orientation" : "portrait",
"scale" : "3x"
},
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "736h",
"filename" : "launch_bg_6plus-3.png",
"minimum-system-version" : "8.0",
"orientation" : "landscape",
"scale" : "3x"
},
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "667h",
"filename" : "launch_bg_6-1.png",
"minimum-system-version" : "8.0",
"orientation" : "portrait",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"filename" : "launch_bg_4.png",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"extent" : "full-screen",
"idiom" : "iphone",
"subtype" : "retina4",
"filename" : "launch_bg_6plus-1.png",
"minimum-system-version" : "7.0",
"orientation" : "portrait",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "1x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "1x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"extent" : "full-screen",
"scale" : "1x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"filename" : "launch_bg_6.png",
"extent" : "full-screen",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"filename" : "launch_bg_6plus.png",
"extent" : "full-screen",
"subtype" : "retina4",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "to-status-bar",
"scale" : "1x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "full-screen",
"scale" : "1x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "to-status-bar",
"scale" : "1x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "full-screen",
"scale" : "1x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "to-status-bar",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "ipad",
"extent" : "full-screen",
"scale" : "2x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "to-status-bar",
"scale" : "2x"
},
{
"orientation" : "landscape",
"idiom" : "ipad",
"extent" : "full-screen",
"scale" : "2x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -31,4 +31,7 @@
// http://.../redstar-server/rest/question/submit?time={time}&operId={operId}&operName={operName}
#define kAddQuestionURL @""
// 提交评论
#define kAddCommentURL @"redstar-server/rest/comment"
#endif /* Url_h */
......@@ -20,5 +20,6 @@
@property (nonatomic, strong) UIButton *sureBtn;
@property (nonatomic, strong) StarBar *starBar;
@property (nonatomic, strong) UITextView *contentTextView;
@end
......@@ -13,7 +13,6 @@
@interface CommentView ()
@property (nonatomic, strong) UILabel *placeholderLabel2;
@property (nonatomic, strong) UIImageView *backImageView2;
@property (nonatomic, strong) UITextView *contentTextView;
@end
......
......@@ -13,6 +13,7 @@
#import "QuestionDetailFooterView.h"
#import "CommentView.h"
#import "HttpClient.h"
#define kQuestionDetailCell @"QuestionDetailCell" // 问题详情
#define kQuestionCommentCell @"QuestionCommentCell" // 评论
......@@ -95,6 +96,8 @@
_commentView = [[CommentView alloc] init];
_commentView.backgroundColor = [UIColor whiteColor];
}
_commentView.starBar.starNumber = 0;
_commentView.contentTextView.text = @"";
[_commentView.quitBtn addTarget:self action:@selector(closeBackGroundView) forControlEvents:UIControlEventTouchUpInside];
[_commentView.sureBtn addTarget:self action:@selector(submitComment:) forControlEvents:UIControlEventTouchUpInside];
[self.view insertSubview:_backGroundView aboveSubview:_tableView];
......@@ -116,6 +119,20 @@
- (void)submitComment:(UIButton *)sender
{
NSNumber *count = [NSNumber numberWithInteger:_commentView.starBar.starNumber];
NSString *url = [NSString stringWithFormat:@"%@%@", kRedStarURL, kAddCommentURL];
NSLog(@"url = %@", url);
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
NSDictionary *parameters = @{@"entityType":@"question",
@"entityUuid":_question.uuid,
@"star":count,
@"comment":_commentView.contentTextView.text};
NSLog(@"parameters = %@", parameters);
[httpClient submitCommentWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"respo = %@, error = %@", response , error);
}];
[self closeBackGroundView];
}
......
......@@ -48,8 +48,16 @@
self.alreadyLabel.text = [NSString stringWithFormat:@"%d", taskList.reportCount];
self.allLabel.text = [NSString stringWithFormat:@"/%d", taskList.questionCount];
self.multiplier = (CGFloat)taskList.reportCount / taskList.questionCount;
self.allView.backgroundColor = kProgressViewAllBackColor;
if (taskList.reportCount == 0) {
self.multiplier = 0;
} else {
self.multiplier = (CGFloat)taskList.reportCount / taskList.questionCount;
}
UIImage *image = [UIImage imageNamed:@"progress-bar"];
image = [image resizableImageWithCapInsets:UIEdgeInsetsZero resizingMode:UIImageResizingModeTile];
self.alreadyView.image = image;
......@@ -280,6 +288,7 @@
_alreadyView.layer.cornerRadius = 3;
_alreadyView.layer.masksToBounds = YES;
_alreadyView.translatesAutoresizingMaskIntoConstraints = NO;
_alreadyView.tag = 9760001;
[self.allView addSubview:_alreadyView];
NSLayoutConstraint *overDateTop = [NSLayoutConstraint constraintWithItem:_alreadyView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.allView attribute:NSLayoutAttributeTop multiplier:1.0 constant:1];
......
......@@ -20,9 +20,11 @@
#import "TaskListModel.h"
#define kTAxisBtnTag 500232
#define kInspectListCell @"InspectListCellTableViewCell"
@interface InspectListViewController ()<UITableViewDelegate, UITableViewDataSource, ScreenTableDelegate>
@interface InspectListViewController ()<UITableViewDelegate, UITableViewDataSource, ScreenTableDelegate , TaxisViewDelegate>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) MenuView *menuView;
......@@ -32,8 +34,10 @@
@property (nonatomic, strong) UIView *bgView;
@property (nonatomic, strong) MenuButton *selctedButton;
@property (nonatomic, strong) NSMutableArray *taskListDataArray;
@property (nonatomic, strong) UIButton *selectBtn;
@property (nonatomic, strong) NSMutableArray *taskListDataArray;
@property (nonatomic, assign) NSInteger selectRow;
@end
@implementation InspectListViewController
......@@ -68,6 +72,7 @@
self.taskListDataArray = [NSMutableArray array];
[self requestInspectList];
}
......@@ -109,11 +114,10 @@
NSString *url = [NSString stringWithFormat:@"%@%@", kRedStarURL, kInspectListURL];
HttpClient *httpCilent = [[HttpClient alloc] initWithUrl:url];
NSDictionary *parameters = @{@"userUuid":@"",
@"state":@"published",
@"beginDateFrom":@"",
@"endDateTo":@"",
@"nameLike":@"",
@"queryOrders":@[],
@"queryOrders":@[@{@"field":@"lastModifyInfo"}],
@"pageNumber":@(1),
@"pageSize":@(10)
};
......@@ -207,7 +211,7 @@
_taxisView = [[TaxisView alloc] init];
_taxisView.backgroundColor = [UIColor whiteColor];
}
_taxisView.delegate = self;
[self.view addSubview:_bgView];
[self.view insertSubview:_taxisView aboveSubview:_bgView];
......@@ -252,6 +256,8 @@
_screenView.delegate = self;
_screenView.backgroundColor = [UIColor whiteColor];
}
[_screenView.resetBtn addTarget:self action:@selector(resetClick:) forControlEvents:UIControlEventTouchUpInside];
[_screenView.submitBtn addTarget:self action:@selector(submitClick:) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:_bgView];
[self.view insertSubview:_screenView aboveSubview:_bgView];
......@@ -284,12 +290,237 @@
}];
}
// 重置按钮
- (void)resetClick:(UIButton *)sender
{
NSInteger selectedIndex = 0;
NSIndexPath *selectedIndexPath = [NSIndexPath indexPathForRow:selectedIndex inSection:0];
[_screenView.tableView selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
_screenView.textView.text = @"";
_selectRow = 0;
}
// 提交按钮
- (void)submitClick:(UIButton *)sender
{
NSString *url = [NSString stringWithFormat:@"%@%@", kRedStarURL, kInspectListURL];
HttpClient *httpCilent = [[HttpClient alloc] initWithUrl:url];
NSMutableDictionary *parameters = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"",@"userUuid",@"",@"beginDateFrom",@"",@"endDateTo",@"",@"nameLike",@[],@"queryOrders",@(1),@"pageNumber",@(10),@"pageSize", nil];
if (_selectRow == 0) {
} else if (_selectRow == 1) {
[parameters setObject:@"initial" forKey:@"state"];
NSArray *array = @[@{@"field":@"state"}];
[parameters setObject:array forKey:@"queryOrders"];
} else if (_selectRow == 2) {
[parameters setObject:@"processing" forKey:@"state"];
NSArray *array = @[@{@"field":@"state"}];
[parameters setObject:array forKey:@"queryOrders"];
} else if (_selectRow == 3) {
[parameters setObject:@"reported" forKey:@"state"];
NSArray *array = @[@{@"field":@"state"}];
[parameters setObject:array forKey:@"queryOrders"];
} else if (_selectRow == 4) {
[parameters setObject:@"finished" forKey:@"state"];
NSArray *array = @[@{@"field":@"state"}];
[parameters setObject:array forKey:@"queryOrders"];
} else if (_selectRow == 5) {
[parameters setObject:@"published" forKey:@"state"];
NSArray *array = @[@{@"field":@"state"}];
[parameters setObject:array forKey:@"queryOrders"];
} else if (_selectRow == 6){
[parameters setObject:@"expired" forKey:@"state"];
NSArray *array = @[@{@"field":@"state"}];
[parameters setObject:array forKey:@"queryOrders"];
}
if (_screenView.textView.text.length != 0){
[parameters setObject:_screenView.textView.text forKey:@"nameLike"];
NSArray *array = @[@{@"field":@"name"}];
[parameters setObject:array forKey:@"queryOrders"];
} else {
NSArray *array = @[];
[parameters setObject:array forKey:@"queryOrders"];
}
NSLog(@"parment =%@", parameters);
[httpCilent getInspectListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"respones = %@", response);
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
NSMutableArray *tempArray = [NSMutableArray array];
for (NSDictionary *dict in dataArray) {
TaskListModel *taskList = [[TaskListModel alloc] init];
[taskList setValuesForKeysWithDictionary:dict];
[tempArray addObject:taskList];
}
_taskListDataArray = tempArray;
[self.tableView reloadData];
_screenView.textView.text = @"";
}];
}
#pragma mark - ScreenDelegate
- (void)click
- (void)tableViewDidSelectRow:(NSInteger)row
{
_selectRow = row;
// NSString *url = [NSString stringWithFormat:@"%@%@", kRedStarURL, kInspectListURL];
// HttpClient *httpCilent = [[HttpClient alloc] initWithUrl:url];
// NSDictionary *parameters = [NSDictionary dictionary];
// if (row == 0) {
// parameters = @{@"userUuid":@"",
// @"beginDateFrom":@"",
// @"endDateTo":@"",
// @"nameLike":@"",
// @"queryOrders":@[],
// @"pageNumber":@(1),
// @"pageSize":@(10)
// };
//
// } else if (row == 1) {
// parameters = @{@"userUuid":@"",
// @"state":@"initial",
// @"beginDateFrom":@"",
// @"endDateTo":@"",
// @"nameLike":@"",
// @"queryOrders":@[@{@"field":@"state"}],
// @"pageNumber":@(1),
// @"pageSize":@(10)
// };
//
// } else if (row == 2) {
// parameters = @{@"userUuid":@"",
// @"state":@"processing",
// @"beginDateFrom":@"",
// @"endDateTo":@"",
// @"nameLike":@"",
// @"queryOrders":@[@{@"field":@"state"}],
// @"pageNumber":@(1),
// @"pageSize":@(10)
// };
// } else if (row == 3) {
// parameters = @{@"userUuid":@"",
// @"state":@"reported",
// @"beginDateFrom":@"",
// @"endDateTo":@"",
// @"nameLike":@"",
// @"queryOrders":@[@{@"field":@"state"}],
// @"pageNumber":@(1),
// @"pageSize":@(10)
// };
// } else if (row == 4) {
// parameters = @{@"userUuid":@"",
// @"state":@"finished",
// @"beginDateFrom":@"",
// @"endDateTo":@"",
// @"nameLike":@"",
// @"queryOrders":@[@{@"field":@"state"}],
// @"pageNumber":@(1),
// @"pageSize":@(10)
// };
// } else if (row == 5){
// parameters = @{@"userUuid":@"",
// @"state":@"published",
// @"beginDateFrom":@"",
// @"endDateTo":@"",
// @"nameLike":@"",
// @"queryOrders":@[@{@"field":@"state"}],
// @"pageNumber":@(1),
// @"pageSize":@(10)
// };
// } else {
// parameters = @{@"userUuid":@"",
// @"state":@"expired",
// @"beginDateFrom":@"",
// @"endDateTo":@"",
// @"nameLike":@"",
// @"queryOrders":@[@{@"field":@"state"}],
// @"pageNumber":@(1),
// @"pageSize":@(10)
// };
// }
//
// [httpCilent getInspectListWithParameters:parameters completion:^(id response, NSError *error) {
//
// NSDictionary *dataDict = response[@"data"];
// NSArray *dataArray = dataDict[@"records"];
// NSMutableArray *tempArray = [NSMutableArray array];
// for (NSDictionary *dict in dataArray) {
// TaskListModel *taskList = [[TaskListModel alloc] init];
// [taskList setValuesForKeysWithDictionary:dict];
// [tempArray addObject:taskList];
// }
// _taskListDataArray = tempArray;
// [self.tableView reloadData];
// }];
}
#pragma mark - TaxisDelegate
- (void)timeChange:(UIButton *)sender
{
NSLog(@"未上报或已上报");
_selectBtn.selected = NO;
[_selectBtn setImage:[UIImage imageNamed:@"aa"] forState:UIControlStateNormal];
sender.selected = YES;
[sender setImage:[UIImage imageNamed:@"iconfont-duigou"] forState:UIControlStateNormal];
NSString *url = [NSString stringWithFormat:@"%@%@", kRedStarURL, kInspectListURL];
HttpClient *httpCilent = [[HttpClient alloc] initWithUrl:url];
NSArray *queryOrders;
if (sender.tag - kTAxisBtnTag == 1) {
queryOrders = @[];
} else if (sender.tag - kTAxisBtnTag == 2) {
queryOrders = @[@{@"field":@"lastModifyInfo",
@"direction":@"desc"}];
} else {
queryOrders = @[@{@"field":@"lastModifyInfo",
@"direction":@"asc"}];
}
NSDictionary *parameters = @{@"userUuid":@"",
@"beginDateFrom":@"",
@"endDateTo":@"",
@"nameLike":@"",
@"queryOrders":queryOrders,
@"pageNumber":@(1),
@"pageSize":@(10)
};
[httpCilent getInspectListWithParameters:parameters completion:^(id response, NSError *error) {
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
NSMutableArray *tempArray = [NSMutableArray array];
for (NSDictionary *dict in dataArray) {
TaskListModel *taskList = [[TaskListModel alloc] init];
[taskList setValuesForKeysWithDictionary:dict];
[tempArray addObject:taskList];
}
_taskListDataArray = tempArray;
[self.tableView reloadData];
}];
_selectBtn = sender;
[self closeRedView];
}
#pragma mark - UITableView Delegate/DataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
......@@ -299,11 +530,14 @@
// cell显示的内容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
InspectListCell *cell=[tableView dequeueReusableCellWithIdentifier:kInspectListCell];
NSString *CellIdentifier = [NSString stringWithFormat:@"Cell%ld%ld", (long)[indexPath section], (long)[indexPath row]];
InspectListCell *cell=[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (!cell) {
cell = [[InspectListCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kInspectListCell];
cell = [[InspectListCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
}
cell.taskList = (TaskListModel *)_taskListDataArray[indexPath.row];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
......@@ -372,7 +606,7 @@
_tableView.showsVerticalScrollIndicator = NO;
_tableView.showsHorizontalScrollIndicator = NO;
_tableView.tableFooterView = [[UIView alloc] init];
[_tableView registerClass:[InspectListCell class] forCellReuseIdentifier:kInspectListCell];
// [_tableView registerClass:[InspectListCell class] forCellReuseIdentifier:kInspectListCell];
[self.view addSubview:_tableView];
......
......@@ -34,5 +34,7 @@ typedef void (^completionBlock) (id response, NSError *error);
// 获取口碑巡检明细
- (void)getPraiseDetailWithParameters:(id)parameters completion:(completionBlock)completion;
// 提交评论
- (void)submitCommentWithParameters:(id)parameters completion:(completionBlock)completion;
@end
......@@ -90,9 +90,6 @@
// password
NSString *passwordMD5 = [CommonFunc md5:password];
// 参数
// NSDictionary *dataDict = [[NSUserDefaults standardUserDefaults] objectForKey:@"loginData"];
// NSString *authenticode = dataDict[@"authenticode"];
NSDictionary *parameters = @{@"authenticode":@"211534962",
@"password":passwordMD5
};
......@@ -148,4 +145,13 @@
}];
}
- (void)submitCommentWithParameters:(id)parameters completion:(completionBlock)completion
{
[self getParameters:parameters completion:^(id response, NSError *error) {
if (completion) {
completion (response, error);
}
}];
}
@end
......@@ -51,7 +51,6 @@
- (void)showIndex:(NSInteger) index
{
NSLog(@"self.buttons = %@", self.buttons);
[self touchDownForButton:[self.buttons objectAtIndex:index]];
[self touchUpForButton:[self.buttons objectAtIndex:index]];
}
......
......@@ -11,7 +11,7 @@
@protocol ScreenTableDelegate <NSObject>
- (void)click;
- (void)tableViewDidSelectRow:(NSInteger)row;
@end
......
......@@ -42,7 +42,7 @@
- (void)setup
{
self.testArray = [NSArray arrayWithObjects:@"全部",@"未提交",@"已提交",@"调研中",@"已过期", @"未完成", nil];
self.testArray = [NSArray arrayWithObjects:@"全部", @"未处理",@"进行中",@"已上报",@"已评分", @"已发布", @"已过期",nil];
self.groupTabBar = [[GroupTabBar alloc] initWithFrame:CGRectMake(0, 0, 100, 180)];
_groupTabBar.delegate = self;
[self addSubview:_groupTabBar];
......@@ -119,7 +119,7 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (_delegate) {
[_delegate click];
[_delegate tableViewDidSelectRow:indexPath.row];
}
}
......@@ -166,15 +166,16 @@
_resetBtn = [[UIButton alloc] init];
_resetBtn.backgroundColor = [UIColor grayColor];
_resetBtn.translatesAutoresizingMaskIntoConstraints = NO;
_resetBtn.layer.cornerRadius = 4.0;
[self.backView addSubview:_resetBtn];
NSLayoutConstraint *lineViewTop = [NSLayoutConstraint constraintWithItem:_resetBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.backView attribute:NSLayoutAttributeTop multiplier:1.0 constant:5];
NSLayoutConstraint *lineViewTop = [NSLayoutConstraint constraintWithItem:_resetBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.backView attribute:NSLayoutAttributeTop multiplier:1.0 constant:7.5];
[self.backView addConstraint:lineViewTop];
NSLayoutConstraint *lineViewRight = [NSLayoutConstraint constraintWithItem:_resetBtn attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.backView attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:-20];
[self.backView addConstraint:lineViewRight];
NSLayoutConstraint *lineViewBottom = [NSLayoutConstraint constraintWithItem:_resetBtn attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.backView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-5];
NSLayoutConstraint *lineViewBottom = [NSLayoutConstraint constraintWithItem:_resetBtn attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.backView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-7.5];
[self.backView addConstraint:lineViewBottom];
NSLayoutConstraint *lineViewLeft = [NSLayoutConstraint constraintWithItem:_resetBtn attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.backView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
......@@ -189,15 +190,16 @@
_submitBtn = [[UIButton alloc] init];
_submitBtn.backgroundColor = kNavigationBarColor;
_submitBtn.translatesAutoresizingMaskIntoConstraints = NO;
_submitBtn.layer.cornerRadius = 4.0;
[self.backView addSubview:_submitBtn];
NSLayoutConstraint *lineViewTop = [NSLayoutConstraint constraintWithItem:_submitBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.backView attribute:NSLayoutAttributeTop multiplier:1.0 constant:5];
NSLayoutConstraint *lineViewTop = [NSLayoutConstraint constraintWithItem:_submitBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.backView attribute:NSLayoutAttributeTop multiplier:1.0 constant:7.5];
[self.backView addConstraint:lineViewTop];
NSLayoutConstraint *lineViewRight = [NSLayoutConstraint constraintWithItem:_submitBtn attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.backView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.backView addConstraint:lineViewRight];
NSLayoutConstraint *lineViewBottom = [NSLayoutConstraint constraintWithItem:_submitBtn attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.backView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-5];
NSLayoutConstraint *lineViewBottom = [NSLayoutConstraint constraintWithItem:_submitBtn attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.backView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-7.5];
[self.backView addConstraint:lineViewBottom];
NSLayoutConstraint *lineViewLeft = [NSLayoutConstraint constraintWithItem:_submitBtn attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.backView attribute:NSLayoutAttributeCenterX multiplier:1.0 constant:20];
......
......@@ -7,6 +7,14 @@
//
#import <UIKit/UIKit.h>
#define kTAxisBtnTag 500232
@protocol TaxisViewDelegate <NSObject>
- (void)timeChange:(UIButton *)sender;
@end
@interface TaxisView : UIView
......@@ -14,4 +22,6 @@
@property (nonatomic, strong) UIButton *sequenceBtn; // 顺序
@property (nonatomic, strong) UIButton *changeoverBtn; // 逆序
@property (nonatomic, strong) id <TaxisViewDelegate> delegate;
@end
......@@ -32,7 +32,6 @@
{
[self.defaultBtn setTitle:@"默认排序" forState:UIControlStateNormal];
[self.sequenceBtn setTitle:@"时间顺序排序" forState:UIControlStateNormal];
[self.changeoverBtn setTitle:@"时间逆序排序" forState:UIControlStateNormal];
}
......@@ -49,6 +48,9 @@
[_defaultBtn setTitleColor:kInspectSectionButtonTextColor forState:UIControlStateNormal];
_defaultBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft ;
_defaultBtn.titleLabel.font = [UIFont systemFontOfSize:14.0];
[_defaultBtn addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
_defaultBtn.tag = kTAxisBtnTag + 1;
[self addSubview:_defaultBtn];
// 顶端
......@@ -81,7 +83,14 @@
[_sequenceBtn setTitleColor:kInspectSectionButtonTextColor forState:UIControlStateNormal];
_sequenceBtn.titleLabel.font = [UIFont systemFontOfSize:14.0];
_sequenceBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft ;
_sequenceBtn.imageEdgeInsets = UIEdgeInsetsMake(0, kScreenWidth - 30, 0, 0);
_sequenceBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 20, 0, 0);
_sequenceBtn.imageView.contentMode = UIViewContentModeRight;
_sequenceBtn.titleLabel.contentMode = UIViewContentModeLeft;
[_sequenceBtn addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
_sequenceBtn.tag = kTAxisBtnTag + 2;
[self addSubview:_sequenceBtn];
// 顶端
......@@ -114,6 +123,12 @@
_changeoverBtn.translatesAutoresizingMaskIntoConstraints = NO;
[_changeoverBtn setTitleColor:kInspectSectionButtonTextColor forState:UIControlStateNormal];
_changeoverBtn.titleLabel.font = [UIFont systemFontOfSize:14.0];
_changeoverBtn.imageEdgeInsets = UIEdgeInsetsMake(0, kScreenWidth - 30, 0, 0);
_changeoverBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 20, 0, 0);
[_changeoverBtn addTarget:self action:@selector(click:) forControlEvents:UIControlEventTouchUpInside];
_changeoverBtn.tag = kTAxisBtnTag + 3;
[self addSubview:_changeoverBtn];
// 顶端
......@@ -135,4 +150,11 @@
return _changeoverBtn;
}
- (void)click:(UIButton *)sender
{
if (_delegate) {
[_delegate timeChange:sender];
}
}
@end
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