Commit db64356b authored by admin's avatar admin

完成问题详情界面

parent d0c3ab3c
......@@ -14,6 +14,8 @@
840ABECC1BE1C29F006E49C5 /* RankDetailViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 840ABECB1BE1C29F006E49C5 /* RankDetailViewController.m */; };
840ABECF1BE20A53006E49C5 /* RankShopDetialCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 840ABECE1BE20A53006E49C5 /* RankShopDetialCell.m */; };
841BBCDE1BE49E18007A21BF /* RankWorkDetailCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 841BBCDD1BE49E18007A21BF /* RankWorkDetailCell.m */; };
841D24F81BEB473C0005CC9F /* CheckPicViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 841D24F71BEB473C0005CC9F /* CheckPicViewController.m */; };
841D24FB1BEB75CA0005CC9F /* QuestionDetailFooterView.m in Sources */ = {isa = PBXBuildFile; fileRef = 841D24FA1BEB75CA0005CC9F /* QuestionDetailFooterView.m */; };
8442BA5C1BDB8FDB005E5657 /* MineTableHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 8442BA5B1BDB8FDB005E5657 /* MineTableHeaderView.m */; };
8474A01C1BE368D700315F30 /* HomeCellItem.m in Sources */ = {isa = PBXBuildFile; fileRef = 8474A01B1BE368D700315F30 /* HomeCellItem.m */; };
8474C5831BE751A2007DCF19 /* CommonFunc.m in Sources */ = {isa = PBXBuildFile; fileRef = 8474C5821BE751A2007DCF19 /* CommonFunc.m */; };
......@@ -95,6 +97,10 @@
840ABECE1BE20A53006E49C5 /* RankShopDetialCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RankShopDetialCell.m; sourceTree = "<group>"; };
841BBCDC1BE49E18007A21BF /* RankWorkDetailCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RankWorkDetailCell.h; sourceTree = "<group>"; };
841BBCDD1BE49E18007A21BF /* RankWorkDetailCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RankWorkDetailCell.m; sourceTree = "<group>"; };
841D24F61BEB473C0005CC9F /* CheckPicViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CheckPicViewController.h; sourceTree = "<group>"; };
841D24F71BEB473C0005CC9F /* CheckPicViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CheckPicViewController.m; sourceTree = "<group>"; };
841D24F91BEB75CA0005CC9F /* QuestionDetailFooterView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QuestionDetailFooterView.h; sourceTree = "<group>"; };
841D24FA1BEB75CA0005CC9F /* QuestionDetailFooterView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = QuestionDetailFooterView.m; sourceTree = "<group>"; };
8442BA5A1BDB8FDB005E5657 /* MineTableHeaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MineTableHeaderView.h; sourceTree = "<group>"; };
8442BA5B1BDB8FDB005E5657 /* MineTableHeaderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MineTableHeaderView.m; sourceTree = "<group>"; };
8474A01A1BE368D700315F30 /* HomeCellItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HomeCellItem.h; sourceTree = "<group>"; };
......@@ -237,6 +243,15 @@
path = Cell;
sourceTree = "<group>";
};
841D24F51BEB473B0005CC9F /* Check */ = {
isa = PBXGroup;
children = (
841D24F61BEB473C0005CC9F /* CheckPicViewController.h */,
841D24F71BEB473C0005CC9F /* CheckPicViewController.m */,
);
path = Check;
sourceTree = "<group>";
};
8426A4A01BDF0CD600E5FDF5 /* Function */ = {
isa = PBXGroup;
children = (
......@@ -391,6 +406,8 @@
8474C5871BE78A85007DCF19 /* View */ = {
isa = PBXGroup;
children = (
841D24F91BEB75CA0005CC9F /* QuestionDetailFooterView.h */,
841D24FA1BEB75CA0005CC9F /* QuestionDetailFooterView.m */,
);
path = View;
sourceTree = "<group>";
......@@ -665,6 +682,7 @@
84970E241BD8DEFE00C1728A /* Module */ = {
isa = PBXGroup;
children = (
841D24F51BEB473B0005CC9F /* Check */,
8426A4A01BDF0CD600E5FDF5 /* Function */,
84C957501BDB54BB00083584 /* Announce */,
84FD89F31BDA0136006E442A /* Chart */,
......@@ -1129,7 +1147,9 @@
84E420511BE89D9A00689976 /* InspectTaskSortCell.m in Sources */,
84AB20A91BE64DC600B66F13 /* PictureTableCell.m in Sources */,
84C582EC1BDDFB0400AF838D /* HomeFunctionCell.m in Sources */,
841D24FB1BEB75CA0005CC9F /* QuestionDetailFooterView.m in Sources */,
84CF0FA21BE9EDA900C855CE /* TakePhotoView.m in Sources */,
841D24F81BEB473C0005CC9F /* CheckPicViewController.m in Sources */,
84970E361BD8E09D00C1728A /* LoginViewController.m in Sources */,
84FD8A0A1BDA01D1006E442A /* MineViewController.m in Sources */,
848699B21BDF810900859DFE /* InspectListViewController.m in Sources */,
......
......@@ -8,6 +8,6 @@
#import <UIKit/UIKit.h>
@interface RootTabBarController : UITabBarController
@interface RootTabBarController : UITabBarController <UITabBarControllerDelegate>
@end
......@@ -14,7 +14,6 @@
#import "MineViewController.h"
@interface RootTabBarController ()
@end
@implementation RootTabBarController
......@@ -22,6 +21,22 @@
- (void)viewDidLoad
{
[self setupTabbar];
self.delegate = self;
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
self.parentViewController.tabBarController.tabBar.hidden = YES;
}
- (void)viewDidDisappear:(BOOL)animated
{
self.parentViewController.tabBarController.tabBar.hidden = YES;
}
//
......@@ -40,16 +55,20 @@
UINavigationController *chartNav = [self setUpOneChildViewController:chart title:@"报表查询" imageName:@"report_unchecked" selImageName:@"report_checked"];
MineViewController *mine = [[MineViewController alloc] init];
mine.tabBarItem.title= @"我的";
mine.tabBarItem.image = [UIImage imageNamed:@"aboutme_unchecked"];
mine.tabBarItem.selectedImage = [[UIImage imageNamed:@"aboutme_checke"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
UINavigationController *mineNav = [self setUpOneChildViewController:mine title:@"我的" imageName:@"aboutme_unchecked" selImageName:@"aboutme_checke"];
//
// mine.tabBarItem.title= @"我的";
// mine.tabBarItem.image = [UIImage imageNamed:@"aboutme_unchecked"];
// mine.tabBarItem.selectedImage = [[UIImage imageNamed:@"aboutme_checke"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
// mine.tabBarItem.tag = 30001;
//
[[UITabBarItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
kNavigationBarColor, NSForegroundColorAttributeName,
nil] forState:UIControlStateSelected];
self.viewControllers = @[homeNav, announceNav, chartNav, mine];
self.viewControllers = @[homeNav, announceNav, chartNav, mineNav];
}
......@@ -71,5 +90,27 @@
return nav;
}
#pragma mark - UITabBarController Delegate
//
//- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
// NSLog(@"shouldSelectViewController %@", tabBarController.selectedViewController);
// if (viewController.tabBarItem.tag == 30001) {
// [((UINavigationController *)tabBarController.selectedViewController) pushViewController:viewController animated:YES];
// return NO;
// }
// return YES;
//}
//- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
//{
// if ([viewController isKindOfClass:[MineViewController class]]) {
// MineViewController *mine = [[MineViewController alloc] init];
// mine.tabBarItem.title= @"我的";
// mine.tabBarItem.image = [UIImage imageNamed:@"aboutme_unchecked"];
// mine.tabBarItem.selectedImage = [[UIImage imageNamed:@"aboutme_checke"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
// [((UINavigationController *)tabBarController.selectedViewController) pushViewController:mine animated:YES];
// }
//}
@end
......@@ -10,6 +10,8 @@
#define Constant_h
#define kNavigationBarColor [UIColor colorWithRed:0 / 255.0 green:111 / 255.0 blue:188 / 255.0 alpha:1.0]
#define kNavigationBarCGColor [[UIColor colorWithRed:0 / 255.0 green:111 / 255.0 blue:188 / 255.0 alpha:1.0] CGColor]
#define kRemindTextColor [UIColor colorWithRed:133 / 255.0 green:133/255.0 blue:133/255.0 alpha:1.0]
#define kMineBackGroundColor [UIColor colorWithRed:243 / 255.0 green:243 / 255.0 blue:243 / 255.0 alpha:1.0]
#define kHomeSectionButtonTextColor [UIColor colorWithRed:186 / 255.0 green:186 / 255.0 blue:186 / 255.0 alpha:1.0]
......@@ -108,9 +110,12 @@
#define kDetailCellDescribeTextColor [UIColor colorWithRed:136 / 255.0 green:136 / 255.0 blue:136 / 255.0 alpha:1.0]
// #444444
#define kdetailCellTitleColor [UIColor colorWithRed:68 / 255.0 green:68 / 255.0 blue:68 / 255.0 alpha:1.0]
// #fff6f0
#define kQuestionFeedBackColor [UIColor colorWithRed:255 / 255.0 green:246 / 255.0 blue:240 / 255.0 alpha:1.0]
// #fe6903
#define kQuestionFeedBackTitleColor [UIColor colorWithRed:254 / 255.0 green:105 / 255.0 blue:3 / 255.0 alpha:1.0]
#define kQuestionFeedBackTitleCGColor [[UIColor colorWithRed:254 / 255.0 green:105 / 255.0 blue:3 / 255.0 alpha:1.0] CGColor]
// #999999
#define kLightGray [UIColor colorWithRed:153 / 255.0 green:153 / 255.0 blue:153 / 255.0 alpha:1.0]
......
//
// CheckPicViewController.h
// PTools
//
// Created by 侯振兴 on 15/8/11.
// Copyright (c) 2015年 moobox. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface CheckPicViewController : UIViewController
@property (nonatomic, strong) UIImage *checkImage;
@end
//
// CheckPicViewController.m
// PTools
//
// Created by 侯振兴 on 15/8/11.
// Copyright (c) 2015年 moobox. All rights reserved.
//
#import "CheckPicViewController.h"
@interface CheckPicViewController () {
}
@property (nonatomic, strong) UIImageView *takeImageView;
@end
@implementation CheckPicViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor redColor];
self.takeImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)];
_takeImageView.image = _checkImage;
[self.view addSubview:_takeImageView];
// [self addGestureRecognizerToView:_takeImageView];
// [_takeImageView setUserInteractionEnabled:YES];
// [_takeImageView setMultipleTouchEnabled:YES];
// Do any additional setup after loading the view.
}
- (void) addGestureRecognizerToView:(UIView *)view {
// 缩放手势
UIPinchGestureRecognizer *pinchGestureRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinchView:)];
[view addGestureRecognizer:pinchGestureRecognizer];
// 移动手势
UIPanGestureRecognizer *panGestureRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(panView:)];
[view addGestureRecognizer:panGestureRecognizer];
}
// 处理缩放手势
- (void) pinchView:(UIPinchGestureRecognizer *)pinchGestureRecognizer {
UIView *view = pinchGestureRecognizer.view;
if (pinchGestureRecognizer.state == UIGestureRecognizerStateBegan || pinchGestureRecognizer.state == UIGestureRecognizerStateChanged) {
view.transform = CGAffineTransformScale(view.transform, pinchGestureRecognizer.scale, pinchGestureRecognizer.scale);
if (_takeImageView.frame.size.width < kScreenWidth) {
_takeImageView.frame = CGRectMake(0, 0, kScreenWidth, kScreenHeight);
//让图片无法缩得比原图小
}
if (_takeImageView.frame.size.width > 3 * kScreenWidth) {
_takeImageView.frame = CGRectMake(-kScreenWidth, -kScreenHeight, 3 * kScreenWidth, 3 * kScreenHeight);
}
pinchGestureRecognizer.scale = 1;
}
}
// 处理拖拉手势
- (void) panView:(UIPanGestureRecognizer *)panGestureRecognizer
{
UIView *view = panGestureRecognizer.view;
if (panGestureRecognizer.state == UIGestureRecognizerStateBegan || panGestureRecognizer.state == UIGestureRecognizerStateChanged) {
CGPoint translation = [panGestureRecognizer translationInView:view.superview];
[view setCenter:(CGPoint){view.center.x + translation.x, view.center.y + translation.y}];
[panGestureRecognizer setTranslation:CGPointZero inView:view.superview];
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end
......@@ -10,4 +10,8 @@
@interface QuestionCommentCell : UITableViewCell
@property (nonatomic, strong) UILabel *suggestLabel; // 评论
@property (nonatomic, strong) UILabel *peopleLabel; // 评论人
@property (nonatomic, strong) UILabel *positionLabel; // 职位
@property (nonatomic, strong) UILabel *dateLabel; // 职位
@end
......@@ -21,5 +21,90 @@
#pragma mark - Private Methods
- (void)setup
{
}
#pragma mark - lazy loading
- (UILabel *)suggestLabel
{
if (!_suggestLabel) {
_suggestLabel = [[UILabel alloc] init];
_suggestLabel.font = [UIFont systemFontOfSize:15.0];
_suggestLabel.textColor = kLightBlack;
_suggestLabel.translatesAutoresizingMaskIntoConstraints = NO;
_suggestLabel.numberOfLines = 0;
[self.contentView addSubview:_suggestLabel];
// 顶端
NSLayoutConstraint *titleTop = [NSLayoutConstraint constraintWithItem:_suggestLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:12];
[self.contentView addConstraint:titleTop];
// 左边
NSLayoutConstraint *titleLeft = [NSLayoutConstraint constraintWithItem:_suggestLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:titleLeft];
// 右边
NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_suggestLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:titleRight];
}
return _suggestLabel;
}
- (UILabel *)peopleLabel
{
if (!_peopleLabel) {
_peopleLabel = [[UILabel alloc] init];
_peopleLabel.font = [UIFont systemFontOfSize:15.0];
_peopleLabel.textColor = kLightGray;
_peopleLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_peopleLabel];
// 顶端
NSLayoutConstraint *titleTop = [NSLayoutConstraint constraintWithItem:_peopleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.suggestLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:7];
[self.contentView addConstraint:titleTop];
// 左边
NSLayoutConstraint *titleLeft = [NSLayoutConstraint constraintWithItem:_peopleLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:titleLeft];
// 右边
NSLayoutConstraint *titleRight = [NSLayoutConstraint constraintWithItem:_peopleLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.dateLabel attribute:NSLayoutAttributeLeft multiplier:1.0 constant:-10];
[self.contentView addConstraint:titleRight];
// 高度
NSLayoutConstraint *titleBottom = [NSLayoutConstraint constraintWithItem:_peopleLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-10];
[self.contentView addConstraint:titleBottom];
}
return _peopleLabel;
}
- (UILabel *)dateLabel
{
if (!_dateLabel) {
_dateLabel = [[UILabel alloc] init];
_dateLabel.font = [UIFont systemFontOfSize:15.0];
_dateLabel.textColor = kLightGray;
_dateLabel.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_dateLabel];
// 顶端
NSLayoutConstraint *titleTop = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.suggestLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:7];
[self.contentView addConstraint:titleTop];
// 右边
NSLayoutConstraint *titleWidth = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:150];
[self.contentView addConstraint:titleWidth];
// 高度
NSLayoutConstraint *titleBottom = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-10];
[self.contentView addConstraint:titleBottom];
}
return _dateLabel;
}
@end
......@@ -12,7 +12,9 @@
@property (nonatomic, strong) UILabel *titleLabel; // 标题
@property (nonatomic, strong) UILabel *describeLabel; // 描述
@property (nonatomic, strong) UILabel *pictureLabel; // 照片
@property (nonatomic, strong) UIImageView *pcitureImageView; // 照片
@property (nonatomic, strong) UIView *pictureView; // 照片
@property (nonatomic, strong) UILabel *feedbackLabel; // 反馈
@property (nonatomic, strong) UIView *feedbackBackView; // 反馈背景
@property (nonatomic, strong) UILabel *answerLabel; // 答案
......
......@@ -210,9 +210,14 @@
NSLayoutConstraint *sortRight = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:sortRight];
// 高度
// // 高度
NSLayoutConstraint *sortHeight = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:25];
[self.contentView addConstraint:sortHeight];
// 高度
NSLayoutConstraint *sortBottom = [NSLayoutConstraint constraintWithItem:_dateLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-12];
[self.contentView addConstraint:sortBottom];
}
return _dateLabel;
}
......
//
// QuestionDetailFooterView.h
// redstar
//
// Created by admin on 15/11/5.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface QuestionDetailFooterView : UIView
@property (nonatomic, strong) UIButton *addButon;
@end
//
// QuestionDetailFooterView.m
// redstar
//
// Created by admin on 15/11/5.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "QuestionDetailFooterView.h"
@implementation QuestionDetailFooterView
- (instancetype)init
{
self = [super init];
if (self) {
[self setup];
}
return self;
}
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self setup];
}
return self;
}
#pragma mark - Private Methods
- (void)setup
{
[self.addButon setTitle:@"添加评论" forState:UIControlStateNormal];
}
#pragma mark - lazy loading
- (UIButton *)addButon
{
if (!_addButon) {
_addButon = [[UIButton alloc] init];
// 设置圆角
_addButon.layer.cornerRadius = 5;
_addButon.layer.masksToBounds = YES;
_addButon.translatesAutoresizingMaskIntoConstraints = NO;
_addButon.backgroundColor = kLoginButtonBackGroundColor;
[_addButon setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
_addButon.titleLabel.font = [UIFont systemFontOfSize:20.0];
[self addSubview:_addButon];
// 顶端
NSLayoutConstraint *loginBottom = [NSLayoutConstraint constraintWithItem:_addButon attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-20];
[self addConstraint:loginBottom];
// 左边
NSLayoutConstraint *loginLeft = [NSLayoutConstraint constraintWithItem:_addButon attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self addConstraint:loginLeft];
// 右边
NSLayoutConstraint *loginRight = [NSLayoutConstraint constraintWithItem:_addButon attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self addConstraint:loginRight];
// 高度
NSLayoutConstraint *loginHeight = [NSLayoutConstraint constraintWithItem:_addButon attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:45];
[self addConstraint:loginHeight];
}
return _addButon;
}
@end
......@@ -10,14 +10,14 @@
#import "QuestionDetailCell.h"
#import "QuestionCommentCell.h"
#import "QuestionDescribeCell.h"
#import "QuestionDetailFooterView.h"
#define kQuestionDetailCell @"QuestionDetailCell" // 问题详情
#define kQuestionCommentCell @"QuestionCommentCell" // 评论
#define kQuestionDescribeCell @"QuestionDescribeCell" // 问题描述
@interface QuestionDetailViewController ()<UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) QuestionDetailFooterView *footerView;
@property (nonatomic, strong) NSArray *test1Array;
@property (nonatomic, strong) NSArray *test2Array;
@property (nonatomic, strong) NSArray *test3Array;
......@@ -30,13 +30,12 @@
{
[super viewDidLoad];
[self.tableView registerClass:[QuestionDetailCell class] forCellReuseIdentifier:kQuestionDetailCell];
[self.tableView registerClass:[QuestionCommentCell class] forCellReuseIdentifier:kQuestionCommentCell];
[self.tableView registerClass:[QuestionDescribeCell class] forCellReuseIdentifier:kQuestionDescribeCell];
self.tableView.tableFooterView = self.footerView;
[self.footerView.addButon addTarget:self action:@selector(addComment:) forControlEvents:UIControlEventTouchUpInside];
[self setupNav];
self.test1Array = [NSArray arrayWithObjects:@"该建议很好", @"有效提高了用户体验,建议多提类似建议", nil];
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];
......@@ -57,6 +56,11 @@
self.navigationItem.titleView = customLab;
}
- (void)addComment:(UIButton *)sender
{
}
#pragma mark - UITableView Delegate/DataSource
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
......@@ -89,6 +93,19 @@
if (!cell) {
cell = [[QuestionDescribeCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kQuestionDescribeCell];
}
cell.answerLabel.text = @"新的SOP对营业员跟单的要求,已经修改为送货完成后的2天内,不再是要求当天。";
NSMutableAttributedString *attributedString = [[NSMutableAttributedString alloc] initWithString:cell.answerLabel.text];
NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init];
paragraphStyle.alignment = NSTextAlignmentLeft;
paragraphStyle.lineSpacing = 6; //行自定义行高度
[attributedString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0, [cell.answerLabel.text length])];
cell.answerLabel.attributedText = attributedString;
[cell.answerLabel sizeToFit];
cell.peopleLabel.text = @"问题解决负责人:杨发布";
cell.dateLabel.text = @"反馈时间:2015-09-11 10:23:15";
return cell;
} else {
......@@ -96,22 +113,13 @@
if (!cell) {
cell = [[QuestionCommentCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kQuestionCommentCell];
}
cell.suggestLabel.text = _test1Array[indexPath.row];
cell.peopleLabel.text = _test2Array[indexPath.row];
cell.dateLabel.text = _test3Array[indexPath.row];
return cell;
}
}
// cell的高度
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section == 0) {
return 148;
} else if (indexPath.section == 1) {
return 200;
} else {
return 50;
}
}
// section高度
......@@ -122,7 +130,7 @@
} else if (section == 1) {
return CGFLOAT_MIN;
} else {
return 40;
return 50;
}
}
......@@ -134,16 +142,66 @@
//// 自定义section
//- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
//{
// // 创建sectionView
// UIView *sectionView = [[UIView alloc] init];
// sectionView.userInteractionEnabled = YES;
// sectionView.backgroundColor = kInspectSectionBackGroundColor;
//
// return sectionView;
//}
// 自定义section
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
if (section == 2) {
// 创建sectionView
UIView *sectionView = [[UIView alloc] init];
sectionView.userInteractionEnabled = YES;
sectionView.backgroundColor = kInspectSectionBackGroundColor;
// 创建标题label
UILabel *titleLabel = [[UILabel alloc] init];
titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
titleLabel.textColor = kHomeSectionTitleTextColor;
titleLabel.font = [UIFont systemFontOfSize:16.0];
titleLabel.text = @"评论";
[sectionView addSubview:titleLabel];
NSLayoutConstraint *titleLabelTop = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeTop multiplier:1.0 constant:2];
[sectionView addConstraint:titleLabelTop];
NSLayoutConstraint *titleLabelLeft = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[sectionView addConstraint:titleLabelLeft];
NSLayoutConstraint *titleLabelWidth = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:80];
[sectionView addConstraint:titleLabelWidth];
NSLayoutConstraint *titleLabelBottom = [NSLayoutConstraint constraintWithItem:titleLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[sectionView addConstraint:titleLabelBottom];
// 创建标题label
UIButton *titleBtn = [[UIButton alloc] init];
titleBtn.translatesAutoresizingMaskIntoConstraints = NO;
[titleBtn setTitle:@"添加评论" forState:UIControlStateNormal];
[titleBtn setTitleColor:kNavigationBarColor forState:UIControlStateNormal];
titleBtn.titleLabel.font = [UIFont systemFontOfSize:14.0];
titleBtn.layer.borderColor = kNavigationBarCGColor;
titleBtn.layer.borderWidth = 1.0;
titleBtn.layer.cornerRadius = 5;
titleBtn.backgroundColor = [UIColor whiteColor];
[sectionView addSubview:titleBtn];
NSLayoutConstraint *titleBtnTop = [NSLayoutConstraint constraintWithItem:titleBtn attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeTop multiplier:1.0 constant:10];
[sectionView addConstraint:titleBtnTop];
NSLayoutConstraint *titleBtnRight = [NSLayoutConstraint constraintWithItem:titleBtn attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[sectionView addConstraint:titleBtnRight];
NSLayoutConstraint *titleBtnWidth = [NSLayoutConstraint constraintWithItem:titleBtn attribute:NSLayoutAttributeWidth relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:80];
[sectionView addConstraint:titleBtnWidth];
NSLayoutConstraint *titleBtnBottom = [NSLayoutConstraint constraintWithItem:titleBtn attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:sectionView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-10];
[sectionView addConstraint:titleBtnBottom];
return sectionView;
}
else {
return nil;
}
}
......@@ -157,6 +215,11 @@
_tableView.dataSource = self;
_tableView.showsVerticalScrollIndicator = NO;
_tableView.showsHorizontalScrollIndicator = NO;
_tableView.rowHeight = UITableViewAutomaticDimension;
_tableView.estimatedRowHeight = 200.0;
[_tableView registerClass:[QuestionDetailCell class] forCellReuseIdentifier:kQuestionDetailCell];
[_tableView registerClass:[QuestionCommentCell class] forCellReuseIdentifier:kQuestionCommentCell];
[_tableView registerClass:[QuestionDescribeCell class] forCellReuseIdentifier:kQuestionDescribeCell];
[self.view addSubview:_tableView];
NSLayoutConstraint *tableTop = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
......@@ -174,6 +237,14 @@
return _tableView;
}
- (QuestionDetailFooterView *)footerView
{
if (!_footerView) {
_footerView = [[QuestionDetailFooterView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 140)];
_footerView.backgroundColor = kSectionBackGroundColor;
}
return _footerView;
}
@end
......@@ -8,6 +8,14 @@
#import <UIKit/UIKit.h>
@protocol TakePhotoDelegate <NSObject>
@optional
- (void)takePhotoShowPicture:(UIButton *)btn;
@end
@interface TakePhotoView : UIView <UINavigationControllerDelegate, UIImagePickerControllerDelegate>
{
// 标识被编辑的按钮 -1 为添加新的按钮
......@@ -15,6 +23,9 @@
}
@property (nonatomic, strong) UIButton *btn;
@property (nonatomic, assign) NSInteger editTag;
@property (nonatomic, strong) id <TakePhotoDelegate>delegate;
- (BOOL)deleClose:(UIButton *)btn;
@end
......@@ -191,10 +191,8 @@
// 修改旧的控件
- (void)changeOld:(UIButton *)btn
{
// 标识为修改(tag为修改标识)
if (![self deleClose:btn]) {
editTag = btn.tag;
[self callImagePicker];
if (_delegate && [_delegate respondsToSelector:@selector(takePhotoShowPicture:)]) {
[_delegate takePhotoShowPicture:btn];
}
}
......@@ -208,6 +206,7 @@
if (editTag == -1) {
// 创建一个新的控件
UIButton *btn = [self createButtonWithImage:image andSeletor:@selector(changeOld:)];
[btn addTarget:self action:@selector(changeOld:) forControlEvents:UIControlEventTouchUpInside];
[self insertSubview:btn atIndex:self.subviews.count - 1];
[self.images addObject:image];
if (self.subviews.count - 1 == MaxImageCount) {
......
......@@ -8,6 +8,6 @@
#import <UIKit/UIKit.h>
@interface InspectSettleViewController : UIViewController
@interface InspectSettleViewController : UIViewController
@end
......@@ -10,9 +10,11 @@
#import "InspectSettleCell.h"
#import "InspectDetailFooterView.h"
#import "CheckPicViewController.h"
#define kInspectSettleCell @"InspectSettleCell"
@interface InspectSettleViewController () <UITableViewDelegate, UITableViewDataSource>
@interface InspectSettleViewController () <UITableViewDelegate, UITableViewDataSource, TakePhotoDelegate>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) InspectDetailFooterView *footerView;
......@@ -32,6 +34,7 @@
[self.tableView registerClass:[InspectSettleCell class] forCellReuseIdentifier:kInspectSettleCell];
self.tableView.tableFooterView = self.footerView;
self.footerView.takePhotoView.delegate = self;
[self.footerView.takePhotoView.btn addTarget:self action:@selector(addNew:) forControlEvents:UIControlEventTouchUpInside];
}
......@@ -40,6 +43,15 @@
// Dispose of any resources that can be recreated.
}
#pragma mark - TakePhoto Delegate
- (void)takePhotoShowPicture:(UIButton *)btn
{
CheckPicViewController *checkVC = [[CheckPicViewController alloc] init];
checkVC.checkImage = btn.imageView.image;
[self.navigationController pushViewController:checkVC animated:YES];
}
#pragma mark - Private Methods
- (void)addNew:(UIButton *)sender
{
......
......@@ -48,6 +48,7 @@
// Dispose of any resources that can be recreated.
}
#pragma mark - Prative Methods
- (void)setupNav
{
......
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