Commit c694e41b authored by admin's avatar admin

修复了我的 部分bug

parent 4b9a9bb0
{
"images" : [
{
"idiom" : "universal",
"filename" : "SystemImage.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "SystemImage@2x.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"version" : 1,
"author" : "xcode"
}
}
\ No newline at end of file
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#import "QuestionDetailCell.h" #import "QuestionDetailCell.h"
#import "QuestionCommentCell.h" #import "QuestionCommentCell.h"
#import "QuestionDescribeCell.h" #import "QuestionDescribeCell.h"
#import "QuestionDetailFooterView.h"
#import "CommentView.h" #import "CommentView.h"
#import "HttpClient.h" #import "HttpClient.h"
...@@ -24,7 +23,6 @@ ...@@ -24,7 +23,6 @@
#define kQuestionDescribeCell @"QuestionDescribeCell" // 问题描述 #define kQuestionDescribeCell @"QuestionDescribeCell" // 问题描述
@interface QuestionDetailViewController ()<UITableViewDelegate, UITableViewDataSource, UIAlertViewDelegate, UITextViewDelegate> @interface QuestionDetailViewController ()<UITableViewDelegate, UITableViewDataSource, UIAlertViewDelegate, UITextViewDelegate>
@property (nonatomic, strong) UITableView *tableView; @property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) QuestionDetailFooterView *footerView;
@property (nonatomic, strong) UIView *backGroundView; @property (nonatomic, strong) UIView *backGroundView;
@property (nonatomic, strong) CommentView *commentView; @property (nonatomic, strong) CommentView *commentView;
...@@ -47,7 +45,6 @@ ...@@ -47,7 +45,6 @@
self.navigationController.navigationBar.translucent = NO; self.navigationController.navigationBar.translucent = NO;
} }
[self.footerView.addButon addTarget:self action:@selector(addComment:) forControlEvents:UIControlEventTouchUpInside];
[self setupNav]; [self setupNav];
...@@ -97,8 +94,7 @@ ...@@ -97,8 +94,7 @@
[_allCommentArray addObject:comment]; [_allCommentArray addObject:comment];
} }
[MBProgressHUD hideHUDForView:self.view animated:YES]; [MBProgressHUD hideHUDForView:self.view animated:YES];
self.tableView.tableFooterView = self.footerView; [self.tableView reloadData];
}]; }];
} }
...@@ -471,14 +467,7 @@ ...@@ -471,14 +467,7 @@
return _tableView; return _tableView;
} }
- (QuestionDetailFooterView *)footerView
{
if (!_footerView) {
_footerView = [[QuestionDetailFooterView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 140)];
_footerView.backgroundColor = kSectionBackGroundColor;
}
return _footerView;
}
......
...@@ -19,7 +19,7 @@ typedef enum ScoreState : NSUInteger { ...@@ -19,7 +19,7 @@ typedef enum ScoreState : NSUInteger {
@interface RankingListCell : UITableViewCell @interface RankingListCell : UITableViewCell
@property (nonatomic, assign) BOOL isDrop; // 判断是否drop @property (nonatomic, assign) BOOL isDrop; // 判断是否drop
@property (nonatomic, strong) UIButton *shopNameButton; // 商店名称 @property (nonatomic, strong) UILabel *shopNameButton; // 商店名称
@property (nonatomic, strong) UILabel *scoreLabel; // 分数 @property (nonatomic, strong) UILabel *scoreLabel; // 分数
@property (nonatomic, assign) ScoreState scoreState; // 判断类型 @property (nonatomic, assign) ScoreState scoreState; // 判断类型
@property (nonatomic, strong) UIView *gradeView; @property (nonatomic, strong) UIView *gradeView;
...@@ -29,7 +29,6 @@ typedef enum ScoreState : NSUInteger { ...@@ -29,7 +29,6 @@ typedef enum ScoreState : NSUInteger {
@property (nonatomic, strong) UILabel *someoneLabel; // 发表评语的人 @property (nonatomic, strong) UILabel *someoneLabel; // 发表评语的人
@property (nonatomic, strong) UILabel *dateLabel; // 发表时间 @property (nonatomic, strong) UILabel *dateLabel; // 发表时间
@property (nonatomic, strong) UILabel *remarkLabel; // 评语 @property (nonatomic, strong) UILabel *remarkLabel; // 评语
@property (nonatomic, strong) UIImageView *arrowImageView;
@property (nonatomic, strong) RankListModel *rankList; @property (nonatomic, strong) RankListModel *rankList;
@end @end
...@@ -25,8 +25,6 @@ ...@@ -25,8 +25,6 @@
#pragma mark - Private Methods #pragma mark - Private Methods
- (void)setup - (void)setup
{ {
self.arrowImageView.image = [UIImage imageNamed:@"grey-trilateral_right"];
self.shopNameButton.titleLabel.font = [UIFont systemFontOfSize:18.0];
self.scoreLabel.textColor = kDateButtonTextColor; self.scoreLabel.textColor = kDateButtonTextColor;
self.gradeView.backgroundColor = [UIColor clearColor]; self.gradeView.backgroundColor = [UIColor clearColor];
} }
...@@ -34,7 +32,7 @@ ...@@ -34,7 +32,7 @@
- (void)setRankList:(RankListModel *)rankList - (void)setRankList:(RankListModel *)rankList
{ {
_rankList = rankList; _rankList = rankList;
[self.shopNameButton setTitle:[NSString stringWithFormat:@"%@", rankList.store_name] forState:UIControlStateNormal]; self.shopNameButton.text = [NSString stringWithFormat:@"%@", rankList.store_name];
self.scoreLabel.text = [NSString stringWithFormat:@"%@", rankList.score]; self.scoreLabel.text = [NSString stringWithFormat:@"%@", rankList.score];
} }
...@@ -58,41 +56,20 @@ ...@@ -58,41 +56,20 @@
#pragma mark - Layz loading #pragma mark - Layz loading
- (UIImageView *)arrowImageView
{
if (!_arrowImageView) {
_arrowImageView = [[UIImageView alloc] init];
_arrowImageView.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView insertSubview:_arrowImageView aboveSubview:self.shopNameButton];
NSLayoutConstraint *shoppingTop = [NSLayoutConstraint constraintWithItem:_arrowImageView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:19];
[self.contentView addConstraint:shoppingTop];
NSLayoutConstraint *shoppingRight = [NSLayoutConstraint constraintWithItem:_arrowImageView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.shopNameButton attribute:NSLayoutAttributeLeft multiplier:1.0 constant:10];
[self.contentView addConstraint:shoppingRight];
NSLayoutConstraint *shoppingWidth = [NSLayoutConstraint constraintWithItem:_arrowImageView attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:8];
[self.contentView addConstraint:shoppingWidth];
NSLayoutConstraint *shoppingHeight = [NSLayoutConstraint constraintWithItem:_arrowImageView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:12];
[self.contentView addConstraint:shoppingHeight];
}
return _arrowImageView;
}
- (UIButton *)shopNameButton - (UILabel *)shopNameButton
{ {
if (!_shopNameButton) { if (!_shopNameButton) {
_shopNameButton = [[UIButton alloc] init]; _shopNameButton = [[UILabel alloc] init];
_shopNameButton.translatesAutoresizingMaskIntoConstraints = NO; _shopNameButton.translatesAutoresizingMaskIntoConstraints = NO;
_shopNameButton.titleLabel.textAlignment = NSTextAlignmentCenter; _shopNameButton.textColor = kShopNameTextColor;
[_shopNameButton setTitleColor:kShopNameTextColor forState:UIControlStateNormal]; _shopNameButton.font = [UIFont systemFontOfSize:17.0];
[self.contentView addSubview:_shopNameButton]; [self.contentView addSubview:_shopNameButton];
NSLayoutConstraint *shoppingTop = [NSLayoutConstraint constraintWithItem:_shopNameButton attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:1]; NSLayoutConstraint *shoppingTop = [NSLayoutConstraint constraintWithItem:_shopNameButton attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:1];
[self.contentView addConstraint:shoppingTop]; [self.contentView addConstraint:shoppingTop];
NSLayoutConstraint *shoppingLeft = [NSLayoutConstraint constraintWithItem:_shopNameButton attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:10]; NSLayoutConstraint *shoppingLeft = [NSLayoutConstraint constraintWithItem:_shopNameButton attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:25];
[self.contentView addConstraint:shoppingLeft]; [self.contentView addConstraint:shoppingLeft];
NSLayoutConstraint *shoppingRight = [NSLayoutConstraint constraintWithItem:_shopNameButton attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.scoreLabel attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0]; NSLayoutConstraint *shoppingRight = [NSLayoutConstraint constraintWithItem:_shopNameButton attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.scoreLabel attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
@interface MineTableHeaderView : UIView @interface MineTableHeaderView : UIView
@property (nonatomic, strong) UIImageView *bgImageView;
@property (nonatomic, strong) UILabel *companyLabel; @property (nonatomic, strong) UILabel *companyLabel;
@property (nonatomic, strong) UILabel *userLabel; @property (nonatomic, strong) UILabel *userLabel;
@property (nonatomic, strong) UILabel *numberLabel; @property (nonatomic, strong) UILabel *numberLabel;
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
@end @end
@implementation MineTableHeaderView @implementation MineTableHeaderView
#pragma mark - init #pragma mark - init
- (instancetype)initWithFrame:(CGRect)frame - (instancetype)initWithFrame:(CGRect)frame
{ {
...@@ -29,35 +28,61 @@ ...@@ -29,35 +28,61 @@
#pragma mark - Private Methods #pragma mark - Private Methods
- (void)setup - (void)setup
{ {
self.userLabel.text = @"用户: 陈宁"; self.bgImageView.image = [UIImage imageNamed:@"SystemImage"];
self.numberLabel.text = @"代码: 0005"; self.userLabel.text = [NSString stringWithFormat:@"用户: %@", [[NSUserDefaults standardUserDefaults] objectForKey:@"user_name"]];
self.companyLabel.text = @"公司: 红星美凯龙家居集团股份有限公司"; self.numberLabel.text = [NSString stringWithFormat:@"代码: %@", [[NSUserDefaults standardUserDefaults] objectForKey:@"user_code"]];
self.companyLabel.text = @"公司: 红星美凯龙";
} }
#pragma mark - lazy loading #pragma mark - lazy loading
- (UIImageView *)bgImageView
{
if (!_bgImageView) {
_bgImageView = [[UIImageView alloc] init];
_bgImageView.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:_bgImageView];
NSLayoutConstraint *companyHeight = [NSLayoutConstraint constraintWithItem:_bgImageView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:150];
[self addConstraint:companyHeight];
NSLayoutConstraint *companyTop = [NSLayoutConstraint constraintWithItem:_bgImageView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self addConstraint:companyTop];
NSLayoutConstraint *companyRight = [NSLayoutConstraint constraintWithItem:_bgImageView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self addConstraint:companyRight];
NSLayoutConstraint *companyLeft = [NSLayoutConstraint constraintWithItem:_bgImageView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self addConstraint:companyLeft];
}
return _bgImageView;
}
- (UILabel *)companyLabel - (UILabel *)companyLabel
{ {
if (!_companyLabel) { if (!_companyLabel) {
_companyLabel = [[UILabel alloc] init]; _companyLabel = [[UILabel alloc] init];
} }
_companyLabel.textAlignment = NSTextAlignmentCenter;
_companyLabel.translatesAutoresizingMaskIntoConstraints = NO; _companyLabel.translatesAutoresizingMaskIntoConstraints = NO;
_companyLabel.minimumScaleFactor = .5f; _companyLabel.minimumScaleFactor = .5f;
_companyLabel.adjustsFontSizeToFitWidth = YES; _companyLabel.adjustsFontSizeToFitWidth = YES;
_companyLabel.textColor = [UIColor whiteColor]; _companyLabel.textColor = [UIColor whiteColor];
[self addSubview:_companyLabel]; [self.bgImageView addSubview:_companyLabel];
NSLayoutConstraint *companyHeight = [NSLayoutConstraint constraintWithItem:_companyLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:45]; NSLayoutConstraint *companyHeight = [NSLayoutConstraint constraintWithItem:_companyLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:45];
[self addConstraint:companyHeight]; [self.bgImageView addConstraint:companyHeight];
NSLayoutConstraint *companyTop = [NSLayoutConstraint constraintWithItem:_companyLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:40]; NSLayoutConstraint *companyTop = [NSLayoutConstraint constraintWithItem:_companyLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.bgImageView attribute:NSLayoutAttributeTop multiplier:1.0 constant:40];
[self addConstraint:companyTop]; [self.bgImageView addConstraint:companyTop];
NSLayoutConstraint *companyRight = [NSLayoutConstraint constraintWithItem:_companyLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20]; NSLayoutConstraint *companyRight = [NSLayoutConstraint constraintWithItem:_companyLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.bgImageView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self addConstraint:companyRight]; [self.bgImageView addConstraint:companyRight];
NSLayoutConstraint *companyLeft = [NSLayoutConstraint constraintWithItem:_companyLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20]; NSLayoutConstraint *companyLeft = [NSLayoutConstraint constraintWithItem:_companyLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.bgImageView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self addConstraint:companyLeft]; [self.bgImageView addConstraint:companyLeft];
return _companyLabel; return _companyLabel;
} }
...@@ -70,22 +95,22 @@ ...@@ -70,22 +95,22 @@
_userLabel.textAlignment = NSTextAlignmentCenter; _userLabel.textAlignment = NSTextAlignmentCenter;
_userLabel.translatesAutoresizingMaskIntoConstraints = NO; _userLabel.translatesAutoresizingMaskIntoConstraints = NO;
_userLabel.textColor = [UIColor whiteColor]; _userLabel.textColor = [UIColor whiteColor];
[self addSubview:_userLabel]; [self.bgImageView addSubview:_userLabel];
NSLayoutConstraint *userHeight = [NSLayoutConstraint constraintWithItem:_userLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:35]; NSLayoutConstraint *userHeight = [NSLayoutConstraint constraintWithItem:_userLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:35];
[_userLabel addConstraint:userHeight]; [_userLabel addConstraint:userHeight];
NSLayoutConstraint *userLeft = [NSLayoutConstraint constraintWithItem:_userLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0]; NSLayoutConstraint *userLeft = [NSLayoutConstraint constraintWithItem:_userLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.bgImageView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self addConstraint:userLeft]; [self.bgImageView addConstraint:userLeft];
NSLayoutConstraint *userRight = [NSLayoutConstraint constraintWithItem:_userLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.numberLabel attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0]; NSLayoutConstraint *userRight = [NSLayoutConstraint constraintWithItem:_userLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.numberLabel attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self addConstraint:userRight]; [self.bgImageView addConstraint:userRight];
NSLayoutConstraint *userBottom = [NSLayoutConstraint constraintWithItem:_userLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0]; NSLayoutConstraint *userBottom = [NSLayoutConstraint constraintWithItem:_userLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.bgImageView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self addConstraint:userBottom]; [self.bgImageView addConstraint:userBottom];
NSLayoutConstraint *userWidth = [NSLayoutConstraint constraintWithItem:_userLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.numberLabel attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0]; NSLayoutConstraint *userWidth = [NSLayoutConstraint constraintWithItem:_userLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:self.numberLabel attribute:NSLayoutAttributeWidth multiplier:1.0 constant:0];
[self addConstraint:userWidth]; [self.bgImageView addConstraint:userWidth];
return _userLabel; return _userLabel;
} }
...@@ -98,20 +123,20 @@ ...@@ -98,20 +123,20 @@
_numberLabel.textAlignment = NSTextAlignmentCenter; _numberLabel.textAlignment = NSTextAlignmentCenter;
_numberLabel.translatesAutoresizingMaskIntoConstraints = NO; _numberLabel.translatesAutoresizingMaskIntoConstraints = NO;
_numberLabel.textColor = [UIColor whiteColor]; _numberLabel.textColor = [UIColor whiteColor];
[self addSubview:_numberLabel]; [self.bgImageView addSubview:_numberLabel];
NSLayoutConstraint *numberHeight = [NSLayoutConstraint constraintWithItem:_numberLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:35]; NSLayoutConstraint *numberHeight = [NSLayoutConstraint constraintWithItem:_numberLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:35];
[_numberLabel addConstraint:numberHeight]; [_numberLabel addConstraint:numberHeight];
NSLayoutConstraint *numberLeft = [NSLayoutConstraint constraintWithItem:_numberLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:_userLabel attribute:NSLayoutAttributeRight multiplier:1.0 constant:0]; NSLayoutConstraint *numberLeft = [NSLayoutConstraint constraintWithItem:_numberLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:_userLabel attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self addConstraint:numberLeft]; [self.bgImageView addConstraint:numberLeft];
NSLayoutConstraint *numberRight = [NSLayoutConstraint constraintWithItem:_numberLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:0]; NSLayoutConstraint *numberRight = [NSLayoutConstraint constraintWithItem:_numberLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.bgImageView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self addConstraint:numberRight]; [self.bgImageView addConstraint:numberRight];
NSLayoutConstraint *numberBottom = [NSLayoutConstraint constraintWithItem:_numberLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0]; NSLayoutConstraint *numberBottom = [NSLayoutConstraint constraintWithItem:_numberLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.bgImageView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self addConstraint:numberBottom]; [self.bgImageView addConstraint:numberBottom];
return _numberLabel; return _numberLabel;
} }
......
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