Commit 6b9855fb authored by admin's avatar admin

完成点赞接口 完成评论接口 完成无数据页的显示

parent 7c37e110
......@@ -84,6 +84,7 @@
84F57C4C1BEC785E00DDEEB1 /* AddQuestionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F57C4B1BEC785E00DDEEB1 /* AddQuestionViewController.m */; };
84F57C501BEC7AA300DDEEB1 /* AddQuestionFooterView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F57C4F1BEC7AA300DDEEB1 /* AddQuestionFooterView.m */; };
84F57C9C1BECA73800DDEEB1 /* StarBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 84F57C9B1BECA73800DDEEB1 /* StarBar.m */; };
84FAC7611BFF2C6E00FD094D /* NoDataView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84FAC7601BFF2C6E00FD094D /* NoDataView.m */; };
84FD89F21BD9FC71006E442A /* HomeViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84FD89F11BD9FC71006E442A /* HomeViewController.m */; };
84FD8A071BDA01C4006E442A /* ChartViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84FD8A061BDA01C4006E442A /* ChartViewController.m */; };
84FD8A0A1BDA01D1006E442A /* MineViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84FD8A091BDA01D1006E442A /* MineViewController.m */; };
......@@ -264,6 +265,8 @@
84F57C4F1BEC7AA300DDEEB1 /* AddQuestionFooterView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AddQuestionFooterView.m; sourceTree = "<group>"; };
84F57C9A1BECA73800DDEEB1 /* StarBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StarBar.h; sourceTree = "<group>"; };
84F57C9B1BECA73800DDEEB1 /* StarBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = StarBar.m; sourceTree = "<group>"; };
84FAC75F1BFF2C6E00FD094D /* NoDataView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NoDataView.h; sourceTree = "<group>"; };
84FAC7601BFF2C6E00FD094D /* NoDataView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NoDataView.m; sourceTree = "<group>"; };
84FD89F01BD9FC71006E442A /* HomeViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HomeViewController.h; sourceTree = "<group>"; };
84FD89F11BD9FC71006E442A /* HomeViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HomeViewController.m; sourceTree = "<group>"; };
84FD8A051BDA01C4006E442A /* ChartViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ChartViewController.h; sourceTree = "<group>"; };
......@@ -397,6 +400,7 @@
8426A4A01BDF0CD600E5FDF5 /* Function */ = {
isa = PBXGroup;
children = (
84FAC75E1BFF2C5B00FD094D /* NoData */,
8426A4A11BDF0CD600E5FDF5 /* Case */,
8426A4A41BDF0CD600E5FDF5 /* OnLine */,
8426A4A71BDF0CD600E5FDF5 /* Picture */,
......@@ -1218,6 +1222,15 @@
path = StarBar;
sourceTree = "<group>";
};
84FAC75E1BFF2C5B00FD094D /* NoData */ = {
isa = PBXGroup;
children = (
84FAC75F1BFF2C6E00FD094D /* NoDataView.h */,
84FAC7601BFF2C6E00FD094D /* NoDataView.m */,
);
path = NoData;
sourceTree = "<group>";
};
84FD89ED1BD9FC5B006E442A /* Home */ = {
isa = PBXGroup;
children = (
......@@ -1515,6 +1528,7 @@
8487D80C1BF218F900E63E90 /* MenuView.m in Sources */,
8474C5921BE78A85007DCF19 /* QuestionViewController.m in Sources */,
84AD4F291BF4360E00BFB37C /* TaskGroup.m in Sources */,
84FAC7611BFF2C6E00FD094D /* NoDataView.m in Sources */,
84AD4F2F1BF4370E00BFB37C /* InspectHeaderView.m in Sources */,
8408261E1BE5D22A0022B795 /* OnLineTableViewCell.m in Sources */,
8408261A1BE5CEDD0022B795 /* OnLineViewController.m in Sources */,
......
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "iconfont-duigou2@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "iconfont-duigou2@3x.png",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
......@@ -6,12 +6,12 @@
},
{
"idiom" : "universal",
"filename" : "commend_after@2x.png",
"filename" : "已评论@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "commend_after@3x.png",
"filename" : "已评论@3x.png",
"scale" : "3x"
}
],
......
......@@ -6,12 +6,12 @@
},
{
"idiom" : "universal",
"filename" : "comment_after@2x.png",
"filename" : "已赞@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "comment_after@3x.png",
"filename" : "已赞@3x.png",
"scale" : "3x"
}
],
......
......@@ -32,6 +32,12 @@
#define kAddQuestionURL @""
// 提交评论
#define kAddCommentURL @"redstar-server/rest/comment"
//#define kAddCommentURL @"redstar-server/rest/comment/submit?time=2015-06-25+13:59:26&operId=admin&operName=admin"
#define kAddCommentURL @"redstar-server/rest/comment/submit"
// 点赞
#define kAddLikeURL @"redstar-server/rest/question/like/"
// 取消点赞
#define kCancelLikeURL @"redstar-server/rest/question/cancel_like/"
#endif /* Url_h */
//
// NoDataView.h
// redstar
//
// Created by admin on 15/11/20.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface NoDataView : UIView
@end
//
// NoDataView.m
// redstar
//
// Created by admin on 15/11/20.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "NoDataView.h"
#define kImageWidth 91
#define kImageHeight 91
@implementation NoDataView
- (instancetype)init
{
self = [super init];
if (self) {
[self setup];
}
return self;
}
- (void)setup
{
UIImageView *imageView = [[UIImageView alloc] init];
imageView.translatesAutoresizingMaskIntoConstraints = NO;
imageView.image = [UIImage imageNamed:@"空白页_icon"];
[self addSubview:imageView];
NSLayoutConstraint *imageViewTop = [NSLayoutConstraint constraintWithItem:imageView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeCenterY multiplier:1.0 constant:-30];
[self addConstraint:imageViewTop];
NSLayoutConstraint *imageViewLeft = [NSLayoutConstraint constraintWithItem:imageView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:(kScreenWidth - kImageWidth) / 2];
[self addConstraint:imageViewLeft];
NSLayoutConstraint *imageViewHeight = [NSLayoutConstraint constraintWithItem:imageView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:kImageHeight];
[self addConstraint:imageViewHeight];
NSLayoutConstraint *imageViewWidth = [NSLayoutConstraint constraintWithItem:imageView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:kImageWidth];
[self addConstraint:imageViewWidth];
UILabel *label = [[UILabel alloc] init];
label.text = @"很抱歉,暂无数据!";
label.translatesAutoresizingMaskIntoConstraints = NO;
label.font = [UIFont boldSystemFontOfSize:30.0];
label.textAlignment = NSTextAlignmentCenter;
label.textColor = [UIColor colorWithRed:189/255.0 green:224/255.0 blue:246/255.0 alpha:1.0];
[self addSubview:label];
NSLayoutConstraint *labelTop = [NSLayoutConstraint constraintWithItem:label attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:imageView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:10];
[self addConstraint:labelTop];
NSLayoutConstraint *labelLeft = [NSLayoutConstraint constraintWithItem:label attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self addConstraint:labelLeft];
NSLayoutConstraint *labelRight = [NSLayoutConstraint constraintWithItem:label attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self addConstraint:labelRight];
NSLayoutConstraint *labelHeight = [NSLayoutConstraint constraintWithItem:label attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:40];
[self addConstraint:labelHeight];
}
@end
......@@ -48,7 +48,7 @@
}
// 点赞数
[self.thumbBtn setTitle:@"300" forState:UIControlStateNormal];
[self.thumbBtn setTitle:[NSString stringWithFormat:@"%d",question.likeCount] forState:UIControlStateNormal];
// 分类
NSString *sortText = [NSString stringWithFormat:@"分类:%@", question.categoryName];
......@@ -114,7 +114,7 @@
_thumbBtn = [[ZanButton alloc] init];
[_thumbBtn setImage:[UIImage imageNamed:@"commend"] forState:UIControlStateNormal];
_thumbBtn.translatesAutoresizingMaskIntoConstraints = NO;
_thumbBtn.titleLabel.font = [UIFont boldSystemFontOfSize:15.0];
_thumbBtn.titleLabel.font = [UIFont systemFontOfSize:15.0];
[_thumbBtn setTitleColor:kNavigationBarColor forState:UIControlStateNormal];
[self.contentView addSubview:_thumbBtn];
......
......@@ -12,5 +12,5 @@
@interface QuestionDetailViewController : UIViewController
@property (nonatomic,strong) QuestionModel *question;
@property (nonatomic, assign) NSInteger row;
@end
......@@ -14,6 +14,7 @@
#import "CommentView.h"
#import "HttpClient.h"
#import <MBProgressHUD.h>
#define kQuestionDetailCell @"QuestionDetailCell" // 问题详情
#define kQuestionCommentCell @"QuestionCommentCell" // 评论
......@@ -44,6 +45,8 @@
self.test1Array = [NSArray arrayWithObjects:@"该建议很好", @"有效提高了用户体验,减少不必要的工作,还符合了上级提出的四个现代化,建议多提类似建议!", nil];
self.test2Array = [NSArray arrayWithObjects:@"李XX 集团XX总", @"王XX 某大区经理", nil];
self.test3Array = [NSArray arrayWithObjects:@"2015-09-10 10:21:43", @"2015-10-27 11:21:43", nil];
}
......@@ -83,6 +86,7 @@
- (void)doBack:(UIBarButtonItem *)sender
{
[self.navigationController popViewControllerAnimated:YES];
}
- (void)addComment:(UIButton *)sender
......@@ -121,16 +125,41 @@
{
NSNumber *count = [NSNumber numberWithInteger:_commentView.starBar.starNumber];
NSString *url = [NSString stringWithFormat:@"%@%@", kRedStarURL, kAddCommentURL];
NSDate *date = [NSDate date];
NSTimeZone *zone = [NSTimeZone systemTimeZone];
NSInteger interval = [zone secondsFromGMTForDate:date];
NSDate *localeDate = [date dateByAddingTimeInterval:interval];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"YYYY-MM-dd+hh:mm:ss"];
NSString *dateString = [dateFormatter stringFromDate:localeDate];
NSDictionary *dict = [[NSUserDefaults standardUserDefaults] objectForKey:@"loginData"];
NSString *operId = dict[@"user_code"];
NSString *operName = dict[@"user_name"];
NSString *url = [NSString stringWithFormat:@"%@%@?time=%@&operId=%@&operName=%@", kRedStarURL, kAddCommentURL , dateString , operId, operName];
url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
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);
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[httpClient submitCommentWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"respo = %@, error = %@", response , error);
if ([response[@"message"] isEqualToString:@"ok"]) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"提示" message:@"添加评论成功" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
[MBProgressHUD hideHUDForView:self.view animated:YES];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"警告" message:@"添加评论失败" delegate:self cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
[MBProgressHUD hideHUDForView:self.view animated:YES];
}
}];
[self closeBackGroundView];
......@@ -148,6 +177,41 @@
}];
}
- (void)addZan:(ZanButton *)sender
{
sender.selected = !sender.selected;
NSDate *date = [NSDate date];
NSTimeZone *zone = [NSTimeZone systemTimeZone];
NSInteger interval = [zone secondsFromGMTForDate:date];
NSDate *localeDate = [date dateByAddingTimeInterval:interval];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"YYYY-MM-dd+hh:mm:ss"];
NSString *dateString = [dateFormatter stringFromDate:localeDate];
NSDictionary *dict = [[NSUserDefaults standardUserDefaults] objectForKey:@"loginData"];
NSString *operId = dict[@"user_code"];
NSString *operName = dict[@"user_name"];
NSString *url = [NSString stringWithFormat:@"%@%@%@?time=%@&operId=%@&operName=%@", kRedStarURL, kAddLikeURL, _question.uuid, dateString, operId, operName];
url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
[httpClient likeCountWithParameters:nil completion:^(id response, NSError *error) {
if (response[@"success"]) {
int likeCount = [sender.titleLabel.text intValue];
[sender setTitle:[NSString stringWithFormat:@"%d", likeCount + 1] forState:UIControlStateNormal];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"警告" message:@"点赞失败!" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alert show];
}
}];
}
#pragma mark - UITableView Delegate/DataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
......@@ -174,6 +238,7 @@
cell = [[QuestionDetailCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kQuestionDetailCell];
}
cell.question = self.question;
[cell.thumbBtn addTarget:self action:@selector(addZan:) forControlEvents:UIControlEventTouchUpInside];
return cell;
} else if (indexPath.section == 1) {
......
......@@ -22,8 +22,7 @@
- (void)setup
{
self.titleLabel.textColor = kQuestionCellTitleColor;
self.hotLabel.font = [UIFont boldSystemFontOfSize:12.0];
self.thumbBtn.titleLabel.font = [UIFont systemFontOfSize:15.0];
}
- (void)setQuestion:(QuestionModel *)question
......@@ -38,6 +37,15 @@
self.stateLabel.text = [NSString stringWithFormat:@"%@", question.categoryName];
// 提报时间
self.dateLabel.text = [NSString stringWithFormat:@"提报时间:%@", question.submitTime];
// 点赞数
[self.thumbBtn setTitle:[NSString stringWithFormat:@"%d", question.likeCount] forState:UIControlStateNormal];
if (question.hotspot) {
self.hotLabel.hidden = NO;
} else {
self.hotLabel.hidden = YES;
}
}
#pragma mark - lazy laoding
......@@ -72,6 +80,7 @@
{
if (!_hotLabel) {
_hotLabel = [[UILabel alloc] init];
_hotLabel.font = [UIFont boldSystemFontOfSize:12.0];
_hotLabel.translatesAutoresizingMaskIntoConstraints = NO;
_hotLabel.backgroundColor = kHotBackGroundColor;
_hotLabel.textColor = [UIColor whiteColor];
......@@ -190,8 +199,8 @@
if (!_thumbBtn) {
_thumbBtn = [[ZanButton alloc] init];
_thumbBtn.translatesAutoresizingMaskIntoConstraints = NO;
_thumbBtn.titleLabel.font = [UIFont systemFontOfSize:15.0];
[_thumbBtn setTitleColor:kNavigationBarColor forState:UIControlStateNormal];
[_thumbBtn setTitle:@"220" forState:UIControlStateNormal];
[_thumbBtn setImage:[UIImage imageNamed:@"commend"] forState:UIControlStateNormal];
[self.contentView addSubview:_thumbBtn];
......
......@@ -37,6 +37,6 @@
@property (nonatomic, strong) NSString *submitTime;//
@property (nonatomic, strong) NSString *type;//问题处理分类
@property (nonatomic, strong) NSString *version;//
@property (nonatomic, strong) NSString *hotspot; // 热点问题
@property (nonatomic, strong) NSString *likeCount; //
@property (nonatomic, assign) BOOL hotspot; // 热点问题
@property (nonatomic, assign) int likeCount; // 点赞数
@end
......@@ -19,9 +19,12 @@
#import "MenuView.h"
#import "CustomDropMenuView.h"
#define kQuestionListCell @"questionListTableViewCell"
#import "NoDataView.h"
#import <MBProgressHUD.h>
@interface QuestionViewController () <UITableViewDelegate, UITableViewDataSource, ScreenTableDelegate>
#define kQuestionListCell @"questionListTableViewCell"
#define kThumbTag 745645
@interface QuestionViewController () <UITableViewDelegate, UITableViewDataSource, ScreenTableDelegate, TaxisViewDelegate>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) NSMutableArray *allQuestionArray;
......@@ -33,6 +36,9 @@
@property (nonatomic, strong) UIView *bgView;
@property (nonatomic, strong) MenuButton *selctedButton;
@property (nonatomic, strong) UIButton *selectBtn;
@property (nonatomic, strong) NoDataView *noDataView;
@end
......@@ -61,10 +67,9 @@
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
self.tabBarController.tabBar.hidden = YES;
[self.menuView.taxiButton addTarget:self action:@selector(dropCilck:) forControlEvents:UIControlEventTouchUpInside];
[self.menuView.screenButton addTarget:self action:@selector(dropCilck:) forControlEvents:UIControlEventTouchUpInside];
self.tabBarController.tabBar.hidden = YES;
}
......@@ -94,14 +99,16 @@
NSDictionary *parameters = @{@"user":@"5a74170150b940ae0150b940f8450083",
@"scope":@"all",
@"category":@"",
@"type":@"" ,
@"state":@"resolved"
@"type":@""
//,@"state":@"resolved"
};
// 发起请求
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:urlStr];
//
__block QuestionViewController *weakSelf = self;
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
// 请求问题列表
[httpClient getQuestionListWithParameters:parameters completion:^(id response, NSError *error) {
NSDictionary *dataDict = (NSDictionary *)response[@"data"];
......@@ -112,13 +119,21 @@
[question setValuesForKeysWithDictionary:questionDict];
[weakSelf.allQuestionArray addObject:question];
}
[weakSelf setupTableView];
if (_allQuestionArray.count == 0) {
weakSelf.noDataView.backgroundColor = [UIColor whiteColor];
[MBProgressHUD hideHUDForView:self.view animated:YES];
} else {
[weakSelf setupTableView];
[MBProgressHUD hideHUDForView:self.view animated:YES];
}
}];
}
- (void)setupTableView
{
[self.tableView registerClass:[QuestionListTableCell class] forCellReuseIdentifier:kQuestionListCell];
self.searchBar.backgroundColor = kSectionBackGroundColor;
}
......@@ -152,6 +167,43 @@
[self.navigationController dismissViewControllerAnimated:YES completion:nil];
}
- (void)addZan:(ZanButton *)sender
{
sender.selected = !sender.selected;
NSInteger row = sender.tag - kThumbTag;
QuestionModel *question = _allQuestionArray[row];
NSDate *date = [NSDate date];
NSTimeZone *zone = [NSTimeZone systemTimeZone];
NSInteger interval = [zone secondsFromGMTForDate:date];
NSDate *localeDate = [date dateByAddingTimeInterval:interval];
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"YYYY-MM-dd+hh:mm:ss"];
NSString *dateString = [dateFormatter stringFromDate:localeDate];
NSDictionary *dict = [[NSUserDefaults standardUserDefaults] objectForKey:@"loginData"];
NSString *operId = dict[@"user_code"];
NSString *operName = dict[@"user_name"];
NSString *url = [NSString stringWithFormat:@"%@%@%@?time=%@&operId=%@&operName=%@", kRedStarURL, kAddLikeURL, question.uuid, dateString, operId, operName];
url = [url stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
HttpClient *httpClient = [[HttpClient alloc] initWithUrl:url];
[httpClient likeCountWithParameters:nil completion:^(id response, NSError *error) {
if (response[@"success"]) {
int likeCount = [sender.titleLabel.text intValue];
[sender setTitle:[NSString stringWithFormat:@"%d", likeCount + 1] forState:UIControlStateNormal];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"警告" message:@"点赞失败!" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
[alert show];
}
}];
}
- (void)addClick:(UIButton *)sender
{
......@@ -235,6 +287,7 @@
_taxisView.backgroundColor = [UIColor whiteColor];
}
_taxisView.delegate = self;
[self.view addSubview:_bgView];
[self.view insertSubview:_taxisView aboveSubview:_bgView];
......@@ -312,18 +365,20 @@
}
- (void)searchBarClick:(UIButton *)sender
{
NSLog(@"%@", self.searchBar.searchTextFiled.text);
}
#pragma mark - TaxisDelegate
- (void)timeChange:(UIButton *)sender
{
[self closeRedView];
}
#pragma mark - ScreenTableDelegate
- (void)click
- (void)tableViewDidSelectRow:(NSInteger)row
{
NSLog(@"点一下");
[self closeGreenView];
......@@ -342,7 +397,8 @@
cell = [[QuestionListTableCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kQuestionListCell];
}
cell.question = _allQuestionArray[indexPath.row];
// cell.stateLabel.text = @"服务 - 15分钟退单";
[cell.thumbBtn addTarget:self action:@selector(addZan:) forControlEvents:UIControlEventTouchUpInside];
cell.thumbBtn.tag = kThumbTag + indexPath.row;
return cell;
}
......@@ -352,6 +408,7 @@
{
QuestionDetailViewController *questionDetailVC = [[QuestionDetailViewController alloc] init];
questionDetailVC.question = (QuestionModel *)_allQuestionArray[indexPath.row];
questionDetailVC.row = indexPath.row;
[self.navigationController pushViewController:questionDetailVC animated:YES];
}
......@@ -407,6 +464,7 @@
_tableView.dataSource = self;
_tableView.showsVerticalScrollIndicator = NO;
_tableView.showsHorizontalScrollIndicator = NO;
_tableView.tableFooterView = [[UIView alloc] init];
[self.view addSubview:_tableView];
[self.view insertSubview:_tableView atIndex:0];
......@@ -449,6 +507,27 @@
return _searchBar;
}
- (NoDataView *)noDataView
{
if (!_noDataView) {
_noDataView = [[NoDataView alloc] init];
_noDataView.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:_noDataView];
NSLayoutConstraint *tableTop = [NSLayoutConstraint constraintWithItem:_noDataView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.view addConstraint:tableTop];
NSLayoutConstraint *tableLeft = [NSLayoutConstraint constraintWithItem:_noDataView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.view addConstraint:tableLeft];
NSLayoutConstraint *tableRight = [NSLayoutConstraint constraintWithItem:_noDataView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.view addConstraint:tableRight];
NSLayoutConstraint *tableBottom = [NSLayoutConstraint constraintWithItem:_noDataView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.view addConstraint:tableBottom];
}
return _noDataView;
}
/*
#pragma mark - Navigation
......
......@@ -22,7 +22,6 @@
@property (nonatomic, copy) NSString *lastModify_time;
@property (nonatomic, copy) NSString *name;
@property (nonatomic, assign) int questionCount;
@property (nonatomic, copy) NSArray *questions;
@property (nonatomic, copy) NSString *ranking;
@property (nonatomic, assign) int reportCount;
@property (nonatomic, copy) NSString *reportTime;
......
......@@ -21,6 +21,7 @@
@property (nonatomic, copy) NSString *remark;
@property (nonatomic, copy) NSString *reportTime;
@property (nonatomic, strong) NSDictionary *reportor;
@property (nonatomic, copy) NSString *score;
@property (nonatomic, assign) int state;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *uuid;
......
......@@ -12,6 +12,9 @@
#import "HttpClient.h"
#import "RankListModel.h"
#import "NoDataView.h"
#import <MBProgressHUD.h>
#define kRankingCell @"RankingTableViewCell"
#define kShopNameBtnTag 15000
......@@ -23,7 +26,7 @@
@property (nonatomic, strong) NSMutableDictionary *selectedIndexes;
@property (nonatomic, strong) NSMutableArray *allRankListArray;
@property (nonatomic, strong) NoDataView *noDataView;
@end
@implementation RankingListViewController
......@@ -88,24 +91,32 @@
@"pageNumber":@(1),
@"pageSize":@(10)
};
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
__block RankingListViewController *weakSelf = self;
[httpCilent getRankingListWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"口碑排名response = %@", response);
NSDictionary *dataDict = response[@"data"];
NSArray *dataArray = dataDict[@"records"];
for (NSDictionary *ListDict in dataArray) {
RankListModel *rankList = [RankListModel rankListModelWithDict:ListDict];
[self.allRankListArray addObject:rankList];
[weakSelf.allRankListArray addObject:rankList];
}
if (_allRankListArray.count == 0) {
weakSelf.noDataView.backgroundColor = [UIColor whiteColor];
[MBProgressHUD hideHUDForView:self.view animated:YES];
} else {
self.tableView.delegate = self;
self.tableView.dataSource = self;
NSString *shopCount = [NSString stringWithFormat:@"%lu 家", (unsigned long)_allRankListArray.count];
NSMutableAttributedString *shopAttr = [[NSMutableAttributedString alloc] initWithString:shopCount];
[shopAttr addAttributes:@{NSForegroundColorAttributeName:kShopCountTextColor,NSFontAttributeName:[UIFont systemFontOfSize:21.0f]} range:NSMakeRange(0,shopCount.length - 2)];
[shopAttr addAttributes:@{NSForegroundColorAttributeName:[UIColor blackColor],NSFontAttributeName:[UIFont systemFontOfSize:15.0f]} range:NSMakeRange(shopCount.length - 2,2)];
_shoppingCountLabel.attributedText = shopAttr;
self.tableView.delegate = self;
self.tableView.dataSource = self;
NSString *shopCount = [NSString stringWithFormat:@"%lu 家", (unsigned long)_allRankListArray.count];
NSMutableAttributedString *shopAttr = [[NSMutableAttributedString alloc] initWithString:shopCount];
[shopAttr addAttributes:@{NSForegroundColorAttributeName:kShopCountTextColor,NSFontAttributeName:[UIFont systemFontOfSize:21.0f]} range:NSMakeRange(0,shopCount.length - 2)];
[shopAttr addAttributes:@{NSForegroundColorAttributeName:[UIColor blackColor],NSFontAttributeName:[UIFont systemFontOfSize:15.0f]} range:NSMakeRange(shopCount.length - 2,2)];
_shoppingCountLabel.attributedText = shopAttr;
[MBProgressHUD hideHUDForView:self.view animated:YES];
}
}];
}
......@@ -587,6 +598,31 @@
}
return _headView;
}
- (NoDataView *)noDataView
{
if (!_noDataView) {
_noDataView = [[NoDataView alloc] init];
_noDataView.translatesAutoresizingMaskIntoConstraints = NO;
[self.view addSubview:_noDataView];
NSLayoutConstraint *tableTop = [NSLayoutConstraint constraintWithItem:_noDataView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.view addConstraint:tableTop];
NSLayoutConstraint *tableLeft = [NSLayoutConstraint constraintWithItem:_noDataView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.view addConstraint:tableLeft];
NSLayoutConstraint *tableRight = [NSLayoutConstraint constraintWithItem:_noDataView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.view addConstraint:tableRight];
NSLayoutConstraint *tableBottom = [NSLayoutConstraint constraintWithItem:_noDataView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.view addConstraint:tableBottom];
}
return _noDataView;
}
/*
#pragma mark - Navigation
......
......@@ -160,7 +160,27 @@
- (void)moreButtonClick:(UIButton *)sender
{
NSLog(@"查看全部公告···");
UIButton *button = (UIButton *)sender;
UINavigationController *nav;
if (button.tag - 332892 == 0) {
PictureViewController *pictureVC = [[PictureViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:pictureVC];
} else if (button.tag - 332892 == 1) {
RankingListViewController *rankingListVC = [[RankingListViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:rankingListVC];
} else if (button.tag - 332892 == 2) {
QuestionViewController *questionVC = [[QuestionViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:questionVC];
} else {
InspectListViewController *inspectListVC = [[InspectListViewController alloc] init];
nav = [[UINavigationController alloc] initWithRootViewController:inspectListVC];
}
[nav.navigationBar setBarTintColor:kNavigationBarColor];
[nav.navigationBar setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],NSForegroundColorAttributeName,nil]];
[self presentViewController:nav animated:YES completion:nil];
}
- (void)itemClick:(HomeCellItem *)sender
......@@ -519,6 +539,7 @@
// 查看更多按钮
UIButton *moreButton = [[UIButton alloc] init];
moreButton.tag = 332892 + section;
moreButton.translatesAutoresizingMaskIntoConstraints = NO;
[moreButton setTitle:@"更多" forState:UIControlStateNormal];
[moreButton setTitleColor:kMoreButtonTextColor forState:UIControlStateNormal];
......
......@@ -129,7 +129,7 @@
[MBProgressHUD showHUDAddedTo:window animated:YES];
[httpClient loginWithUsername:self.loginView.usernameTextFiled.text password:self.loginView.passwordTextFiled.text completion:^(id response, NSError *error) {
if ([response[@"message"] isEqualToString:@"ok"]) {
// 保存登陆信息
[[NSUserDefaults standardUserDefaults] setObject:self.loginView.usernameTextFiled.text forKey:@"username"];
[[NSUserDefaults standardUserDefaults] setObject:self.loginView.passwordTextFiled.text forKey:@"password"];
......
......@@ -37,4 +37,10 @@ typedef void (^completionBlock) (id response, NSError *error);
// 提交评论
- (void)submitCommentWithParameters:(id)parameters completion:(completionBlock)completion;
// 提交评论
- (void)likeCountWithParameters:(id)parameters completion:(completionBlock)completion;
// 取消点赞
- (void)cancelLikeCountWithParameters:(id)parameters completion:(completionBlock)completion;
@end
......@@ -147,7 +147,27 @@
- (void)submitCommentWithParameters:(id)parameters completion:(completionBlock)completion
{
[self getParameters:parameters completion:^(id response, NSError *error) {
[self postParameters:parameters completion:^(id response, NSError *error) {
if (completion) {
completion (response, error);
}
}];
}
// 点赞
- (void)likeCountWithParameters:(id)parameters completion:(completionBlock)completion
{
[self postParameters:parameters completion:^(id response, NSError *error) {
if (completion) {
completion (response, error);
}
}];
}
// 取消点赞
- (void)cancelLikeCountWithParameters:(id)parameters completion:(completionBlock)completion
{
[self postParameters:parameters completion:^(id response, NSError *error) {
if (completion) {
completion (response, error);
}
......
......@@ -50,6 +50,9 @@
_taxiButton.tag = 4001;
_taxiButton.translatesAutoresizingMaskIntoConstraints = NO;
[_taxiButton setTitleColor:kInspectSectionButtonTextColor forState:UIControlStateNormal];
[_taxiButton setTitleColor:[UIColor orangeColor] forState:UIControlStateSelected];
[_taxiButton setImage:[UIImage imageNamed:@"sort_icon_after"] forState:UIControlStateSelected];
_taxiButton.titleLabel.font = [UIFont systemFontOfSize:14.0];
[_taxiButton setTitle:@"排序" forState:UIControlStateNormal];
[self addSubview:_taxiButton];
......@@ -77,6 +80,8 @@
_screenButton.translatesAutoresizingMaskIntoConstraints = NO;
_screenButton.titleLabel.font = [UIFont systemFontOfSize:14.0];
[_screenButton setTitleColor:kInspectSectionButtonTextColor forState:UIControlStateNormal];
[_screenButton setTitleColor:[UIColor orangeColor] forState:UIControlStateSelected];
[_screenButton setImage:[UIImage imageNamed:@"filter_after"] forState:UIControlStateSelected];
[_screenButton setTitle:@"筛选" forState:UIControlStateNormal];
[self addSubview:_screenButton];
......
......@@ -50,6 +50,9 @@
self.tableView = [[UITableView alloc] init];
_tableView.delegate = self;
_tableView.dataSource = self;
NSInteger selectedIndex = 0;
NSIndexPath *selectedIndexPath = [NSIndexPath indexPathForRow:selectedIndex inSection:0];
[_tableView selectRowAtIndexPath:selectedIndexPath animated:NO scrollPosition:UITableViewScrollPositionNone];
GroupItems *tableItem = [[GroupItems alloc] initWithTitle:@"状态等于" view:_tableView];
......@@ -110,14 +113,21 @@
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kScreenTabelViewCell];
}
cell.textLabel.text = _testArray[indexPath.row];
cell.textLabel.font = [UIFont systemFontOfSize:14.0];
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"iconfont-duigou2"]];
imageView.frame = CGRectMake(kScreenWidth - self.groupTabBar.frame.size.width - 30, 15, 19, 14);
[cell.contentView addSubview:imageView];
return cell;
}
// cell的点击事件
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (_delegate) {
[_delegate tableViewDidSelectRow:indexPath.row];
}
......
......@@ -8,12 +8,18 @@
#import "TaxisView.h"
@interface TaxisView ()
@property (nonatomic, strong) NSMutableArray *buttons;
@end
@implementation TaxisView
- (instancetype)init
{
self = [super init];
if (self) {
self.buttons = [NSMutableArray array];
[self setup];
}
return self;
......@@ -23,6 +29,7 @@
{
self = [super initWithFrame:frame];
if (self) {
self.buttons = [NSMutableArray array];
[self setup];
}
return self;
......@@ -30,131 +37,62 @@
- (void)setup
{
[self.defaultBtn setTitle:@"默认排序" forState:UIControlStateNormal];
[self.sequenceBtn setTitle:@"时间顺序排序" forState:UIControlStateNormal];
[self.changeoverBtn setTitle:@"时间逆序排序" forState:UIControlStateNormal];
}
#pragma mark - Lazy loading
- (UIButton *)defaultBtn
- (void)layoutSubviews
{
if (!_defaultBtn) {
_defaultBtn = [[UIButton alloc] init];
_defaultBtn.layer.borderWidth = 0.5;
_defaultBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 20, 0, 0);
_defaultBtn.layer.borderColor = kSeparateLineCGColor;
_defaultBtn.translatesAutoresizingMaskIntoConstraints = NO;
[_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];
// 顶端
NSLayoutConstraint *titleTop = [NSLayoutConstraint constraintWithItem:_defaultBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self addConstraint:titleTop];
// 左边
NSLayoutConstraint *titleLeft = [NSLayoutConstraint constraintWithItem:_defaultBtn attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self addConstraint:titleLeft];
// 右边
NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_defaultBtn attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self addConstraint:titleRight];
// 右边
NSLayoutConstraint *titleHeight = [NSLayoutConstraint constraintWithItem:_defaultBtn attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:self.sequenceBtn attribute:NSLayoutAttributeHeight multiplier:1.0 constant:0];
[self addConstraint:titleHeight];
CGFloat buttonW = kScreenWidth;
CGFloat buttonH = self.frame.size.height / 3;
NSArray *titleArray = @[@"默认排序",@"时间顺序排序",@"时间逆序排序"];
for (int i = 0; i < 3; i++) {
UIButton *button = [[UIButton alloc] init];
button.titleLabel.font = [UIFont systemFontOfSize:15.0];
button.tag = kTAxisBtnTag + i + 1;
[button setTitleColor:kLightBlack forState:UIControlStateNormal];
[button setTitleColor:[UIColor orangeColor] forState:UIControlStateSelected];
button.frame = CGRectMake(0, i * buttonH, buttonW, buttonH);
[button setTitle:titleArray[i] forState:UIControlStateNormal];
button.layer.borderWidth = 0.5;
button.titleEdgeInsets = UIEdgeInsetsMake(0, 20, 0, 0);
button.layer.borderColor = kSeparateLineCGColor;
button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft ;
button.titleLabel.font = [UIFont systemFontOfSize:14.0];
[button setImage:[UIImage imageNamed:@"iconfont-duigou2"] forState:UIControlStateNormal];
[button setImage:[UIImage imageNamed:@"iconfont-duigou"] forState:UIControlStateSelected];
button.imageEdgeInsets = UIEdgeInsetsMake(0, kScreenWidth - 30, 0, 0);
button.titleEdgeInsets = UIEdgeInsetsMake(0, 0, 0, 0);
button.imageView.contentMode = UIViewContentModeRight;
button.titleLabel.contentMode = UIViewContentModeLeft;
[button addTarget:self action:@selector(touchDownForButton:) forControlEvents:UIControlEventTouchDown];
button.adjustsImageWhenHighlighted = NO;
[self addSubview:button];
[self.buttons addObject:button];
}
return _defaultBtn;
UIButton *tempBtn = [_buttons objectAtIndex:0];
tempBtn.selected = YES;
}
- (UIButton *)sequenceBtn
{
if (!_sequenceBtn) {
_sequenceBtn = [[UIButton alloc] init];
_sequenceBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 20, 0, 0);
_sequenceBtn.translatesAutoresizingMaskIntoConstraints = NO;
_sequenceBtn.layer.borderColor = kSeparateLineCGColor;
_sequenceBtn.layer.borderWidth = 0.5;
[_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];
// 顶端
NSLayoutConstraint *titleTop = [NSLayoutConstraint constraintWithItem:_sequenceBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:_defaultBtn attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self addConstraint:titleTop];
// 左边
NSLayoutConstraint *titleLeft = [NSLayoutConstraint constraintWithItem:_sequenceBtn attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self addConstraint:titleLeft];
// 右边
NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_sequenceBtn attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self addConstraint:titleRight];
// 右边
NSLayoutConstraint *titleHeight = [NSLayoutConstraint constraintWithItem:_sequenceBtn attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:self.changeoverBtn attribute:NSLayoutAttributeHeight multiplier:1.0 constant:0];
[self addConstraint:titleHeight];
}
return _sequenceBtn;
}
- (UIButton *)changeoverBtn
{
if (!_changeoverBtn) {
_changeoverBtn = [[UIButton alloc] init];
_changeoverBtn.layer.borderColor = kSeparateLineCGColor;
_changeoverBtn.layer.borderWidth = 0.5;
_changeoverBtn.titleEdgeInsets = UIEdgeInsetsMake(0, 20, 0, 0);
_changeoverBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft ;
_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];
// 顶端
NSLayoutConstraint *titleTop = [NSLayoutConstraint constraintWithItem:_changeoverBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:_sequenceBtn attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self addConstraint:titleTop];
// 左边
NSLayoutConstraint *titleLeft = [NSLayoutConstraint constraintWithItem:_changeoverBtn attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self addConstraint:titleLeft];
// 右边
NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_changeoverBtn attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self addConstraint:titleRight];
// 右边
NSLayoutConstraint *titleBottom = [NSLayoutConstraint constraintWithItem:_changeoverBtn attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self addConstraint:titleBottom];
- (void)touchDownForButton:(UIButton *)button{
for (UIButton * b in self.buttons) {
b.selected = NO;
}
return _changeoverBtn;
}
- (void)click:(UIButton *)sender
{
button.selected = YES;
if (_delegate) {
[_delegate timeChange:sender];
[_delegate timeChange:button];
}
}
@end
......@@ -9,5 +9,5 @@
#import <UIKit/UIKit.h>
@interface ZanButton : UIButton
@property (nonatomic, assign) BOOL isZan;
@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