Commit de243197 authored by admin's avatar admin

修复 拍照后按钮显示不出来bug

parent 3a2738ae
......@@ -97,9 +97,9 @@
84D80EB61BF714BE00A10EA4 /* GroupTabBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D80EB41BF714BE00A10EA4 /* GroupTabBar.m */; };
84D8257F1BDD2F7E00CC61F7 /* MineTableFooterView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8257E1BDD2F7E00CC61F7 /* MineTableFooterView.m */; };
84D825821BDD35E000CC61F7 /* HomeHeaderView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D825811BDD35E000CC61F7 /* HomeHeaderView.m */; };
84DAB3EA1C07605F00F3E416 /* InspectNoUpLoadViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 84DAB3E91C07605F00F3E416 /* InspectNoUpLoadViewController.m */; };
84DAB3ED1C07645F00F3E416 /* InspectPointCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 84DAB3EC1C07645F00F3E416 /* InspectPointCell.m */; };
84DAB3F01C076C2E00F3E416 /* InpectPictureCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 84DAB3EF1C076C2E00F3E416 /* InpectPictureCell.m */; };
84D8636E1C1148EC00E4F4CC /* InpectPictureCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D863691C1148EC00E4F4CC /* InpectPictureCell.m */; };
84D8636F1C1148EC00E4F4CC /* InspectAddCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8636B1C1148EC00E4F4CC /* InspectAddCell.m */; };
84D863701C1148EC00E4F4CC /* InspectPicAddCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8636D1C1148EC00E4F4CC /* InspectPicAddCell.m */; };
84DB9BC41BDCD4B600822CC4 /* CustomDropMenuView.m in Sources */ = {isa = PBXBuildFile; fileRef = 84DB9BC31BDCD4B600822CC4 /* CustomDropMenuView.m */; };
84DB9BC71BDCD67200822CC4 /* UIView+Extension.m in Sources */ = {isa = PBXBuildFile; fileRef = 84DB9BC61BDCD67200822CC4 /* UIView+Extension.m */; };
84E0ABCD1BFB082E001C8F45 /* TaskDetailModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 84E0ABCC1BFB082E001C8F45 /* TaskDetailModel.m */; };
......@@ -322,12 +322,12 @@
84D8257E1BDD2F7E00CC61F7 /* MineTableFooterView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MineTableFooterView.m; sourceTree = "<group>"; };
84D825801BDD35E000CC61F7 /* HomeHeaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HomeHeaderView.h; sourceTree = "<group>"; };
84D825811BDD35E000CC61F7 /* HomeHeaderView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HomeHeaderView.m; sourceTree = "<group>"; };
84DAB3E81C07605F00F3E416 /* InspectNoUpLoadViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectNoUpLoadViewController.h; sourceTree = "<group>"; };
84DAB3E91C07605F00F3E416 /* InspectNoUpLoadViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InspectNoUpLoadViewController.m; sourceTree = "<group>"; };
84DAB3EB1C07645F00F3E416 /* InspectPointCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectPointCell.h; sourceTree = "<group>"; };
84DAB3EC1C07645F00F3E416 /* InspectPointCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InspectPointCell.m; sourceTree = "<group>"; };
84DAB3EE1C076C2E00F3E416 /* InpectPictureCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InpectPictureCell.h; sourceTree = "<group>"; };
84DAB3EF1C076C2E00F3E416 /* InpectPictureCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InpectPictureCell.m; sourceTree = "<group>"; };
84D863681C1148EC00E4F4CC /* InpectPictureCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InpectPictureCell.h; sourceTree = "<group>"; };
84D863691C1148EC00E4F4CC /* InpectPictureCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InpectPictureCell.m; sourceTree = "<group>"; };
84D8636A1C1148EC00E4F4CC /* InspectAddCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectAddCell.h; sourceTree = "<group>"; };
84D8636B1C1148EC00E4F4CC /* InspectAddCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InspectAddCell.m; sourceTree = "<group>"; };
84D8636C1C1148EC00E4F4CC /* InspectPicAddCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InspectPicAddCell.h; sourceTree = "<group>"; };
84D8636D1C1148EC00E4F4CC /* InspectPicAddCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = InspectPicAddCell.m; sourceTree = "<group>"; };
84DB9BC21BDCD4B600822CC4 /* CustomDropMenuView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CustomDropMenuView.h; sourceTree = "<group>"; };
84DB9BC31BDCD4B600822CC4 /* CustomDropMenuView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CustomDropMenuView.m; sourceTree = "<group>"; };
84DB9BC51BDCD67200822CC4 /* UIView+Extension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+Extension.h"; sourceTree = "<group>"; };
......@@ -714,7 +714,6 @@
8486999B1BDF810900859DFE /* Inspect */ = {
isa = PBXGroup;
children = (
84DAB3E41C07600000F3E416 /* InspectionPoint */,
84CF0ECA1BE9A7EF00C855CE /* InspectDetail */,
8486999C1BDF810900859DFE /* InspectList */,
848699A51BDF810900859DFE /* InspectTask */,
......@@ -1485,6 +1484,12 @@
84CF0ECB1BE9A7EF00C855CE /* Cell */ = {
isa = PBXGroup;
children = (
84D863681C1148EC00E4F4CC /* InpectPictureCell.h */,
84D863691C1148EC00E4F4CC /* InpectPictureCell.m */,
84D8636A1C1148EC00E4F4CC /* InspectAddCell.h */,
84D8636B1C1148EC00E4F4CC /* InspectAddCell.m */,
84D8636C1C1148EC00E4F4CC /* InspectPicAddCell.h */,
84D8636D1C1148EC00E4F4CC /* InspectPicAddCell.m */,
84D3E5F71C04BD8E001FF1DD /* InspectNotUpLoadCell.h */,
84D3E5F81C04BD8E001FF1DD /* InspectNotUpLoadCell.m */,
);
......@@ -1515,19 +1520,6 @@
path = View;
sourceTree = "<group>";
};
84DAB3E41C07600000F3E416 /* InspectionPoint */ = {
isa = PBXGroup;
children = (
84DAB3E81C07605F00F3E416 /* InspectNoUpLoadViewController.h */,
84DAB3E91C07605F00F3E416 /* InspectNoUpLoadViewController.m */,
84DAB3EB1C07645F00F3E416 /* InspectPointCell.h */,
84DAB3EC1C07645F00F3E416 /* InspectPointCell.m */,
84DAB3EE1C076C2E00F3E416 /* InpectPictureCell.h */,
84DAB3EF1C076C2E00F3E416 /* InpectPictureCell.m */,
);
path = InspectionPoint;
sourceTree = "<group>";
};
84DB9BC11BDCD49900822CC4 /* CustomDropMenu */ = {
isa = PBXGroup;
children = (
......@@ -1886,8 +1878,6 @@
840ABECC1BE1C29F006E49C5 /* RankDetailViewController.m in Sources */,
8497B62B1C043671007ECBE6 /* InspectTableView.m in Sources */,
84AD4F261BF4356A00BFB37C /* TaskModel.m in Sources */,
84DAB3ED1C07645F00F3E416 /* InspectPointCell.m in Sources */,
84DAB3F01C076C2E00F3E416 /* InpectPictureCell.m in Sources */,
841D24FB1BEB75CA0005CC9F /* QuestionDetailFooterView.m in Sources */,
84CF0FA21BE9EDA900C855CE /* TakePhotoView.m in Sources */,
846206BB1C06AFF50015C456 /* RankCommentCell.m in Sources */,
......@@ -1939,6 +1929,7 @@
84D3E5F01C04BC8C001FF1DD /* InspectUploadedViewController.m in Sources */,
8487D80C1BF218F900E63E90 /* MenuView.m in Sources */,
84CC34CE1C093C2F002F10E2 /* OnLineViewController.m in Sources */,
84D8636E1C1148EC00E4F4CC /* InpectPictureCell.m in Sources */,
8474C5921BE78A85007DCF19 /* QuestionViewController.m in Sources */,
84A673BF1C0C7AEB000F828E /* AnnounceModel.m in Sources */,
84CC34CD1C093C2F002F10E2 /* OnLineFooterView.m in Sources */,
......@@ -1969,7 +1960,6 @@
84AD4F461BF4A9E800BFB37C /* RankHeadView.m in Sources */,
84E420411BE849FC00689976 /* QuestionDescribeCell.m in Sources */,
84DB9BC71BDCD67200822CC4 /* UIView+Extension.m in Sources */,
84DAB3EA1C07605F00F3E416 /* InspectNoUpLoadViewController.m in Sources */,
8462C6EC1BF5F3BE00344DDD /* MenuButton.m in Sources */,
8442BA5C1BDB8FDB005E5657 /* MineTableHeaderView.m in Sources */,
84CC34E21C09583D002F10E2 /* LookOnLineTableViewCell.m in Sources */,
......@@ -1982,6 +1972,8 @@
84D554EE1C0EDFB8006C9AD0 /* SearchViewController.m in Sources */,
84A673C01C0C7AEB000F828E /* FuncItem.m in Sources */,
84F1669B1BE715E40061D350 /* ZanButton.m in Sources */,
84D863701C1148EC00E4F4CC /* InspectPicAddCell.m in Sources */,
84D8636F1C1148EC00E4F4CC /* InspectAddCell.m in Sources */,
84CC34DF1C0953C3002F10E2 /* HandOutViewController.m in Sources */,
8419EAD41BEDC98F002635ED /* HttpClient.m in Sources */,
84A673C11C0C7AEB000F828E /* AnnounceViewController.m in Sources */,
......
//
// InspectPointCell.h
// InpectPictureCell.h
// redstar
//
// Created by admin on 15/11/27.
......@@ -8,7 +8,10 @@
#import <UIKit/UIKit.h>
@interface InspectPointCell : UITableViewCell
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UILabel *detailLabel;
@interface InpectPictureCell : UITableViewCell
@property (nonatomic, strong) UIButton *photoButton1;
@property (nonatomic, strong) UIButton *photoButton2;
@end
//
//
// redstar
//
// Created by admin on 15/11/27.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "InpectPictureCell.h"
@implementation InpectPictureCell
#pragma mark - System Methods
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self setup];
}
return self;
}
#pragma mark - Private Methods
- (void)setup
{
self.contentView.backgroundColor = [UIColor colorWithRed:239 / 255.0 green:239 / 255.0 blue:239 / 255.0 alpha:239 / 255.0];
}
- (UIButton *)photoButton1
{
if (!_photoButton1) {
_photoButton1 = [[UIButton alloc] init];
_photoButton1.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_photoButton1];
NSLayoutConstraint *overDateTop = [NSLayoutConstraint
constraintWithItem:_photoButton1
attribute:NSLayoutAttributeTop
relatedBy:NSLayoutRelationEqual
toItem:self.contentView
attribute:NSLayoutAttributeTop
multiplier:1.0
constant:5];
[self.contentView addConstraint:overDateTop];
NSLayoutConstraint *overDateLeft = [NSLayoutConstraint
constraintWithItem:_photoButton1
attribute:NSLayoutAttributeLeft
relatedBy:NSLayoutRelationEqual
toItem:self.contentView
attribute:NSLayoutAttributeLeft
multiplier:1.0
constant:20];
[self.contentView addConstraint:overDateLeft];
NSLayoutConstraint *overDateRight = [NSLayoutConstraint
constraintWithItem:_photoButton1
attribute:NSLayoutAttributeRight
relatedBy:NSLayoutRelationEqual
toItem:self.contentView
attribute:NSLayoutAttributeRight
multiplier:1.0
constant:-(kScreenWidth / 2 + 10)];
[self.contentView addConstraint:overDateRight];
NSLayoutConstraint *overDateHeight = [NSLayoutConstraint
constraintWithItem:_photoButton1
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1.0
constant:90];
[self.contentView addConstraint:overDateHeight];
NSLayoutConstraint *overDateBottom = [NSLayoutConstraint
constraintWithItem:_photoButton1
attribute:NSLayoutAttributeBottom
relatedBy:NSLayoutRelationEqual
toItem:self.contentView
attribute:NSLayoutAttributeBottom
multiplier:1.0
constant:-5];
[self.contentView addConstraint:overDateBottom];
}
return _photoButton1;
}
- (UIButton *)photoButton2
{
if (!_photoButton2) {
_photoButton2 = [[UIButton alloc] init];
_photoButton2.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_photoButton2];
NSLayoutConstraint *overDateTop = [NSLayoutConstraint
constraintWithItem:_photoButton2
attribute:NSLayoutAttributeTop
relatedBy:NSLayoutRelationEqual
toItem:self.contentView
attribute:NSLayoutAttributeTop
multiplier:1.0
constant:5];
[self.contentView addConstraint:overDateTop];
NSLayoutConstraint *overDateLeft = [NSLayoutConstraint
constraintWithItem:_photoButton2
attribute:NSLayoutAttributeLeft
relatedBy:NSLayoutRelationEqual
toItem:self.contentView
attribute:NSLayoutAttributeLeft
multiplier:1.0
constant:kScreenWidth / 2 + 10];
[self.contentView addConstraint:overDateLeft];
NSLayoutConstraint *overDateRight = [NSLayoutConstraint
constraintWithItem:_photoButton2
attribute:NSLayoutAttributeRight
relatedBy:NSLayoutRelationEqual
toItem:self.contentView
attribute:NSLayoutAttributeRight
multiplier:1.0
constant:-20];
[self.contentView addConstraint:overDateRight];
NSLayoutConstraint *overDateHeight = [NSLayoutConstraint
constraintWithItem:_photoButton2
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1.0
constant:90];
[self.contentView addConstraint:overDateHeight];
}
return _photoButton2;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
//
// InpectPictureCell.h
// InspectAddCell.h
// redstar
//
// Created by admin on 15/11/27.
// Created by admin on 15/12/3.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface InpectPictureCell : UITableViewCell
@interface InspectAddCell : UITableViewCell
@property (nonatomic, strong) UIButton *photoButton;
@property (nonatomic, strong) NSLayoutConstraint *overDateLeft;
@property (nonatomic, strong) NSLayoutConstraint *overDateRight;
......
//
//
// InspectAddCell.m
// redstar
//
// Created by admin on 15/11/27.
// Created by admin on 15/12/3.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "InpectPictureCell.h"
#import "InspectAddCell.h"
@implementation InpectPictureCell
@implementation InspectAddCell
#pragma mark - System Methods
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
......@@ -23,6 +23,7 @@
#pragma mark - Private Methods
- (void)setup
{
self.contentView.backgroundColor = [UIColor colorWithRed:239 / 255.0 green:239 / 255.0 blue:239 / 255.0 alpha:239 / 255.0];
}
......@@ -30,8 +31,9 @@
{
if (!_photoButton) {
_photoButton = [[UIButton alloc] init];
_photoButton.backgroundColor = [UIColor whiteColor];
_photoButton.translatesAutoresizingMaskIntoConstraints = NO;
_photoButton.backgroundColor = [UIColor redColor];
[_photoButton setImage:[UIImage imageNamed:@"add-photos_btn"] forState:UIControlStateNormal];
[self.contentView addSubview:_photoButton];
NSLayoutConstraint *overDateTop = [NSLayoutConstraint
......@@ -87,6 +89,9 @@
return _photoButton;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
......
//
// InspectInterfaceCell.h
// redstar
//
// Created by admin on 15/11/25.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface InspectInterfaceCell : UITableViewCell
@end
//
// InspectInterfaceCell.m
// redstar
//
// Created by admin on 15/11/25.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "InspectInterfaceCell.h"
@implementation InspectInterfaceCell
- (void)awakeFromNib {
// Initialization code
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
......@@ -13,4 +13,5 @@
@property (nonatomic, strong) UILabel *titleDetailLabel;
@property (nonatomic, strong) UILabel *introLabel;
@property (nonatomic, strong) UILabel *introDetailLabel;
@property (nonatomic, strong) UILabel *pictureLabel;
@end
......@@ -8,6 +8,10 @@
#import "InspectNotUpLoadCell.h"
@interface InspectNotUpLoadCell ()
@property (nonatomic, strong) UIView *bgView;
@end
@implementation InspectNotUpLoadCell
#pragma mark - System Methods
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
......@@ -21,6 +25,7 @@
#pragma mark - Private Methods
- (void)setup {
self.bgView.backgroundColor = [UIColor colorWithRed:239 / 255.0 green:239 / 255.0 blue:239 / 255.0 alpha:239 / 255.0];
}
......@@ -105,9 +110,7 @@
if (!_introDetailLabel) {
_introDetailLabel = [[UILabel alloc] init];
_introDetailLabel.translatesAutoresizingMaskIntoConstraints = NO;
_introDetailLabel.font = [UIFont systemFontOfSize:15.0];
_introDetailLabel.numberOfLines = 0;
_introDetailLabel.textColor = [UIColor clearColor];
[self.contentView addSubview:_introDetailLabel];
NSLayoutConstraint *overDateTop = [NSLayoutConstraint constraintWithItem:_introDetailLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.introLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
......@@ -119,13 +122,65 @@
NSLayoutConstraint *overDateRight = [NSLayoutConstraint constraintWithItem:_introDetailLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:overDateRight];
NSLayoutConstraint *overDateBottom = [NSLayoutConstraint constraintWithItem:_introDetailLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-20];
[self.contentView addConstraint:overDateBottom];
}
return _introDetailLabel;
}
- (UIView *)bgView
{
if (!_bgView) {
_bgView = [[UIView alloc] init];
_bgView.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_bgView];
NSLayoutConstraint *overDateTop = [NSLayoutConstraint constraintWithItem:_bgView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.introDetailLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:overDateTop];
NSLayoutConstraint *overDateLeft = [NSLayoutConstraint constraintWithItem:_bgView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.contentView addConstraint:overDateLeft];
NSLayoutConstraint *overDateRight = [NSLayoutConstraint constraintWithItem:_bgView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.contentView addConstraint:overDateRight];
NSLayoutConstraint *overDateHeight = [NSLayoutConstraint constraintWithItem:_bgView attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:25];
[self.contentView addConstraint:overDateHeight];
NSLayoutConstraint *overDateBottom = [NSLayoutConstraint constraintWithItem:_bgView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.contentView addConstraint:overDateBottom];
}
return _bgView;
}
- (UILabel *)pictureLabel
{
if (!_pictureLabel) {
_pictureLabel = [[UILabel alloc] init];
_pictureLabel.translatesAutoresizingMaskIntoConstraints = NO;
_pictureLabel.font = [UIFont systemFontOfSize:15.0];
_pictureLabel.backgroundColor = [UIColor clearColor];
_pictureLabel.textColor = kLightGray;
[self.bgView addSubview:_pictureLabel];
NSLayoutConstraint *overDateTop = [NSLayoutConstraint constraintWithItem:_pictureLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.bgView attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.bgView addConstraint:overDateTop];
NSLayoutConstraint *overDateLeft = [NSLayoutConstraint constraintWithItem:_pictureLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.bgView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.bgView addConstraint:overDateLeft];
NSLayoutConstraint *overDateRight = [NSLayoutConstraint constraintWithItem:_pictureLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.bgView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.bgView addConstraint:overDateRight];
NSLayoutConstraint *overDateBottom = [NSLayoutConstraint constraintWithItem:_pictureLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.bgView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.bgView addConstraint:overDateBottom];
}
return _pictureLabel;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
......
//
// InspectPicAddCell.h
// 拍照
//
// Created by admin on 15/12/4.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface InspectPicAddCell : UITableViewCell
@property (nonatomic, strong) UIButton *photoButton1;
@property (nonatomic, strong) UIButton *photoButton2;
@end
//
// InspectPicAddCell.m
// 拍照
//
// Created by admin on 15/12/4.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "InspectPicAddCell.h"
@implementation InspectPicAddCell
#pragma mark - System Methods
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
[self setup];
}
return self;
}
#pragma mark - Private Methods
- (void)setup
{
self.contentView.backgroundColor = [UIColor colorWithRed:239 / 255.0 green:239 / 255.0 blue:239 / 255.0 alpha:239 / 255.0];
}
- (UIButton *)photoButton1
{
if (!_photoButton1) {
_photoButton1 = [[UIButton alloc] init];
_photoButton1.translatesAutoresizingMaskIntoConstraints = NO;
[self.contentView addSubview:_photoButton1];
NSLayoutConstraint *overDateTop = [NSLayoutConstraint
constraintWithItem:_photoButton1
attribute:NSLayoutAttributeTop
relatedBy:NSLayoutRelationEqual
toItem:self.contentView
attribute:NSLayoutAttributeTop
multiplier:1.0
constant:5];
[self.contentView addConstraint:overDateTop];
NSLayoutConstraint *overDateLeft = [NSLayoutConstraint
constraintWithItem:_photoButton1
attribute:NSLayoutAttributeLeft
relatedBy:NSLayoutRelationEqual
toItem:self.contentView
attribute:NSLayoutAttributeLeft
multiplier:1.0
constant:20];
[self.contentView addConstraint:overDateLeft];
NSLayoutConstraint *overDateRight = [NSLayoutConstraint
constraintWithItem:_photoButton1
attribute:NSLayoutAttributeRight
relatedBy:NSLayoutRelationEqual
toItem:self.contentView
attribute:NSLayoutAttributeRight
multiplier:1.0
constant:-(kScreenWidth / 2 + 10)];
[self.contentView addConstraint:overDateRight];
NSLayoutConstraint *overDateHeight = [NSLayoutConstraint
constraintWithItem:_photoButton1
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1.0
constant:90];
[self.contentView addConstraint:overDateHeight];
NSLayoutConstraint *overDateBottom = [NSLayoutConstraint
constraintWithItem:_photoButton1
attribute:NSLayoutAttributeBottom
relatedBy:NSLayoutRelationEqual
toItem:self.contentView
attribute:NSLayoutAttributeBottom
multiplier:1.0
constant:-5];
[self.contentView addConstraint:overDateBottom];
}
return _photoButton1;
}
- (UIButton *)photoButton2
{
if (!_photoButton2) {
_photoButton2 = [[UIButton alloc] init];
[_photoButton2 setImage:[UIImage imageNamed:@"add-photos_btn"] forState:UIControlStateNormal];
_photoButton2.translatesAutoresizingMaskIntoConstraints = NO;
_photoButton2.backgroundColor = [UIColor whiteColor];
[self.contentView addSubview:_photoButton2];
NSLayoutConstraint *overDateTop = [NSLayoutConstraint
constraintWithItem:_photoButton2
attribute:NSLayoutAttributeTop
relatedBy:NSLayoutRelationEqual
toItem:self.contentView
attribute:NSLayoutAttributeTop
multiplier:1.0
constant:5];
[self.contentView addConstraint:overDateTop];
NSLayoutConstraint *overDateLeft = [NSLayoutConstraint
constraintWithItem:_photoButton2
attribute:NSLayoutAttributeLeft
relatedBy:NSLayoutRelationEqual
toItem:self.contentView
attribute:NSLayoutAttributeLeft
multiplier:1.0
constant:kScreenWidth / 2 + 10];
[self.contentView addConstraint:overDateLeft];
NSLayoutConstraint *overDateRight = [NSLayoutConstraint
constraintWithItem:_photoButton2
attribute:NSLayoutAttributeRight
relatedBy:NSLayoutRelationEqual
toItem:self.contentView
attribute:NSLayoutAttributeRight
multiplier:1.0
constant:-20];
[self.contentView addConstraint:overDateRight];
NSLayoutConstraint *overDateHeight = [NSLayoutConstraint
constraintWithItem:_photoButton2
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1.0
constant:90];
[self.contentView addConstraint:overDateHeight];
}
return _photoButton2;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@end
......@@ -8,35 +8,7 @@
#import "InspectDetailFooterView.h"
#define kPictureX 20
#define kPictureY 0
#define kPictureWidth (kScreenWidth - kPictureX * 2)
#define kPictureHeight 40
#define kTakePhotoX 0
#define kTakePhotoY kPictureY + kPictureHeight
#define kTakePhotoWidth (kScreenWidth - kTakePhotoX * 2)
#define kTakePhotoHeight 130 // 待处理
#define kIntroX kPictureX
#define kIntroY kTakePhotoY + kTakePhotoHeight
#define kIntroWidth kPictureWidth
#define kIntroHeight kPictureHeight
#define kBackImageX kPictureX
#define kBackImageY kIntroY + kIntroHeight
#define kBackImageWidth kIntroWidth
#define kBackImageHeight 75
#define kReportX kPictureX
#define kReportY kBackImageY + kBackImageHeight + 20
#define kReportWidth kBackImageWidth
#define kReportHeight 50
#define kFootViewHeight kReportY + kReportHeight + 20
@interface InspectDetailFooterView () <UITextViewDelegate>
@property (nonatomic, strong) UILabel *pictureLabel;
@property (nonatomic, strong) UILabel *introLabel;
@property (nonatomic, strong) UIImageView *backImageView2;
......@@ -66,8 +38,6 @@
- (void)setup {
self.pictureLabel.text = @"现场照片";
self.takePhotoView.backgroundColor = kSectionBackGroundColor;
self.introLabel.text = @"处理说明";
UIImage *image = [UIImage imageNamed:@"textbox"];
UIImage *resizingName = [image resizableImageWithCapInsets:UIEdgeInsetsMake(2, 2, 22, 22) resizingMode:UIImageResizingModeStretch];
......@@ -77,30 +47,7 @@
[self.reportBtn setTitle:@"上报结果" forState:UIControlStateNormal];
self.width = kScreenWidth;
self.height = kFootViewHeight;
}
- (UILabel *)pictureLabel
{
if (!_pictureLabel) {
_pictureLabel = [[UILabel alloc] initWithFrame:CGRectMake(kPictureX, kPictureY, kPictureWidth, kPictureHeight)];
_pictureLabel.font = [UIFont systemFontOfSize:15.0];
_pictureLabel.textColor = kLightBlack;
[self addSubview:_pictureLabel];
}
return _pictureLabel;
}
- (TakePhotoView *)takePhotoView
{
if (!_takePhotoView) {
_takePhotoView = [[TakePhotoView alloc] initWithFrame:CGRectMake(kTakePhotoX, kTakePhotoY, kTakePhotoWidth, kTakePhotoHeight)];
[self addSubview:_takePhotoView];
}
return _takePhotoView;
}
- (UILabel *)introLabel
......@@ -112,7 +59,7 @@
_introLabel.textColor = kLightBlack;
[self addSubview:_introLabel];
NSLayoutConstraint *someoneTop = [NSLayoutConstraint constraintWithItem:_introLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.takePhotoView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
NSLayoutConstraint *someoneTop = [NSLayoutConstraint constraintWithItem:_introLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self addConstraint:someoneTop];
NSLayoutConstraint *someoneLeft = [NSLayoutConstraint constraintWithItem:_introLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
......@@ -131,7 +78,7 @@
- (UIImageView *)backImageView2
{
if (!_backImageView2) {
_backImageView2 = [[UIImageView alloc] initWithFrame:CGRectMake(kBackImageX, kBackImageY, kBackImageWidth, kBackImageHeight)];
_backImageView2 = [[UIImageView alloc] init];
_backImageView2.userInteractionEnabled = YES;
_backImageView2.translatesAutoresizingMaskIntoConstraints = NO;
[self addSubview:_backImageView2];
......
......@@ -16,15 +16,20 @@
#import "InspectTaskViewController.h"
#import "InspectAddCell.h"
#import "InspectPicAddCell.h"
#import "InpectPictureCell.h"
#define kInspectNotUploadCell @"InspectNotUploadCell"
@interface InspectNotUploadViewController () <UITableViewDelegate, UITableViewDataSource, UINavigationControllerDelegate, UIImagePickerControllerDelegate , TakePhotoViewDelegate, UIScrollViewDelegate, UIAlertViewDelegate, UITextViewDelegate>
@interface InspectNotUploadViewController () <UITableViewDelegate, UITableViewDataSource, UINavigationControllerDelegate, UIImagePickerControllerDelegate , UIScrollViewDelegate, UIAlertViewDelegate, UITextViewDelegate>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, strong) InspectDetailFooterView *footerView;
@property (nonatomic, strong) NSMutableArray *imageNameArray;
@property (nonatomic, strong) NSLayoutConstraint *tableBottom;
@property (nonatomic, strong) NSLayoutConstraint *tableTop;
@property (nonatomic, assign) int rowNumber;
@end
......@@ -34,9 +39,6 @@
{
[super viewDidLoad];
NSLog(@"11111self.tableView.frame = %@, self.contentSize = %@, self.contentOff = %@", NSStringFromCGRect(self.tableView.frame),NSStringFromCGSize(self.tableView.contentSize), NSStringFromCGPoint(self.tableView.contentOffset));
UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 30)];
[customLab setTextColor:[UIColor whiteColor]];
customLab.textAlignment = NSTextAlignmentCenter;
......@@ -54,17 +56,14 @@
[self.tableView registerClass:[InspectNotUpLoadCell class] forCellReuseIdentifier:kInspectNotUploadCell];
self.tableView.tableFooterView = self.footerView;
self.footerView.takePhotoView.delegate = self;
[self.footerView.reportBtn addTarget:self action:@selector(uploadTaskInfo:) forControlEvents:UIControlEventTouchUpInside];
self.imageNameArray = [NSMutableArray array];
_rowNumber = 2;
self.view.backgroundColor = [UIColor colorWithRed:239 / 255.0 green:239 / 255.0 blue:239 / 255.0 alpha:239 / 255.0];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - private Methods
......@@ -110,7 +109,6 @@
@"remark":self.footerView.contentTextView.text,
@"attachments":imageArray
};
NSLog(@"上传检查点parameters = %@", parameters);
[httpClient uploadInspectResultWithParameters:parameters completion:^(id response, NSError *error) {
NSLog(@"上传检查点 respose =%@ error = %@", response, error);
......@@ -131,49 +129,15 @@
[self.navigationController popViewControllerAnimated:YES];
}
#pragma mark - TakePhoto Delegate
- (void)deletePhoto:(UIButton *)button
{
NSLog(@"button -.tag === %ld", (long)button.superview.tag);
// 从存放所有Image的数组里移除当前点击的Image
[self.footerView.takePhotoView.allImages removeObject:[(UIButton *)button.superview imageForState:UIControlStateNormal]];
// 移除显示Image的Button
[button.superview removeFromSuperview];
CGFloat btnH = 110;
CGFloat marginY = 10;
int count = (int)self.footerView.takePhotoView.allImages.count + 1;
int k ;
if (count % 2 == 0) {
k = count / 2;
} else {
k = (count + 1) / 2;
}
self.footerView.takePhotoView.frame = CGRectMake(0, 40, kScreenWidth, k * btnH + (k + 1) * marginY);
self.footerView.height = self.footerView.takePhotoView.frame.size.height + 220;
NSString *imageName = _imageNameArray[button.superview.tag - 1];
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
NSFileManager* fileManager = [NSFileManager defaultManager];
BOOL blHave=[[NSFileManager defaultManager] fileExistsAtPath:fullPath];
if (!blHave) {
return ;
} else {
BOOL blDele= [fileManager removeItemAtPath:fullPath error:nil];
if (blDele) {
NSLog(@"dele success");
}else {
NSLog(@"dele fail");
}
- (void)createImagePicker:(UIButton *)sender
{
if (sender.tag == 2201) {
_rowNumber++;
}
}
- (void)createImagePicker
{
if (![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
UIAlertView* alert = [[UIAlertView alloc] initWithTitle:nil message:@"Unable to find the camera" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"找不到相机" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"确定", nil];
[alert show];
} else {
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
......@@ -185,26 +149,8 @@
}
}
- (void)takePhotoShowPicture:(UIButton *)btn
{
CheckPicViewController *checkVC = [[CheckPicViewController alloc] init];
checkVC.checkImage = btn.imageView.image;
[self.navigationController pushViewController:checkVC animated:YES];
}
#pragma mark - 保存图片至沙盒
- (void)saveImage:(UIImage *)currentImage {
NSData *imageData = UIImageJPEGRepresentation(currentImage, 0.5);
NSString *imageName = [CommonFunc md5Data:imageData];
[_imageNameArray addObject:imageName];
// 获取沙盒目录
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
// 将图片写入文件
[imageData writeToFile:fullPath atomically:NO];
}
#pragma mark - UIImagePickerController 代理方法
......@@ -212,42 +158,38 @@
{
UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
[self saveImage:image];
// 创建一个新的控件
UIButton *newButton = [self.footerView.takePhotoView createButtonWithImage:image];
[newButton addTarget:self action:@selector(takePhotoShowPicture:) forControlEvents:UIControlEventTouchUpInside];
[self.footerView.takePhotoView insertSubview:newButton atIndex:self.footerView.takePhotoView.subviews.count - 1];
[self.footerView.takePhotoView.allImages addObject:image];
int count = (int)self.footerView.takePhotoView.allImages.count + 1;
int k ;
if (count % 2 == 0) {
k = count / 2;
} else {
k = (count + 1) / 2;
}
CGFloat btnH = 110;
CGFloat marginY = 10;
self.footerView.takePhotoView.frame = CGRectMake(0, 40, kScreenWidth, k * btnH + (k + 1) * marginY);
self.footerView.height = self.footerView.takePhotoView.frame.size.height + 220;
// 退出图片选择控制器
[picker dismissViewControllerAnimated:YES completion:nil];
[picker dismissViewControllerAnimated:YES completion:^{
[self.tableView reloadData];
}];
}
#pragma mark - 保存图片至沙盒
- (void)saveImage:(UIImage *)currentImage {
NSData *imageData = UIImageJPEGRepresentation(currentImage, 0.5);
NSString *imageName = [NSString stringWithFormat:@"imageName%d", (int)_imageNameArray.count];
[_imageNameArray addObject:imageName];
// 获取沙盒目录
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
// 将图片写入文件
[imageData writeToFile:fullPath atomically:NO];
}
#pragma mark - TableView Delegate/DataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 1;
return _rowNumber;
}
// cell显示的内容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.row == 0) {
InspectNotUpLoadCell *cell=[tableView dequeueReusableCellWithIdentifier:kInspectNotUploadCell];
if (!cell) {
cell = [[InspectNotUpLoadCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kInspectNotUploadCell];
......@@ -256,6 +198,7 @@
cell.titleDetailLabel.text = [NSString stringWithFormat:@"要求图片%d张", _taskModel.attachmentNumber];
cell.introLabel.text = @"参考说明";
cell.introDetailLabel.text = [NSString stringWithFormat:@"%@", _taskModel.reference];
cell.pictureLabel.text = @"现场照片";
NSString *refrer = [NSString stringWithFormat:@"%@", _taskModel.reference];
if (refrer == nil || refrer == NULL || [refrer isEqual:[NSNull null]] || refrer == Nil || [refrer isEqualToString:@"(null)"]) {
......@@ -267,13 +210,60 @@
cell.introDetailLabel.attributedText = attrStr;
}
return cell;
}
} else if (indexPath.row == _rowNumber - 1) {
if ((_imageNameArray.count + 1) % 2 == 0) {
NSString *identifier = [NSString stringWithFormat:@"InspectaddPicCell"];
InspectPicAddCell *cell=[tableView dequeueReusableCellWithIdentifier:identifier];
if (!cell) {
cell = [[InspectPicAddCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
}
NSString *imageName = _imageNameArray[_imageNameArray.count - 1];
NSLog(@"imageName = %@", imageName);
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
UIImage *image = [UIImage imageWithContentsOfFile:fullPath];
NSLog(@"image = %@fullPath = %@", image, fullPath);
[cell.photoButton1 setImage:image forState:UIControlStateNormal];
cell.photoButton2.tag = 2201;
[cell.photoButton2 addTarget:self action:@selector(createImagePicker:) forControlEvents:UIControlEventTouchUpInside];
return cell;
} else {
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *identifier = [NSString stringWithFormat:@"InspectaddCell"];
InspectAddCell *cell=[tableView dequeueReusableCellWithIdentifier:identifier];
if (!cell) {
cell = [[InspectAddCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
}
cell.photoButton.tag = 2200;
[cell.photoButton addTarget:self action:@selector(createImagePicker:) forControlEvents:UIControlEventTouchUpInside];
return cell;
}
} else {
NSString *identifier = [NSString stringWithFormat:@"InspectPictureCell"];
InpectPictureCell *cell=[tableView dequeueReusableCellWithIdentifier:identifier];
if (!cell) {
cell = [[InpectPictureCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
}
NSString *imageName0 = _imageNameArray[(indexPath.row - 1) * 2];
NSLog(@"imageName = %@", imageName0);
NSString *fullPath0 = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName0];
UIImage *image0 = [UIImage imageWithContentsOfFile:fullPath0];
NSLog(@"image = %@fullPath = %@", image0, fullPath0);
[cell.photoButton1 setImage:image0 forState:UIControlStateNormal];
NSString *imageName1 = _imageNameArray[(indexPath.row - 1) * 2 + 1];
NSLog(@"imageName = %@", imageName1);
NSString *fullPath1 = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName1];
UIImage *image1 = [UIImage imageWithContentsOfFile:fullPath1];
NSLog(@"image = %@fullPath = %@", image1, fullPath1);
[cell.photoButton2 setImage:image1 forState:UIControlStateNormal];
return cell;
}
}
......@@ -310,6 +300,7 @@
_tableView.dataSource = self;
_tableView.rowHeight = UITableViewAutomaticDimension;
_tableView.estimatedRowHeight = 300.0;
_tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
[self.view addSubview:_tableView];
self.tableTop = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
......@@ -330,8 +321,10 @@
- (InspectDetailFooterView *)footerView
{
if (!_footerView) {
_footerView = [[InspectDetailFooterView alloc] init];
_footerView = [[InspectDetailFooterView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 180)];
_footerView.contentTextView.delegate = self;
_footerView.backgroundColor = [UIColor colorWithRed:239 / 255.0 green:239 / 255.0 blue:239 / 255.0 alpha:239 / 255.0];
}
return _footerView;
}
......
......@@ -22,7 +22,6 @@
#import "InspectNotUploadViewController.h"
#import "InspectUploadedViewController.h"
#import "InspectNoUpLoadViewController.h"
#define kTaskSortCell @"InspectTaskSortCell"
......
//
// InspectNoUpLoadViewController.h
// redstar
//
// Created by admin on 15/11/26.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "TaskModel.h"
@interface InspectNoUpLoadViewController : UIViewController
@property (nonatomic, assign) int questionCount;
@property (nonatomic, strong) TaskModel *taskModel;
@property(nonatomic, strong) NSString *store_uuid;
@property (nonatomic, strong) NSString *uuid; // 口碑巡检uuid
@property (nonatomic, strong) NSString *praiseUuid;
@property (nonatomic, strong) NSString *questionUuid;
@end
//
// InspectNoUpLoadViewController.m
// redstar
//
// Created by admin on 15/11/26.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "InspectNoUpLoadViewController.h"
#import "InspectPointCell.h"
#import "InpectPictureCell.h"
#define kImageW (kScreenWidth - kSpaceX * 3) / 2
#define kSpaceX 20
#define kInspectPointCell @"InspectPointCell"
@interface InspectNoUpLoadViewController () <UITableViewDelegate, UITableViewDataSource>
@property (nonatomic, strong) UITableView *tableView;
@property (nonatomic, assign) int rowNumber;
@property (nonatomic, assign) int random;
@property (nonatomic, assign) BOOL isFull;
@end
@implementation InspectNoUpLoadViewController
- (void)viewDidLoad
{
[super viewDidLoad];
UILabel *customLab = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 30)];
[customLab setTextColor:[UIColor whiteColor]];
customLab.textAlignment = NSTextAlignmentCenter;
[customLab setText:[NSString stringWithFormat:@"检查点--%@(%@/%d)", self.taskModel.category, self.taskModel.lineNo, self.questionCount]];
customLab.font = [UIFont boldSystemFontOfSize:19];
self.navigationItem.titleView = customLab;
UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
backBtn.frame = CGRectMake(0, 0, 30, 44);
[backBtn setImage:[UIImage imageNamed:@"back_btn"] forState:UIControlStateNormal];
[backBtn addTarget:self action:@selector(doBack:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithCustomView:backBtn];
self.navigationItem.leftBarButtonItem = backItem;
[self.tableView registerClass:[InspectPointCell class] forCellReuseIdentifier:kInspectPointCell];
_rowNumber = 3;
_isFull = NO;
_random = 0;
}
#pragma mark - private methods
// 返回上一页面
- (void)doBack:(UIBarButtonItem *)sender
{
[self.navigationController popViewControllerAnimated:YES];
}
- (void)reloadTableView:(UIButton *)sender
{
// sender.selected = !sender.selected;
// if (sender.selected) {
// UIButton *addBtn = [[UIButton alloc] init];
// addBtn.translatesAutoresizingMaskIntoConstraints = NO;
// addBtn.layer.borderWidth = 0.5;
// addBtn.backgroundColor = [UIColor greenColor];
// addBtn.layer.borderColor = kSeparateLineCGColor;
// // 添加长按手势,用作删除. 加号按钮不添加
// UILongPressGestureRecognizer *gester = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)];
// [addBtn addGestureRecognizer:gester];
// [cell.contentView addSubview:addBtn];
//
// NSLayoutConstraint *overDateTop = [NSLayoutConstraint
// constraintWithItem:addBtn
// attribute:NSLayoutAttributeTop
// relatedBy:NSLayoutRelationEqual
// toItem:cell.contentView
// attribute:NSLayoutAttributeTop
// multiplier:1.0
// constant:5];
// [cell.contentView addConstraint:overDateTop];
//
// NSLayoutConstraint *overDateLeft = [NSLayoutConstraint
// constraintWithItem:addBtn
// attribute:NSLayoutAttributeLeft
// relatedBy:NSLayoutRelationEqual
// toItem:cell.contentView
// attribute:NSLayoutAttributeLeft
// multiplier:1.0
// constant:20];
// [cell.contentView addConstraint:overDateLeft];
//
// NSLayoutConstraint *overDateRight = [NSLayoutConstraint
// constraintWithItem:addBtn
// attribute:NSLayoutAttributeRight
// relatedBy:NSLayoutRelationEqual
// toItem:cell.contentView
// attribute:NSLayoutAttributeCenterX
// multiplier:1.0
// constant:-10];
// [cell.contentView addConstraint:overDateRight];
//
// NSLayoutConstraint *overDateHeight = [NSLayoutConstraint
// constraintWithItem:addBtn
// attribute:NSLayoutAttributeHeight
// relatedBy:NSLayoutRelationEqual
// toItem:nil
// attribute:NSLayoutAttributeNotAnAttribute
// multiplier:1.0
// constant:90];
// [cell.contentView addConstraint:overDateHeight];
//
// NSLayoutConstraint *overDateBottom = [NSLayoutConstraint
// constraintWithItem:addBtn
// attribute:NSLayoutAttributeBottom
// relatedBy:NSLayoutRelationEqual
// toItem:cell.contentView
// attribute:NSLayoutAttributeBottom
// multiplier:1.0
// constant:-5];
// [cell.contentView addConstraint:overDateBottom];
//
// cell.overDateLeft.constant = kScreenWidth / 2 + 10;
// cell.overDateRight.constant = - 20;
// [UIView animateWithDuration:0.3 animations:^{
// [cell.contentView layoutIfNeeded];
// }];
// } else {
// UIButton *addBtn = [[UIButton alloc] init];
// addBtn.translatesAutoresizingMaskIntoConstraints = NO;
// addBtn.layer.borderWidth = 0.5;
// addBtn.backgroundColor = [UIColor greenColor];
// addBtn.layer.borderColor = kSeparateLineCGColor;
// // 添加长按手势,用作删除. 加号按钮不添加
// UILongPressGestureRecognizer *gester = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)];
// [addBtn addGestureRecognizer:gester];
// [cell.contentView addSubview:addBtn];
//
// NSLayoutConstraint *overDateTop = [NSLayoutConstraint
// constraintWithItem:addBtn
// attribute:NSLayoutAttributeTop
// relatedBy:NSLayoutRelationEqual
// toItem:cell.contentView
// attribute:NSLayoutAttributeTop
// multiplier:1.0
// constant:5];
// [cell.contentView addConstraint:overDateTop];
//
// NSLayoutConstraint *overDateLeft = [NSLayoutConstraint
// constraintWithItem:addBtn
// attribute:NSLayoutAttributeLeft
// relatedBy:NSLayoutRelationEqual
// toItem:cell.contentView
// attribute:NSLayoutAttributeLeft
// multiplier:1.0
// constant:kScreenWidth / 2 + 10];
// [cell.contentView addConstraint:overDateLeft];
//
// NSLayoutConstraint *overDateRight = [NSLayoutConstraint
// constraintWithItem:addBtn
// attribute:NSLayoutAttributeRight
// relatedBy:NSLayoutRelationEqual
// toItem:cell.contentView
// attribute:NSLayoutAttributeRight
// multiplier:1.0
// constant:- 20];
// [cell.contentView addConstraint:overDateRight];
//
// NSLayoutConstraint *overDateHeight = [NSLayoutConstraint
// constraintWithItem:addBtn
// attribute:NSLayoutAttributeHeight
// relatedBy:NSLayoutRelationEqual
// toItem:nil
// attribute:NSLayoutAttributeNotAnAttribute
// multiplier:1.0
// constant:90];
// [cell.contentView addConstraint:overDateHeight];
//
// NSLayoutConstraint *overDateBottom = [NSLayoutConstraint
// constraintWithItem:addBtn
// attribute:NSLayoutAttributeBottom
// relatedBy:NSLayoutRelationEqual
// toItem:cell.contentView
// attribute:NSLayoutAttributeBottom
// multiplier:1.0
// constant:-5];
// [cell.contentView addConstraint:overDateBottom];
//
// [cell.photoButton removeFromSuperview];
// cell.photoButton = nil;
// _rowNumber += 1;
// [self.tableView reloadData];
//
// }
InpectPictureCell *cell = (InpectPictureCell *)[[sender superview] superview];
if (_isFull) {
UIButton *addBtn = [[UIButton alloc] init];
addBtn.translatesAutoresizingMaskIntoConstraints = NO;
addBtn.layer.borderWidth = 0.5;
addBtn.backgroundColor = [UIColor greenColor];
addBtn.layer.borderColor = kSeparateLineCGColor;
// 添加长按手势,用作删除. 加号按钮不添加
UILongPressGestureRecognizer *gester = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)];
[addBtn addGestureRecognizer:gester];
[cell.contentView addSubview:addBtn];
NSLayoutConstraint *overDateTop = [NSLayoutConstraint
constraintWithItem:addBtn
attribute:NSLayoutAttributeTop
relatedBy:NSLayoutRelationEqual
toItem:cell.contentView
attribute:NSLayoutAttributeTop
multiplier:1.0
constant:5];
[cell.contentView addConstraint:overDateTop];
NSLayoutConstraint *overDateLeft = [NSLayoutConstraint
constraintWithItem:addBtn
attribute:NSLayoutAttributeLeft
relatedBy:NSLayoutRelationEqual
toItem:cell.contentView
attribute:NSLayoutAttributeLeft
multiplier:1.0
constant:kScreenWidth / 2 + 10];
[cell.contentView addConstraint:overDateLeft];
NSLayoutConstraint *overDateRight = [NSLayoutConstraint
constraintWithItem:addBtn
attribute:NSLayoutAttributeRight
relatedBy:NSLayoutRelationEqual
toItem:cell.contentView
attribute:NSLayoutAttributeRight
multiplier:1.0
constant:- 20];
[cell.contentView addConstraint:overDateRight];
NSLayoutConstraint *overDateHeight = [NSLayoutConstraint
constraintWithItem:addBtn
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1.0
constant:90];
[cell.contentView addConstraint:overDateHeight];
NSLayoutConstraint *overDateBottom = [NSLayoutConstraint
constraintWithItem:addBtn
attribute:NSLayoutAttributeBottom
relatedBy:NSLayoutRelationEqual
toItem:cell.contentView
attribute:NSLayoutAttributeBottom
multiplier:1.0
constant:-5];
[cell.contentView addConstraint:overDateBottom];
cell.photoButton.hidden = YES;
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:_rowNumber inSection:0];
_rowNumber += 1;
NSArray *indexArray = @[indexPath];
[self.tableView beginUpdates];
[self.tableView insertRowsAtIndexPaths:indexArray withRowAnimation:UITableViewRowAnimationFade];
[self.tableView endUpdates];
} else {
UIButton *addBtn = [[UIButton alloc] init];
addBtn.translatesAutoresizingMaskIntoConstraints = NO;
addBtn.layer.borderWidth = 0.5;
addBtn.backgroundColor = [UIColor greenColor];
addBtn.layer.borderColor = kSeparateLineCGColor;
// 添加长按手势,用作删除. 加号按钮不添加
UILongPressGestureRecognizer *gester = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)];
[addBtn addGestureRecognizer:gester];
[cell.contentView addSubview:addBtn];
NSLayoutConstraint *overDateTop = [NSLayoutConstraint
constraintWithItem:addBtn
attribute:NSLayoutAttributeTop
relatedBy:NSLayoutRelationEqual
toItem:cell.contentView
attribute:NSLayoutAttributeTop
multiplier:1.0
constant:5];
[cell.contentView addConstraint:overDateTop];
NSLayoutConstraint *overDateLeft = [NSLayoutConstraint
constraintWithItem:addBtn
attribute:NSLayoutAttributeLeft
relatedBy:NSLayoutRelationEqual
toItem:cell.contentView
attribute:NSLayoutAttributeLeft
multiplier:1.0
constant:20];
[cell.contentView addConstraint:overDateLeft];
NSLayoutConstraint *overDateRight = [NSLayoutConstraint
constraintWithItem:addBtn
attribute:NSLayoutAttributeRight
relatedBy:NSLayoutRelationEqual
toItem:cell.contentView
attribute:NSLayoutAttributeCenterX
multiplier:1.0
constant:-10];
[cell.contentView addConstraint:overDateRight];
NSLayoutConstraint *overDateHeight = [NSLayoutConstraint
constraintWithItem:addBtn
attribute:NSLayoutAttributeHeight
relatedBy:NSLayoutRelationEqual
toItem:nil
attribute:NSLayoutAttributeNotAnAttribute
multiplier:1.0
constant:90];
[cell.contentView addConstraint:overDateHeight];
NSLayoutConstraint *overDateBottom = [NSLayoutConstraint
constraintWithItem:addBtn
attribute:NSLayoutAttributeBottom
relatedBy:NSLayoutRelationEqual
toItem:cell.contentView
attribute:NSLayoutAttributeBottom
multiplier:1.0
constant:-5];
[cell.contentView addConstraint:overDateBottom];
cell.overDateLeft.constant = kScreenWidth / 2 + 10;
cell.overDateRight.constant = - 20;
[UIView animateWithDuration:0.3 animations:^{
[cell.contentView layoutIfNeeded];
}];
}
_isFull = !_isFull;
}
- (void)longPress:(UIGestureRecognizer *)gestureRecognizer
{
if (gestureRecognizer.state == UIGestureRecognizerStateBegan) {
// 获取到点击的显示图片的按钮
UIButton *showButton = (UIButton *)gestureRecognizer.view;
// 创建长按删除的按钮
UIButton *deleteButton = [UIButton buttonWithType:UIButtonTypeCustom];
deleteButton.backgroundColor = [UIColor redColor];
// deleteButton.bounds = CGRectMake(0, 0, deleImageWH, deleImageWH);
// [deleteButton setImage:[UIImage imageNamed:kAdeleImage] forState:UIControlStateNormal];
[deleteButton addTarget:self action:@selector(deletePicture:) forControlEvents:UIControlEventTouchUpInside];
deleteButton.frame = CGRectMake(showButton.frame.size.width - deleteButton.frame.size.width, 0, deleteButton.frame.size.width, deleteButton.frame.size.height);
[showButton addSubview:deleteButton];
}
}
- (void)deletePicture:(UIButton *)button
{
// 从存放所有Image的数组里移除当前点击的Image
// [self.footerView.takePhotoView.allImages removeObject:[(UIButton *)button.superview imageForState:UIControlStateNormal]];
// 移除显示Image的Button
[button.superview removeFromSuperview];
NSString *imageName = @"";
//_imageNameArray[button.superview.tag - 1];
NSString *fullPath = [[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"] stringByAppendingPathComponent:imageName];
NSFileManager* fileManager = [NSFileManager defaultManager];
BOOL blHave=[[NSFileManager defaultManager] fileExistsAtPath:fullPath];
if (!blHave) {
return ;
} else {
BOOL blDele= [fileManager removeItemAtPath:fullPath error:nil];
if (blDele) {
NSLog(@"dele success");
}else {
NSLog(@"dele fail");
}
}
}
#pragma mark - TableView Delegate/DataSource
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return _rowNumber;
}
// cell显示的内容
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.row < 2) {
InspectPointCell *cell=[tableView dequeueReusableCellWithIdentifier:kInspectPointCell];
if (!cell) {
cell = [[InspectPointCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:kInspectPointCell];
}
if (indexPath.row == 0) {
cell.titleLabel.text = [NSString stringWithFormat:@"%@", _taskModel.title];
cell.detailLabel.text = [NSString stringWithFormat:@"要求图片%d张", _taskModel.attachmentNumber];
} else {
cell.titleLabel.text = @"参考说明";
cell.detailLabel.text = [NSString stringWithFormat:@"%@", _taskModel.reference];
}
cell.selectionStyle = UITableViewCellSelectionStyleNone;
return cell;
} else {
NSString *identifier = [NSString stringWithFormat:@"InspectPictureCell%d", _random++];
InpectPictureCell *cell=[tableView dequeueReusableCellWithIdentifier:identifier];
if (!cell) {
cell = [[InpectPictureCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
}
[cell.photoButton addTarget:self action:@selector(reloadTableView:) forControlEvents:UIControlEventTouchUpInside];
return cell;
}
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
}
// section高度
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 0;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
return CGFLOAT_MIN;
}
#pragma mark - lazy loading
- (UITableView *)tableView
{
if (!_tableView) {
_tableView = [[UITableView alloc] initWithFrame:CGRectZero];
_tableView.translatesAutoresizingMaskIntoConstraints = NO;
_tableView.delegate = self;
_tableView.dataSource = self;
_tableView.rowHeight = UITableViewAutomaticDimension;
_tableView.estimatedRowHeight = 300.0;
[self.view addSubview:_tableView];
NSLayoutConstraint *tableTop = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeTop multiplier:1.0 constant:0];
[self.view addConstraint:tableTop];
NSLayoutConstraint *tableLeft = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeLeft multiplier:1.0 constant:0];
[self.view addConstraint:tableLeft];
NSLayoutConstraint *tableRight = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeRight multiplier:1.0 constant:0];
[self.view addConstraint:tableRight];
NSLayoutConstraint *tableBottom = [NSLayoutConstraint constraintWithItem:_tableView attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.view attribute:NSLayoutAttributeBottom multiplier:1.0 constant:0];
[self.view addConstraint:tableBottom];
}
return _tableView;
}
/*
#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
//
// InspectPointCell.m
// redstar
//
// Created by admin on 15/11/27.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "InspectPointCell.h"
@implementation InspectPointCell
#pragma - lazy loading
- (UILabel *)titleLabel
{
if (!_titleLabel) {
_titleLabel = [[UILabel alloc] init];
_titleLabel.translatesAutoresizingMaskIntoConstraints = NO;
_titleLabel.font = [UIFont systemFontOfSize:15.0];
_titleLabel.textColor = kLightGray;
[self.contentView addSubview:_titleLabel];
NSLayoutConstraint *overDateTop = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeTop multiplier:1.0 constant:5];
[self.contentView addConstraint:overDateTop];
NSLayoutConstraint *overDateLeft = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:overDateLeft];
NSLayoutConstraint *overDateRight = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:overDateRight];
NSLayoutConstraint *overDateWidth = [NSLayoutConstraint constraintWithItem:_titleLabel attribute:NSLayoutAttributeHeight relatedBy:NSLayoutRelationEqual toItem:nil attribute:NSLayoutAttributeNotAnAttribute multiplier:1.0 constant:23];
[self.contentView addConstraint:overDateWidth];
}
return _titleLabel;
}
- (UILabel *)detailLabel
{
if (!_detailLabel) {
_detailLabel = [[UILabel alloc] init];
_detailLabel.translatesAutoresizingMaskIntoConstraints = NO;
_detailLabel.font = [UIFont systemFontOfSize:15.0];
_detailLabel.textColor = kLightBlack;
_detailLabel.numberOfLines = 0;
[self.contentView addSubview:_detailLabel];
NSLayoutConstraint *overDateTop = [NSLayoutConstraint constraintWithItem:_detailLabel attribute:NSLayoutAttributeTop relatedBy:NSLayoutRelationEqual toItem:self.titleLabel attribute:NSLayoutAttributeBottom multiplier:1.0 constant:2];
[self.contentView addConstraint:overDateTop];
NSLayoutConstraint *overDateLeft = [NSLayoutConstraint constraintWithItem:_detailLabel attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeLeft multiplier:1.0 constant:20];
[self.contentView addConstraint:overDateLeft];
NSLayoutConstraint *overDateRight = [NSLayoutConstraint constraintWithItem:_detailLabel attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeRight multiplier:1.0 constant:-20];
[self.contentView addConstraint:overDateRight];
NSLayoutConstraint *overDateBottom = [NSLayoutConstraint constraintWithItem:_detailLabel attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.contentView attribute:NSLayoutAttributeBottom multiplier:1.0 constant:-8];
[self.contentView addConstraint:overDateBottom];
}
return _detailLabel;
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
[super setSelected:selected animated:animated];
// Configure the view for the selected state
}
@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