Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
红
红星美凯龙管理在线APP IOS
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张杰
红星美凯龙管理在线APP IOS
Commits
30be1a46
Commit
30be1a46
authored
Dec 04, 2015
by
admin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复bug
parent
898d2d88
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
529 additions
and
420 deletions
+529
-420
project.pbxproj
redstar.xcodeproj/project.pbxproj
+6
-0
UserInterfaceState.xcuserstate
...userdata/admin.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
Breakpoints_v2.xcbkptlist
...ta/admin.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
+32
-0
AddQuestionTableCell.h
...Function/Question/AddQuestion/Cell/AddQuestionTableCell.h
+19
-0
AddQuestionTableCell.m
...Function/Question/AddQuestion/Cell/AddQuestionTableCell.m
+285
-0
AddQuestionFooterView.h
...unction/Question/AddQuestion/View/AddQuestionFooterView.h
+0
-9
AddQuestionFooterView.m
...unction/Question/AddQuestion/View/AddQuestionFooterView.m
+2
-223
AddQuestionViewController.m
...on/AddQuestion/ViewController/AddQuestionViewController.m
+182
-187
HomeViewController.m
...r/Classes/Module/Home/ViewController/HomeViewController.m
+3
-1
No files found.
redstar.xcodeproj/project.pbxproj
View file @
30be1a46
...
@@ -100,6 +100,7 @@
...
@@ -100,6 +100,7 @@
84D8636E1C1148EC00E4F4CC
/* InpectPictureCell.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84D863691C1148EC00E4F4CC
/* InpectPictureCell.m */
;
};
84D8636E1C1148EC00E4F4CC
/* InpectPictureCell.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84D863691C1148EC00E4F4CC
/* InpectPictureCell.m */
;
};
84D8636F1C1148EC00E4F4CC
/* InspectAddCell.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84D8636B1C1148EC00E4F4CC
/* InspectAddCell.m */
;
};
84D8636F1C1148EC00E4F4CC
/* InspectAddCell.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84D8636B1C1148EC00E4F4CC
/* InspectAddCell.m */
;
};
84D863701C1148EC00E4F4CC
/* InspectPicAddCell.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84D8636D1C1148EC00E4F4CC
/* InspectPicAddCell.m */
;
};
84D863701C1148EC00E4F4CC
/* InspectPicAddCell.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84D8636D1C1148EC00E4F4CC
/* InspectPicAddCell.m */
;
};
84D863731C11923F00E4F4CC
/* AddQuestionTableCell.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84D863721C11923F00E4F4CC
/* AddQuestionTableCell.m */
;
};
84DB9BC41BDCD4B600822CC4
/* CustomDropMenuView.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84DB9BC31BDCD4B600822CC4
/* CustomDropMenuView.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 */
;
};
84DB9BC71BDCD67200822CC4
/* UIView+Extension.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84DB9BC61BDCD67200822CC4
/* UIView+Extension.m */
;
};
84E0ABCD1BFB082E001C8F45
/* TaskDetailModel.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84E0ABCC1BFB082E001C8F45
/* TaskDetailModel.m */
;
};
84E0ABCD1BFB082E001C8F45
/* TaskDetailModel.m in Sources */
=
{
isa
=
PBXBuildFile
;
fileRef
=
84E0ABCC1BFB082E001C8F45
/* TaskDetailModel.m */
;
};
...
@@ -328,6 +329,8 @@
...
@@ -328,6 +329,8 @@
84D8636B1C1148EC00E4F4CC
/* InspectAddCell.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
InspectAddCell.m
;
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>"
;
};
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>"
;
};
84D8636D1C1148EC00E4F4CC
/* InspectPicAddCell.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
InspectPicAddCell.m
;
sourceTree
=
"<group>"
;
};
84D863711C11923F00E4F4CC
/* AddQuestionTableCell.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
AddQuestionTableCell.h
;
sourceTree
=
"<group>"
;
};
84D863721C11923F00E4F4CC
/* AddQuestionTableCell.m */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.objc
;
path
=
AddQuestionTableCell.m
;
sourceTree
=
"<group>"
;
};
84DB9BC21BDCD4B600822CC4
/* CustomDropMenuView.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
CustomDropMenuView.h
;
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>"
;
};
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>"
;
};
84DB9BC51BDCD67200822CC4
/* UIView+Extension.h */
=
{
isa
=
PBXFileReference
;
fileEncoding
=
4
;
lastKnownFileType
=
sourcecode.c.h
;
path
=
"UIView+Extension.h"
;
sourceTree
=
"<group>"
;
};
...
@@ -1601,6 +1604,8 @@
...
@@ -1601,6 +1604,8 @@
84F57C481BEC784A00DDEEB1
/* Cell */
=
{
84F57C481BEC784A00DDEEB1
/* Cell */
=
{
isa
=
PBXGroup
;
isa
=
PBXGroup
;
children
=
(
children
=
(
84D863711C11923F00E4F4CC
/* AddQuestionTableCell.h */
,
84D863721C11923F00E4F4CC
/* AddQuestionTableCell.m */
,
);
);
path
=
Cell
;
path
=
Cell
;
sourceTree
=
"<group>"
;
sourceTree
=
"<group>"
;
...
@@ -1906,6 +1911,7 @@
...
@@ -1906,6 +1911,7 @@
84A6738B1C0B54A6000F828E
/* OnLineCompleteHeadView.m in Sources */
,
84A6738B1C0B54A6000F828E
/* OnLineCompleteHeadView.m in Sources */
,
8474A01C1BE368D700315F30
/* HomeCellItem.m in Sources */
,
8474A01C1BE368D700315F30
/* HomeCellItem.m in Sources */
,
84CC34D11C093C5E002F10E2
/* LookOnLineViewController.m in Sources */
,
84CC34D11C093C5E002F10E2
/* LookOnLineViewController.m in Sources */
,
84D863731C11923F00E4F4CC
/* AddQuestionTableCell.m in Sources */
,
84D8257F1BDD2F7E00CC61F7
/* MineTableFooterView.m in Sources */
,
84D8257F1BDD2F7E00CC61F7
/* MineTableFooterView.m in Sources */
,
84F57C501BEC7AA300DDEEB1
/* AddQuestionFooterView.m in Sources */
,
84F57C501BEC7AA300DDEEB1
/* AddQuestionFooterView.m in Sources */
,
84CF0F1E1BE9B40400C855CE
/* InspectDetailFooterView.m in Sources */
,
84CF0F1E1BE9B40400C855CE
/* InspectDetailFooterView.m in Sources */
,
...
...
redstar.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate
View file @
30be1a46
No preview for this file type
redstar.xcworkspace/xcuserdata/admin.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist
View file @
30be1a46
...
@@ -13,5 +13,37 @@
...
@@ -13,5 +13,37 @@
stopOnStyle =
"0"
>
stopOnStyle =
"0"
>
</BreakpointContent>
</BreakpointContent>
</BreakpointProxy>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID =
"Xcode.Breakpoint.FileBreakpoint"
>
<BreakpointContent
shouldBeEnabled =
"No"
ignoreCount =
"0"
continueAfterRunningActions =
"No"
filePath =
"redstar/Classes/Module/Function/Question/AddQuestion/Cell/AddQuestionTableCell.m"
timestampString =
"470919794.364077"
startingColumnNumber =
"9223372036854775807"
endingColumnNumber =
"9223372036854775807"
startingLineNumber =
"114"
endingLineNumber =
"114"
landmarkName =
"-contentTextView"
landmarkType =
"5"
>
</BreakpointContent>
</BreakpointProxy>
<BreakpointProxy
BreakpointExtensionID =
"Xcode.Breakpoint.FileBreakpoint"
>
<BreakpointContent
shouldBeEnabled =
"No"
ignoreCount =
"0"
continueAfterRunningActions =
"No"
filePath =
"redstar/Classes/Module/Function/Question/AddQuestion/Cell/AddQuestionTableCell.m"
timestampString =
"470919794.364077"
startingColumnNumber =
"9223372036854775807"
endingColumnNumber =
"9223372036854775807"
startingLineNumber =
"190"
endingLineNumber =
"190"
landmarkName =
"-titleTextView"
landmarkType =
"5"
>
</BreakpointContent>
</BreakpointProxy>
</Breakpoints>
</Breakpoints>
</Bucket>
</Bucket>
redstar/Classes/Module/Function/Question/AddQuestion/Cell/AddQuestionTableCell.h
0 → 100644
View file @
30be1a46
//
// AddQuestionTableCell.h
// redstar
//
// Created by admin on 15/12/4.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface
AddQuestionTableCell
:
UITableViewCell
@property
(
nonatomic
,
strong
)
UITextView
*
titleTextView
;
@property
(
nonatomic
,
strong
)
UITextView
*
contentTextView
;
@property
(
nonatomic
,
strong
)
UILabel
*
placeholderLabel1
;
@property
(
nonatomic
,
strong
)
UILabel
*
placeholderLabel2
;
@end
redstar/Classes/Module/Function/Question/AddQuestion/Cell/AddQuestionTableCell.m
0 → 100644
View file @
30be1a46
//
// AddQuestionTableCell.m
// redstar
//
// Created by admin on 15/12/4.
// Copyright © 2015年 ZWF. All rights reserved.
//
#import "AddQuestionTableCell.h"
@interface
AddQuestionTableCell
()
<
UITextViewDelegate
>
{
UITextView
*
_titleTextView
;
UITextView
*
_contentTextView
;
}
@property
(
nonatomic
,
strong
)
UIImageView
*
backImageView1
;
@property
(
nonatomic
,
strong
)
UIImageView
*
backImageView2
;
@end
@implementation
AddQuestionTableCell
-
(
instancetype
)
initWithStyle
:(
UITableViewCellStyle
)
style
reuseIdentifier
:(
NSString
*
)
reuseIdentifier
{
self
=
[
super
initWithStyle
:
style
reuseIdentifier
:
reuseIdentifier
];
if
(
self
)
{
[
self
setup
];
}
return
self
;
}
-
(
void
)
setup
{
self
.
contentView
.
backgroundColor
=
kFootViewBackGroundColor
;
UILabel
*
contentLabel
=
[[
UILabel
alloc
]
init
];
contentLabel
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
contentLabel
.
font
=
[
UIFont
systemFontOfSize
:
16
.
0
];
contentLabel
.
text
=
@"标题"
;
contentLabel
.
textColor
=
kOnLineCellTitleColor
;
[
self
.
contentView
addSubview
:
contentLabel
];
NSLayoutConstraint
*
contentLabelTop
=
[
NSLayoutConstraint
constraintWithItem
:
contentLabel
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
0
];
[
self
.
contentView
addConstraint
:
contentLabelTop
];
NSLayoutConstraint
*
contentLabelLeft
=
[
NSLayoutConstraint
constraintWithItem
:
contentLabel
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
20
];
[
self
.
contentView
addConstraint
:
contentLabelLeft
];
NSLayoutConstraint
*
contentLabelRight
=
[
NSLayoutConstraint
constraintWithItem
:
contentLabel
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:
0
];
[
self
.
contentView
addConstraint
:
contentLabelRight
];
NSLayoutConstraint
*
contentLabelHeight
=
[
NSLayoutConstraint
constraintWithItem
:
contentLabel
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
50
];
[
self
.
contentView
addConstraint
:
contentLabelHeight
];
UILabel
*
titleLabel
=
[[
UILabel
alloc
]
init
];
titleLabel
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
titleLabel
.
font
=
[
UIFont
systemFontOfSize
:
16
.
0
];
titleLabel
.
text
=
@"问题与建议描述"
;
titleLabel
.
textColor
=
kOnLineCellTitleColor
;
[
self
.
contentView
addSubview
:
titleLabel
];
NSLayoutConstraint
*
titleTop
=
[
NSLayoutConstraint
constraintWithItem
:
titleLabel
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
110
];
[
self
.
contentView
addConstraint
:
titleTop
];
NSLayoutConstraint
*
titleLeft
=
[
NSLayoutConstraint
constraintWithItem
:
titleLabel
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
20
];
[
self
.
contentView
addConstraint
:
titleLeft
];
NSLayoutConstraint
*
titleRight
=
[
NSLayoutConstraint
constraintWithItem
:
titleLabel
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:
0
];
[
self
.
contentView
addConstraint
:
titleRight
];
NSLayoutConstraint
*
titleHeight
=
[
NSLayoutConstraint
constraintWithItem
:
titleLabel
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
50
];
[
self
.
contentView
addConstraint
:
titleHeight
];
UIImage
*
image
=
[
UIImage
imageNamed
:
@"textbox"
];
UIImage
*
resizingName
=
[
image
resizableImageWithCapInsets
:
UIEdgeInsetsMake
(
1
,
1
,
24
,
24
)
resizingMode
:
UIImageResizingModeStretch
];
self
.
backImageView2
.
image
=
resizingName
;
self
.
backImageView1
.
image
=
resizingName
;
self
.
contentTextView
.
backgroundColor
=
[
UIColor
clearColor
];
self
.
placeholderLabel2
.
text
=
@"请输入文字..."
;
self
.
titleTextView
.
backgroundColor
=
[
UIColor
clearColor
];
self
.
placeholderLabel1
.
text
=
@"请输入文字..."
;
}
#pragma mark - lazy loading
-
(
UIImageView
*
)
backImageView2
{
if
(
!
_backImageView2
)
{
_backImageView2
=
[[
UIImageView
alloc
]
init
];
_backImageView2
.
userInteractionEnabled
=
YES
;
_backImageView2
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
[
self
.
contentView
addSubview
:
_backImageView2
];
NSLayoutConstraint
*
contentTop
=
[
NSLayoutConstraint
constraintWithItem
:
_backImageView2
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
50
];
[
self
.
contentView
addConstraint
:
contentTop
];
NSLayoutConstraint
*
contentLeft
=
[
NSLayoutConstraint
constraintWithItem
:
_backImageView2
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
20
];
[
self
.
contentView
addConstraint
:
contentLeft
];
NSLayoutConstraint
*
contentRight
=
[
NSLayoutConstraint
constraintWithItem
:
_backImageView2
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:-
20
];
[
self
.
contentView
addConstraint
:
contentRight
];
NSLayoutConstraint
*
contentHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_backImageView2
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
60
];
[
self
.
contentView
addConstraint
:
contentHeight
];
}
return
_backImageView2
;
}
-
(
UITextView
*
)
contentTextView
{
if
(
!
_contentTextView
)
{
_contentTextView
=
[[
UITextView
alloc
]
init
];
_contentTextView
.
tag
=
1002
;
_contentTextView
.
delegate
=
self
;
_contentTextView
.
font
=
[
UIFont
systemFontOfSize
:
15
.
0
];
_contentTextView
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
[
self
.
backImageView2
addSubview
:
_contentTextView
];
NSLayoutConstraint
*
contentTop
=
[
NSLayoutConstraint
constraintWithItem
:
_contentTextView
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
backImageView2
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
1
];
[
self
.
backImageView2
addConstraint
:
contentTop
];
NSLayoutConstraint
*
contentLeft
=
[
NSLayoutConstraint
constraintWithItem
:
_contentTextView
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
backImageView2
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
1
];
[
self
.
backImageView2
addConstraint
:
contentLeft
];
NSLayoutConstraint
*
contentRight
=
[
NSLayoutConstraint
constraintWithItem
:
_contentTextView
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
backImageView2
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:-
1
];
[
self
.
backImageView2
addConstraint
:
contentRight
];
NSLayoutConstraint
*
contentHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_contentTextView
attribute
:
NSLayoutAttributeBottom
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
backImageView2
attribute
:
NSLayoutAttributeBottom
multiplier
:
1
.
0
constant
:-
1
];
[
self
.
backImageView2
addConstraint
:
contentHeight
];
}
return
_contentTextView
;
}
-
(
UIImageView
*
)
backImageView1
{
if
(
!
_backImageView1
)
{
_backImageView1
=
[[
UIImageView
alloc
]
init
];
_backImageView1
.
userInteractionEnabled
=
YES
;
_backImageView1
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
[
self
.
contentView
addSubview
:
_backImageView1
];
NSLayoutConstraint
*
contentTop
=
[
NSLayoutConstraint
constraintWithItem
:
_backImageView1
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
160
];
[
self
.
contentView
addConstraint
:
contentTop
];
NSLayoutConstraint
*
contentLeft
=
[
NSLayoutConstraint
constraintWithItem
:
_backImageView1
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
20
];
[
self
.
contentView
addConstraint
:
contentLeft
];
NSLayoutConstraint
*
contentRight
=
[
NSLayoutConstraint
constraintWithItem
:
_backImageView1
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:-
20
];
[
self
.
contentView
addConstraint
:
contentRight
];
NSLayoutConstraint
*
contentHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_backImageView1
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
120
];
[
self
.
contentView
addConstraint
:
contentHeight
];
NSLayoutConstraint
*
contentBottom
=
[
NSLayoutConstraint
constraintWithItem
:
_backImageView1
attribute
:
NSLayoutAttributeBottom
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeBottom
multiplier
:
1
.
0
constant
:-
10
];
[
self
.
contentView
addConstraint
:
contentBottom
];
}
return
_backImageView1
;
}
-
(
UILabel
*
)
placeholderLabel2
{
if
(
!
_placeholderLabel2
)
{
_placeholderLabel2
=
[[
UILabel
alloc
]
init
];
_placeholderLabel2
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
_placeholderLabel2
.
font
=
[
UIFont
systemFontOfSize
:
15
.
0
];
_placeholderLabel2
.
textColor
=
kOnLineCellDetailColor
;
[
self
.
contentTextView
addSubview
:
_placeholderLabel2
];
NSLayoutConstraint
*
contentTop
=
[
NSLayoutConstraint
constraintWithItem
:
_placeholderLabel2
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentTextView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
2
];
[
self
.
contentTextView
addConstraint
:
contentTop
];
NSLayoutConstraint
*
contentLeft
=
[
NSLayoutConstraint
constraintWithItem
:
_placeholderLabel2
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentTextView
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
5
];
[
self
.
contentTextView
addConstraint
:
contentLeft
];
NSLayoutConstraint
*
contentRight
=
[
NSLayoutConstraint
constraintWithItem
:
_placeholderLabel2
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentTextView
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:
0
];
[
self
.
contentTextView
addConstraint
:
contentRight
];
NSLayoutConstraint
*
contentHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_placeholderLabel2
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
30
];
[
self
.
contentTextView
addConstraint
:
contentHeight
];
}
return
_placeholderLabel2
;
}
-
(
UITextView
*
)
titleTextView
{
if
(
!
_titleTextView
)
{
_titleTextView
=
[[
UITextView
alloc
]
init
];
_titleTextView
.
tag
=
1001
;
_titleTextView
.
delegate
=
self
;
_titleTextView
.
font
=
[
UIFont
systemFontOfSize
:
15
.
0
];
_titleTextView
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
[
self
.
backImageView1
addSubview
:
_titleTextView
];
NSLayoutConstraint
*
contentTop
=
[
NSLayoutConstraint
constraintWithItem
:
_titleTextView
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
backImageView1
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
1
];
[
self
.
backImageView1
addConstraint
:
contentTop
];
NSLayoutConstraint
*
contentLeft
=
[
NSLayoutConstraint
constraintWithItem
:
_titleTextView
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
backImageView1
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
1
];
[
self
.
backImageView1
addConstraint
:
contentLeft
];
NSLayoutConstraint
*
contentRight
=
[
NSLayoutConstraint
constraintWithItem
:
_titleTextView
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
backImageView1
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:-
1
];
[
self
.
backImageView1
addConstraint
:
contentRight
];
NSLayoutConstraint
*
contentHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_titleTextView
attribute
:
NSLayoutAttributeBottom
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
backImageView1
attribute
:
NSLayoutAttributeBottom
multiplier
:
1
.
0
constant
:-
1
];
[
self
.
backImageView1
addConstraint
:
contentHeight
];
}
return
_titleTextView
;
}
-
(
UILabel
*
)
placeholderLabel1
{
if
(
!
_placeholderLabel1
)
{
_placeholderLabel1
=
[[
UILabel
alloc
]
init
];
_placeholderLabel1
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
_placeholderLabel1
.
font
=
[
UIFont
systemFontOfSize
:
15
.
0
];
_placeholderLabel1
.
textColor
=
kOnLineCellDetailColor
;
[
self
.
titleTextView
addSubview
:
_placeholderLabel1
];
NSLayoutConstraint
*
contentTop
=
[
NSLayoutConstraint
constraintWithItem
:
_placeholderLabel1
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
titleTextView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
2
];
[
self
.
titleTextView
addConstraint
:
contentTop
];
NSLayoutConstraint
*
contentLeft
=
[
NSLayoutConstraint
constraintWithItem
:
_placeholderLabel1
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
titleTextView
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
5
];
[
self
.
titleTextView
addConstraint
:
contentLeft
];
NSLayoutConstraint
*
contentRight
=
[
NSLayoutConstraint
constraintWithItem
:
_placeholderLabel1
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
titleTextView
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:
0
];
[
self
.
titleTextView
addConstraint
:
contentRight
];
NSLayoutConstraint
*
contentHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_placeholderLabel1
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
30
];
[
self
.
titleTextView
addConstraint
:
contentHeight
];
}
return
_placeholderLabel1
;
}
#pragma mark - UITextView Delegate
-
(
BOOL
)
textView
:
(
UITextView
*
)
textView
shouldChangeTextInRange
:
(
NSRange
)
range
replacementText
:
(
NSString
*
)
text
{
if
(
!
[
text
isEqualToString
:
@""
])
{
if
(
textView
.
tag
==
1001
)
{
self
.
placeholderLabel1
.
hidden
=
YES
;
}
else
{
self
.
placeholderLabel2
.
hidden
=
YES
;
}
}
if
([
text
isEqualToString
:
@""
]
&&
range
.
location
==
0
&&
range
.
length
==
1
)
{
if
(
textView
.
tag
==
1001
)
{
self
.
placeholderLabel1
.
hidden
=
NO
;
}
else
{
self
.
placeholderLabel2
.
hidden
=
NO
;
}
}
if
([
text
isEqualToString
:
@"
\n
"
])
{
[
self
.
titleTextView
resignFirstResponder
];
[
self
.
contentTextView
resignFirstResponder
];
if
(
textView
.
text
.
length
!=
0
)
{
self
.
placeholderLabel1
.
hidden
=
YES
;
self
.
placeholderLabel2
.
hidden
=
YES
;
}
else
{
self
.
placeholderLabel1
.
hidden
=
NO
;
self
.
placeholderLabel2
.
hidden
=
NO
;
}
return
NO
;
}
return
YES
;
}
-
(
void
)
touchesEnded
:
(
NSSet
*
)
touches
withEvent
:
(
UIEvent
*
)
event
{
[
self
.
contentView
endEditing
:
YES
];
}
-
(
void
)
setSelected
:
(
BOOL
)
selected
animated
:
(
BOOL
)
animated
{
[
super
setSelected
:
selected
animated
:
animated
];
// Configure the view for the selected state
}
@end
redstar/Classes/Module/Function/Question/AddQuestion/View/AddQuestionFooterView.h
View file @
30be1a46
...
@@ -11,14 +11,5 @@
...
@@ -11,14 +11,5 @@
@interface
AddQuestionFooterView
:
UIView
@interface
AddQuestionFooterView
:
UIView
@property
(
nonatomic
,
strong
)
UITextView
*
titleTextView
;
@property
(
nonatomic
,
strong
)
UITextView
*
contentTextView
;
@property
(
nonatomic
,
strong
)
TakePhotoView
*
takePhotoView
;
@property
(
nonatomic
,
strong
)
UIButton
*
reportBtn
;
@property
(
nonatomic
,
strong
)
UIButton
*
reportBtn
;
@property
(
nonatomic
,
strong
)
UILabel
*
placeholderLabel1
;
@property
(
nonatomic
,
strong
)
UILabel
*
placeholderLabel2
;
@end
@end
redstar/Classes/Module/Function/Question/AddQuestion/View/AddQuestionFooterView.m
View file @
30be1a46
...
@@ -7,15 +7,8 @@
...
@@ -7,15 +7,8 @@
//
//
#import "AddQuestionFooterView.h"
#import "AddQuestionFooterView.h"
@interface
AddQuestionFooterView
()
#define kTakePhotoX 0
#define kTakePhotoY 285
#define kTakePhotoWidth (kScreenWidth - kTakePhotoX * 2)
#define kTakePhotoHeight 130 // 待处理
@interface
AddQuestionFooterView
()
<
UITextViewDelegate
>
@property
(
nonatomic
,
strong
)
UIImageView
*
backImageView1
;
@property
(
nonatomic
,
strong
)
UIImageView
*
backImageView2
;
@end
@end
@implementation
AddQuestionFooterView
@implementation
AddQuestionFooterView
...
@@ -40,224 +33,10 @@
...
@@ -40,224 +33,10 @@
-
(
void
)
setup
-
(
void
)
setup
{
{
self
.
backgroundColor
=
kFootViewBackGroundColor
;
UILabel
*
contentLabel
=
[[
UILabel
alloc
]
init
];
contentLabel
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
contentLabel
.
font
=
[
UIFont
systemFontOfSize
:
16
.
0
];
contentLabel
.
text
=
@"标题"
;
contentLabel
.
textColor
=
kOnLineCellTitleColor
;
[
self
addSubview
:
contentLabel
];
NSLayoutConstraint
*
contentLabelTop
=
[
NSLayoutConstraint
constraintWithItem
:
contentLabel
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
0
];
[
self
addConstraint
:
contentLabelTop
];
NSLayoutConstraint
*
contentLabelLeft
=
[
NSLayoutConstraint
constraintWithItem
:
contentLabel
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
20
];
[
self
addConstraint
:
contentLabelLeft
];
NSLayoutConstraint
*
contentLabelRight
=
[
NSLayoutConstraint
constraintWithItem
:
contentLabel
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:
0
];
[
self
addConstraint
:
contentLabelRight
];
NSLayoutConstraint
*
contentLabelHeight
=
[
NSLayoutConstraint
constraintWithItem
:
contentLabel
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
50
];
[
self
addConstraint
:
contentLabelHeight
];
UILabel
*
titleLabel
=
[[
UILabel
alloc
]
init
];
titleLabel
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
titleLabel
.
font
=
[
UIFont
systemFontOfSize
:
16
.
0
];
titleLabel
.
text
=
@"问题与建议描述"
;
titleLabel
.
textColor
=
kOnLineCellTitleColor
;
[
self
addSubview
:
titleLabel
];
NSLayoutConstraint
*
titleTop
=
[
NSLayoutConstraint
constraintWithItem
:
titleLabel
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
110
];
[
self
addConstraint
:
titleTop
];
NSLayoutConstraint
*
titleLeft
=
[
NSLayoutConstraint
constraintWithItem
:
titleLabel
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
20
];
[
self
addConstraint
:
titleLeft
];
NSLayoutConstraint
*
titleRight
=
[
NSLayoutConstraint
constraintWithItem
:
titleLabel
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:
0
];
[
self
addConstraint
:
titleRight
];
NSLayoutConstraint
*
titleHeight
=
[
NSLayoutConstraint
constraintWithItem
:
titleLabel
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
50
];
[
self
addConstraint
:
titleHeight
];
UIImage
*
image
=
[
UIImage
imageNamed
:
@"textbox"
];
UIImage
*
resizingName
=
[
image
resizableImageWithCapInsets
:
UIEdgeInsetsMake
(
1
,
1
,
24
,
24
)
resizingMode
:
UIImageResizingModeStretch
];
self
.
backImageView2
.
image
=
resizingName
;
self
.
backImageView1
.
image
=
resizingName
;
self
.
contentTextView
.
backgroundColor
=
[
UIColor
clearColor
];
self
.
placeholderLabel2
.
text
=
@"请输入文字..."
;
self
.
titleTextView
.
backgroundColor
=
[
UIColor
clearColor
];
self
.
placeholderLabel1
.
text
=
@"请输入文字..."
;
self
.
takePhotoView
.
backgroundColor
=
kSectionBackGroundColor
;
[
self
.
reportBtn
setTitle
:
@"上报问题"
forState
:
UIControlStateNormal
];
[
self
.
reportBtn
setTitle
:
@"上报问题"
forState
:
UIControlStateNormal
];
}
#pragma mark - lazy loading
-
(
UIImageView
*
)
backImageView2
{
if
(
!
_backImageView2
)
{
_backImageView2
=
[[
UIImageView
alloc
]
init
];
_backImageView2
.
userInteractionEnabled
=
YES
;
_backImageView2
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
[
self
addSubview
:
_backImageView2
];
NSLayoutConstraint
*
contentTop
=
[
NSLayoutConstraint
constraintWithItem
:
_backImageView2
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
50
];
[
self
addConstraint
:
contentTop
];
NSLayoutConstraint
*
contentLeft
=
[
NSLayoutConstraint
constraintWithItem
:
_backImageView2
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
20
];
[
self
addConstraint
:
contentLeft
];
NSLayoutConstraint
*
contentRight
=
[
NSLayoutConstraint
constraintWithItem
:
_backImageView2
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:-
20
];
[
self
addConstraint
:
contentRight
];
NSLayoutConstraint
*
contentHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_backImageView2
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
60
];
[
self
addConstraint
:
contentHeight
];
}
return
_backImageView2
;
}
-
(
UITextView
*
)
contentTextView
{
if
(
!
_contentTextView
)
{
_contentTextView
=
[[
UITextView
alloc
]
init
];
_contentTextView
.
tag
=
1002
;
_contentTextView
.
delegate
=
self
;
_contentTextView
.
font
=
[
UIFont
systemFontOfSize
:
15
.
0
];
_contentTextView
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
[
self
.
backImageView2
addSubview
:
_contentTextView
];
NSLayoutConstraint
*
contentTop
=
[
NSLayoutConstraint
constraintWithItem
:
_contentTextView
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
backImageView2
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
1
];
[
self
.
backImageView2
addConstraint
:
contentTop
];
NSLayoutConstraint
*
contentLeft
=
[
NSLayoutConstraint
constraintWithItem
:
_contentTextView
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
backImageView2
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
1
];
[
self
.
backImageView2
addConstraint
:
contentLeft
];
NSLayoutConstraint
*
contentRight
=
[
NSLayoutConstraint
constraintWithItem
:
_contentTextView
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
backImageView2
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:-
1
];
[
self
.
backImageView2
addConstraint
:
contentRight
];
NSLayoutConstraint
*
contentHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_contentTextView
attribute
:
NSLayoutAttributeBottom
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
backImageView2
attribute
:
NSLayoutAttributeBottom
multiplier
:
1
.
0
constant
:-
1
];
[
self
.
backImageView2
addConstraint
:
contentHeight
];
}
return
_contentTextView
;
}
-
(
UIImageView
*
)
backImageView1
{
if
(
!
_backImageView1
)
{
_backImageView1
=
[[
UIImageView
alloc
]
init
];
_backImageView1
.
userInteractionEnabled
=
YES
;
_backImageView1
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
[
self
addSubview
:
_backImageView1
];
NSLayoutConstraint
*
contentTop
=
[
NSLayoutConstraint
constraintWithItem
:
_backImageView1
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
160
];
[
self
addConstraint
:
contentTop
];
NSLayoutConstraint
*
contentLeft
=
[
NSLayoutConstraint
constraintWithItem
:
_backImageView1
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
20
];
[
self
addConstraint
:
contentLeft
];
NSLayoutConstraint
*
contentRight
=
[
NSLayoutConstraint
constraintWithItem
:
_backImageView1
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:-
20
];
[
self
addConstraint
:
contentRight
];
NSLayoutConstraint
*
contentHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_backImageView1
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
120
];
[
self
addConstraint
:
contentHeight
];
}
return
_backImageView1
;
}
-
(
UILabel
*
)
placeholderLabel2
{
if
(
!
_placeholderLabel2
)
{
_placeholderLabel2
=
[[
UILabel
alloc
]
init
];
_placeholderLabel2
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
_placeholderLabel2
.
font
=
[
UIFont
systemFontOfSize
:
15
.
0
];
_placeholderLabel2
.
textColor
=
kOnLineCellDetailColor
;
[
self
.
contentTextView
addSubview
:
_placeholderLabel2
];
NSLayoutConstraint
*
contentTop
=
[
NSLayoutConstraint
constraintWithItem
:
_placeholderLabel2
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentTextView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
2
];
[
self
.
contentTextView
addConstraint
:
contentTop
];
NSLayoutConstraint
*
contentLeft
=
[
NSLayoutConstraint
constraintWithItem
:
_placeholderLabel2
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentTextView
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
5
];
[
self
.
contentTextView
addConstraint
:
contentLeft
];
NSLayoutConstraint
*
contentRight
=
[
NSLayoutConstraint
constraintWithItem
:
_placeholderLabel2
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentTextView
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:
0
];
[
self
.
contentTextView
addConstraint
:
contentRight
];
NSLayoutConstraint
*
contentHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_placeholderLabel2
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
30
];
[
self
.
contentTextView
addConstraint
:
contentHeight
];
}
return
_placeholderLabel2
;
}
}
-
(
UITextView
*
)
titleTextView
{
if
(
!
_titleTextView
)
{
_titleTextView
=
[[
UITextView
alloc
]
init
];
_titleTextView
.
tag
=
1001
;
_titleTextView
.
delegate
=
self
;
_titleTextView
.
font
=
[
UIFont
systemFontOfSize
:
15
.
0
];
_titleTextView
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
[
self
.
backImageView1
addSubview
:
_titleTextView
];
NSLayoutConstraint
*
contentTop
=
[
NSLayoutConstraint
constraintWithItem
:
_titleTextView
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
backImageView1
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
1
];
[
self
.
backImageView1
addConstraint
:
contentTop
];
NSLayoutConstraint
*
contentLeft
=
[
NSLayoutConstraint
constraintWithItem
:
_titleTextView
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
backImageView1
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
1
];
[
self
.
backImageView1
addConstraint
:
contentLeft
];
NSLayoutConstraint
*
contentRight
=
[
NSLayoutConstraint
constraintWithItem
:
_titleTextView
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
backImageView1
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:-
1
];
[
self
.
backImageView1
addConstraint
:
contentRight
];
NSLayoutConstraint
*
contentHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_titleTextView
attribute
:
NSLayoutAttributeBottom
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
backImageView1
attribute
:
NSLayoutAttributeBottom
multiplier
:
1
.
0
constant
:-
1
];
[
self
.
backImageView1
addConstraint
:
contentHeight
];
}
return
_titleTextView
;
}
-
(
UILabel
*
)
placeholderLabel1
{
if
(
!
_placeholderLabel1
)
{
_placeholderLabel1
=
[[
UILabel
alloc
]
init
];
_placeholderLabel1
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
_placeholderLabel1
.
font
=
[
UIFont
systemFontOfSize
:
15
.
0
];
_placeholderLabel1
.
textColor
=
kOnLineCellDetailColor
;
[
self
.
titleTextView
addSubview
:
_placeholderLabel1
];
NSLayoutConstraint
*
contentTop
=
[
NSLayoutConstraint
constraintWithItem
:
_placeholderLabel1
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
titleTextView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
2
];
[
self
.
titleTextView
addConstraint
:
contentTop
];
NSLayoutConstraint
*
contentLeft
=
[
NSLayoutConstraint
constraintWithItem
:
_placeholderLabel1
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
titleTextView
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
5
];
[
self
.
titleTextView
addConstraint
:
contentLeft
];
NSLayoutConstraint
*
contentRight
=
[
NSLayoutConstraint
constraintWithItem
:
_placeholderLabel1
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
titleTextView
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:
0
];
[
self
.
titleTextView
addConstraint
:
contentRight
];
NSLayoutConstraint
*
contentHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_placeholderLabel1
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
30
];
[
self
.
titleTextView
addConstraint
:
contentHeight
];
}
return
_placeholderLabel1
;
}
-
(
TakePhotoView
*
)
takePhotoView
{
if
(
!
_takePhotoView
)
{
_takePhotoView
=
[[
TakePhotoView
alloc
]
initWithFrame
:
CGRectMake
(
kTakePhotoX
,
kTakePhotoY
,
kTakePhotoWidth
,
kTakePhotoHeight
)];
[
self
addSubview
:
_takePhotoView
];
}
return
_takePhotoView
;
}
-
(
UIButton
*
)
reportBtn
-
(
UIButton
*
)
reportBtn
{
{
if
(
!
_reportBtn
)
{
if
(
!
_reportBtn
)
{
...
@@ -269,7 +48,7 @@
...
@@ -269,7 +48,7 @@
[
_reportBtn
setTitleColor
:[
UIColor
whiteColor
]
forState
:
UIControlStateNormal
];
[
_reportBtn
setTitleColor
:[
UIColor
whiteColor
]
forState
:
UIControlStateNormal
];
[
self
addSubview
:
_reportBtn
];
[
self
addSubview
:
_reportBtn
];
NSLayoutConstraint
*
tableTop
=
[
NSLayoutConstraint
constraintWithItem
:
_reportBtn
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
takePhotoView
attribute
:
NSLayoutAttributeBottom
multiplier
:
1
.
0
constant
:
10
];
NSLayoutConstraint
*
tableTop
=
[
NSLayoutConstraint
constraintWithItem
:
_reportBtn
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
10
];
[
self
addConstraint
:
tableTop
];
[
self
addConstraint
:
tableTop
];
NSLayoutConstraint
*
tableLeft
=
[
NSLayoutConstraint
constraintWithItem
:
_reportBtn
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
20
];
NSLayoutConstraint
*
tableLeft
=
[
NSLayoutConstraint
constraintWithItem
:
_reportBtn
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
20
];
...
...
redstar/Classes/Module/Function/Question/AddQuestion/ViewController/AddQuestionViewController.m
View file @
30be1a46
...
@@ -11,10 +11,16 @@
...
@@ -11,10 +11,16 @@
#import "AddQuestionFooterView.h"
#import "AddQuestionFooterView.h"
#import "CheckPicViewController.h"
#import "CheckPicViewController.h"
#import "InspectAddCell.h"
#import "InspectPicAddCell.h"
#import "InpectPictureCell.h"
#import "CommonFunc.h"
#import "CommonFunc.h"
#import "HttpClient.h"
#import "HttpClient.h"
#import <MBProgressHUD.h>
#import <MBProgressHUD.h>
#import "AddQuestionTableCell.h"
#define kTitleTextViewTag 9283222
#define kContentTextViewTag 9283333
#define CATEGORYLIST @"服务", @"环境企划", @"环境物业", nil
#define CATEGORYLIST @"服务", @"环境企划", @"环境物业", nil
#define QUESTIONLIST @"15分钟退单", @"便民服务", @"基础管理",@"轻松购系统",@"全员服务",@"人员信息",@"营运物流及服务硬件", nil
#define QUESTIONLIST @"15分钟退单", @"便民服务", @"基础管理",@"轻松购系统",@"全员服务",@"人员信息",@"营运物流及服务硬件", nil
...
@@ -22,7 +28,7 @@
...
@@ -22,7 +28,7 @@
#define kAddQuestionCell @"UITableViewCellIdentifier"
#define kAddQuestionCell @"UITableViewCellIdentifier"
@interface
AddQuestionViewController
()
<
UITableViewDelegate
,
UITableViewDataSource
,
TakePhotoViewDelegate
,
UINavigationControllerDelegate
,
UIImagePickerControllerDelegate
,
UIActionSheetDelegate
,
UITextViewDelegate
>
@interface
AddQuestionViewController
()
<
UITableViewDelegate
,
UITableViewDataSource
,
UINavigationControllerDelegate
,
UIImagePickerControllerDelegate
,
UIActionSheetDelegate
,
UITextViewDelegate
>
@property
(
nonatomic
,
strong
)
UITableView
*
tableView
;
@property
(
nonatomic
,
strong
)
UITableView
*
tableView
;
@property
(
nonatomic
,
strong
)
AddQuestionFooterView
*
footerView
;
@property
(
nonatomic
,
strong
)
AddQuestionFooterView
*
footerView
;
...
@@ -36,15 +42,12 @@
...
@@ -36,15 +42,12 @@
@property
(
nonatomic
,
strong
)
UILabel
*
selectLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
selectLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
selectLabel1
;
@property
(
nonatomic
,
strong
)
UILabel
*
selectLabel1
;
@property
(
nonatomic
,
assign
)
int
rowNumber
;
@property
(
nonatomic
,
strong
)
NSMutableDictionary
*
saveDict
;
@end
@end
@implementation
AddQuestionViewController
@implementation
AddQuestionViewController
-
(
void
)
viewDidLoad
-
(
void
)
viewDidLoad
{
{
[
super
viewDidLoad
];
[
super
viewDidLoad
];
...
@@ -72,8 +75,14 @@
...
@@ -72,8 +75,14 @@
[
self
addTableView
];
[
self
addTableView
];
// takePhoto代理
// takePhoto代理
self
.
footerView
.
takePhotoView
.
delegate
=
self
;
[
self
.
footerView
.
reportBtn
addTarget
:
self
action
:
@selector
(
upLoadQuestionPic
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
self
.
footerView
.
reportBtn
addTarget
:
self
action
:
@selector
(
upLoadQuestionPic
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
self
.
saveDict
=
[
NSMutableDictionary
dictionary
];
[
_saveDict
setObject
:
@"请选择"
forKey
:
@"selectLabel"
];
[
_saveDict
setObject
:
@"请选择"
forKey
:
@"selectLabel1"
];
_rowNumber
=
4
;
}
}
-
(
void
)
didReceiveMemoryWarning
{
-
(
void
)
didReceiveMemoryWarning
{
...
@@ -97,14 +106,19 @@
...
@@ -97,14 +106,19 @@
return
;
return
;
}
}
NSIndexPath
*
indexPath
=
[
NSIndexPath
indexPathForRow
:
2
inSection
:
0
];
AddQuestionTableCell
*
cell
=
(
AddQuestionTableCell
*
)[
_tableView
cellForRowAtIndexPath
:
indexPath
];
NSString
*
title
=
[
cell
titleTextView
].
text
;
NSString
*
content
=
[
cell
contentTextView
].
text
;
NSDictionary
*
parameters
;
NSDictionary
*
parameters
;
if
(
_imageNameArray
.
count
==
0
)
{
if
(
_imageNameArray
.
count
==
0
)
{
parameters
=
@{
@"category"
:
_selectLabel
.
text
,
parameters
=
@{
@"category"
:
_selectLabel
.
text
,
@"group"
:
_selectLabel1
.
text
,
@"group"
:
_selectLabel1
.
text
,
@"title"
:
self
.
footerView
.
contentTextView
.
tex
t
,
@"title"
:
conten
t
,
@"content"
:
self
.
footerView
.
titleTextView
.
text
@"content"
:
title
};
};
}
else
{
}
else
{
NSMutableArray
*
imageArray
=
[
NSMutableArray
array
];
NSMutableArray
*
imageArray
=
[
NSMutableArray
array
];
...
@@ -123,8 +137,8 @@
...
@@ -123,8 +137,8 @@
parameters
=
@{
@"category"
:
_selectLabel
.
text
,
parameters
=
@{
@"category"
:
_selectLabel
.
text
,
@"group"
:
_selectLabel1
.
text
,
@"group"
:
_selectLabel1
.
text
,
@"title"
:
self
.
footerView
.
contentTextView
.
tex
t
,
@"title"
:
conten
t
,
@"content"
:
self
.
footerView
.
titleTextView
.
text
,
@"content"
:
title
,
@"attachments"
:
imageArray
};
@"attachments"
:
imageArray
};
}
}
...
@@ -173,60 +187,14 @@
...
@@ -173,60 +187,14 @@
self
.
tableView
.
tableFooterView
=
self
.
footerView
;
self
.
tableView
.
tableFooterView
=
self
.
footerView
;
}
}
-
(
void
)
createImagePicker
:
(
UIButton
*
)
sender
#pragma mark - UIAlertViewDelegate
-
(
void
)
alertView
:
(
UIAlertView
*
)
alertView
clickedButtonAtIndex
:
(
NSInteger
)
buttonIndex
{
{
if
(
buttonIndex
==
0
&&
alertView
.
tag
==
90393
)
{
if
(
sender
.
tag
==
2201
)
{
[
self
.
navigationController
popViewControllerAnimated
:
YES
];
_rowNumber
++
;
NSNotificationCenter
*
notification
=
[
NSNotificationCenter
defaultCenter
];
[
notification
postNotificationName
:
kRefreshQuestionNotification
object
:
self
];
}
}
}
#pragma mark - TakePhoto Delegate
-
(
void
)
deletePhoto
:
(
UIButton
*
)
button
{
// 从存放所有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
,
170
,
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
{
if
(
!
[
UIImagePickerController
isSourceTypeAvailable
:
UIImagePickerControllerSourceTypeCamera
])
{
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
];
[
alert
show
];
}
else
{
}
else
{
UIImagePickerController
*
picker
=
[[
UIImagePickerController
alloc
]
init
];
UIImagePickerController
*
picker
=
[[
UIImagePickerController
alloc
]
init
];
...
@@ -238,18 +206,12 @@
...
@@ -238,18 +206,12 @@
}
}
}
}
-
(
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
{
-
(
void
)
saveImage
:
(
UIImage
*
)
currentImage
{
NSData
*
imageData
=
UIImageJPEGRepresentation
(
currentImage
,
0
.
5
);
NSData
*
imageData
=
UIImageJPEGRepresentation
(
currentImage
,
0
.
5
);
NSString
*
imageName
=
[
CommonFunc
md5Data
:
imageData
];
NSString
*
imageName
=
[
NSString
stringWithFormat
:
@"imageName%d"
,
(
int
)
_imageNameArray
.
count
];
[
_imageNameArray
addObject
:
imageName
];
[
_imageNameArray
addObject
:
imageName
];
...
@@ -258,109 +220,176 @@
...
@@ -258,109 +220,176 @@
// 将图片写入文件
// 将图片写入文件
[
imageData
writeToFile
:
fullPath
atomically
:
NO
];
[
imageData
writeToFile
:
fullPath
atomically
:
NO
];
}
}
#pragma mark - UIImagePickerController 代理方法
#pragma mark - UIImagePickerController 代理方法
-
(
void
)
imagePickerController
:
(
UIImagePickerController
*
)
picker
didFinishPickingMediaWithInfo
:
(
NSDictionary
*
)
info
-
(
void
)
imagePickerController
:
(
UIImagePickerController
*
)
picker
didFinishPickingMediaWithInfo
:
(
NSDictionary
*
)
info
{
{
UIImage
*
image
=
[
info
objectForKey
:
UIImagePickerControllerOriginalImage
];
UIImage
*
image
=
[
info
objectForKey
:
UIImagePickerControllerOriginalImage
];
[
self
saveImage
:
image
];
[
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
,
170
,
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 - UIAlertViewDelegate
-
(
void
)
alertView
:
(
UIAlertView
*
)
alertView
clickedButtonAtIndex
:
(
NSInteger
)
buttonIndex
{
if
(
buttonIndex
==
0
&&
alertView
.
tag
==
90393
)
{
[
self
.
navigationController
popViewControllerAnimated
:
YES
];
NSNotificationCenter
*
notification
=
[
NSNotificationCenter
defaultCenter
];
[
notification
postNotificationName
:
kRefreshQuestionNotification
object
:
self
];
}
}
}
#pragma mark - TableView Delegate/DateSource
#pragma mark - TableView Delegate/DateSource
-
(
NSInteger
)
tableView
:
(
UITableView
*
)
tableView
numberOfRowsInSection
:
(
NSInteger
)
section
-
(
NSInteger
)
tableView
:
(
UITableView
*
)
tableView
numberOfRowsInSection
:
(
NSInteger
)
section
{
{
return
_
titleArray
.
count
;
return
_
rowNumber
;
}
}
// cell显示的内容
// cell显示的内容
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
{
if
(
indexPath
.
row
<
2
)
{
UITableViewCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
kAddQuestionCell
];
if
(
!
cell
)
{
UITableViewCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
kAddQuestionCell
];
cell
=
[[
UITableViewCell
alloc
]
initWithStyle
:
UITableViewCellStyleValue1
reuseIdentifier
:
kAddQuestionCell
];
if
(
!
cell
)
{
}
cell
=
[[
UITableViewCell
alloc
]
initWithStyle
:
UITableViewCellStyleValue1
reuseIdentifier
:
kAddQuestionCell
];
cell
.
textLabel
.
text
=
[
NSString
stringWithFormat
:
@"%@"
,
_titleArray
[
indexPath
.
row
]];
}
cell
.
textLabel
.
font
=
[
UIFont
systemFontOfSize
:
16
.
0
];
cell
.
textLabel
.
text
=
[
NSString
stringWithFormat
:
@"%@"
,
_titleArray
[
indexPath
.
row
]];
cell
.
textLabel
.
textColor
=
kOnLineCellTitleColor
;
cell
.
textLabel
.
font
=
[
UIFont
systemFontOfSize
:
16
.
0
];
cell
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
cell
.
textLabel
.
textColor
=
kOnLineCellTitleColor
;
cell
.
accessoryType
=
UITableViewCellAccessoryDisclosureIndicator
;
cell
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
cell
.
accessoryType
=
UITableViewCellAccessoryDisclosureIndicator
;
if
(
indexPath
.
row
==
0
)
{
self
.
selectLabel
=
[[
UILabel
alloc
]
init
];
if
(
indexPath
.
row
==
0
)
{
_selectLabel
.
text
=
@"请选择"
;
if
(
!
self
.
selectLabel
)
{
_selectLabel
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
_selectLabel
=
[[
UILabel
alloc
]
init
];
_selectLabel
.
textColor
=
kOnLineCellDetailColor
;
}
_selectLabel
.
textAlignment
=
NSTextAlignmentRight
;
_selectLabel
.
text
=
_saveDict
[
@"selectLabel"
];
_selectLabel
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
_selectLabel
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
_selectLabel
.
font
=
[
UIFont
systemFontOfSize
:
15
.
0
];
_selectLabel
.
textColor
=
kOnLineCellDetailColor
;
[
cell
.
contentView
addSubview
:
_selectLabel
];
_selectLabel
.
textAlignment
=
NSTextAlignmentRight
;
// 顶端
_selectLabel
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
NSLayoutConstraint
*
selectTop
=
[
NSLayoutConstraint
constraintWithItem
:
_selectLabel
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
cell
.
contentView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
0
];
_selectLabel
.
font
=
[
UIFont
systemFontOfSize
:
15
.
0
];
[
cell
.
contentView
addConstraint
:
selectTop
];
[
cell
.
contentView
addSubview
:
_selectLabel
];
// 顶端
NSLayoutConstraint
*
selectTop
=
[
NSLayoutConstraint
constraintWithItem
:
_selectLabel
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
cell
.
contentView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
0
];
[
cell
.
contentView
addConstraint
:
selectTop
];
// 左边
NSLayoutConstraint
*
selectRight
=
[
NSLayoutConstraint
constraintWithItem
:
_selectLabel
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
cell
.
contentView
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:
0
];
[
cell
.
contentView
addConstraint
:
selectRight
];
// 高度
NSLayoutConstraint
*
selectBottom
=
[
NSLayoutConstraint
constraintWithItem
:
_selectLabel
attribute
:
NSLayoutAttributeBottom
relatedBy
:
NSLayoutRelationEqual
toItem
:
cell
.
contentView
attribute
:
NSLayoutAttributeBottom
multiplier
:
1
.
0
constant
:
0
];
[
cell
.
contentView
addConstraint
:
selectBottom
];
// 高度
NSLayoutConstraint
*
selectHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_selectLabel
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
50
];
[
cell
.
contentView
addConstraint
:
selectHeight
];
}
else
{
if
(
!
self
.
selectLabel1
)
{
self
.
selectLabel1
=
[[
UILabel
alloc
]
init
];
}
_selectLabel1
.
text
=
_saveDict
[
@"selectLabel1"
];
_selectLabel1
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
_selectLabel1
.
textColor
=
kOnLineCellDetailColor
;
_selectLabel1
.
textAlignment
=
NSTextAlignmentRight
;
_selectLabel1
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
_selectLabel1
.
font
=
[
UIFont
systemFontOfSize
:
15
.
0
];
[
cell
.
contentView
addSubview
:
_selectLabel1
];
// 顶端
NSLayoutConstraint
*
selectTop
=
[
NSLayoutConstraint
constraintWithItem
:
_selectLabel1
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
cell
.
contentView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
0
];
[
cell
.
contentView
addConstraint
:
selectTop
];
// 左边
NSLayoutConstraint
*
selectRight
=
[
NSLayoutConstraint
constraintWithItem
:
_selectLabel1
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
cell
.
contentView
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:
0
];
[
cell
.
contentView
addConstraint
:
selectRight
];
// 高度
NSLayoutConstraint
*
selectBottom
=
[
NSLayoutConstraint
constraintWithItem
:
_selectLabel1
attribute
:
NSLayoutAttributeBottom
relatedBy
:
NSLayoutRelationEqual
toItem
:
cell
.
contentView
attribute
:
NSLayoutAttributeBottom
multiplier
:
1
.
0
constant
:
0
];
[
cell
.
contentView
addConstraint
:
selectBottom
];
// 高度
NSLayoutConstraint
*
selectHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_selectLabel1
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
50
];
[
cell
.
contentView
addConstraint
:
selectHeight
];
}
return
cell
;
}
else
if
(
indexPath
.
row
==
2
){
AddQuestionTableCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
@"kAddQuestionCell"
];
if
(
!
cell
)
{
cell
=
[[
AddQuestionTableCell
alloc
]
initWithStyle
:
UITableViewCellStyleValue1
reuseIdentifier
:
@"kAddQuestionCell"
];
}
cell
.
titleTextView
.
tag
=
kTitleTextViewTag
;
cell
.
contentTextView
.
tag
=
kContentTextViewTag
;
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
{
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
;
}
// 左边
NSLayoutConstraint
*
selectRight
=
[
NSLayoutConstraint
constraintWithItem
:
_selectLabel
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
cell
.
contentView
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:
0
];
[
cell
.
contentView
addConstraint
:
selectRight
];
// 高度
NSLayoutConstraint
*
selectBottom
=
[
NSLayoutConstraint
constraintWithItem
:
_selectLabel
attribute
:
NSLayoutAttributeBottom
relatedBy
:
NSLayoutRelationEqual
toItem
:
cell
.
contentView
attribute
:
NSLayoutAttributeBottom
multiplier
:
1
.
0
constant
:
0
];
[
cell
.
contentView
addConstraint
:
selectBottom
];
}
else
{
}
else
{
self
.
selectLabel1
=
[[
UILabel
alloc
]
init
];
_selectLabel1
.
text
=
@"请选择"
;
_selectLabel1
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
_selectLabel1
.
textColor
=
kOnLineCellDetailColor
;
_selectLabel1
.
textAlignment
=
NSTextAlignmentRight
;
_selectLabel1
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
_selectLabel1
.
font
=
[
UIFont
systemFontOfSize
:
15
.
0
];
[
cell
.
contentView
addSubview
:
_selectLabel1
];
// 顶端
NSLayoutConstraint
*
selectTop
=
[
NSLayoutConstraint
constraintWithItem
:
_selectLabel1
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
cell
.
contentView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
0
];
[
cell
.
contentView
addConstraint
:
selectTop
];
// 左边
NSString
*
identifier
=
[
NSString
stringWithFormat
:
@"InspectPictureCell"
];
NSLayoutConstraint
*
selectRight
=
[
NSLayoutConstraint
constraintWithItem
:
_selectLabel1
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
cell
.
contentView
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:
0
];
InpectPictureCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
identifier
];
[
cell
.
contentView
addConstraint
:
selectRight
];
if
(
!
cell
)
{
cell
=
[[
InpectPictureCell
alloc
]
initWithStyle
:
UITableViewCellStyleValue1
reuseIdentifier
:
identifier
];
}
NSString
*
imageName0
=
_imageNameArray
[(
indexPath
.
row
-
3
)
*
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
-
3
)
*
2
+
1
];
NSLayoutConstraint
*
selectBottom
=
[
NSLayoutConstraint
constraintWithItem
:
_selectLabel1
attribute
:
NSLayoutAttributeBottom
relatedBy
:
NSLayoutRelationEqual
toItem
:
cell
.
contentView
attribute
:
NSLayoutAttributeBottom
multiplier
:
1
.
0
constant
:
0
];
NSLog
(
@"imageName = %@"
,
imageName1
);
[
cell
.
contentView
addConstraint
:
selectBottom
];
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
;
}
}
return
cell
;
}
}
// cell的高度
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
return
50
;
}
-
(
void
)
tableView
:
(
UITableView
*
)
tableView
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
-
(
void
)
tableView
:
(
UITableView
*
)
tableView
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
{
...
@@ -369,10 +398,12 @@
...
@@ -369,10 +398,12 @@
_categoryActionSheet
.
delegate
=
self
;
_categoryActionSheet
.
delegate
=
self
;
[
_categoryActionSheet
showInView
:
self
.
view
];
[
_categoryActionSheet
showInView
:
self
.
view
];
}
else
{
}
else
if
(
indexPath
.
row
==
1
)
{
self
.
questionActionSheet
=
[[
UIActionSheet
alloc
]
initWithTitle
:
nil
delegate
:
self
cancelButtonTitle
:
@"取消"
destructiveButtonTitle
:
nil
otherButtonTitles
:
QUESTIONLIST
];
self
.
questionActionSheet
=
[[
UIActionSheet
alloc
]
initWithTitle
:
nil
delegate
:
self
cancelButtonTitle
:
@"取消"
destructiveButtonTitle
:
nil
otherButtonTitles
:
QUESTIONLIST
];
_questionActionSheet
.
delegate
=
self
;
_questionActionSheet
.
delegate
=
self
;
[
_questionActionSheet
showInView
:
self
.
view
];
[
_questionActionSheet
showInView
:
self
.
view
];
}
else
{
return
;
}
}
}
}
...
@@ -384,10 +415,12 @@
...
@@ -384,10 +415,12 @@
if
(
buttonIndex
<
[
NSArray
arrayWithObjects
:
CATEGORYLIST
].
count
)
{
if
(
buttonIndex
<
[
NSArray
arrayWithObjects
:
CATEGORYLIST
].
count
)
{
_selectLabel
.
text
=
[[
NSArray
arrayWithObjects
:
CATEGORYLIST
]
objectAtIndex
:
buttonIndex
];
_selectLabel
.
text
=
[[
NSArray
arrayWithObjects
:
CATEGORYLIST
]
objectAtIndex
:
buttonIndex
];
[
_saveDict
setObject
:[[
NSArray
arrayWithObjects
:
CATEGORYLIST
]
objectAtIndex
:
buttonIndex
]
forKey
:
@"selectLabel"
];
}
}
}
else
{
}
else
{
if
(
buttonIndex
<
[
NSArray
arrayWithObjects
:
QUESTIONLIST
].
count
)
{
if
(
buttonIndex
<
[
NSArray
arrayWithObjects
:
QUESTIONLIST
].
count
)
{
_selectLabel1
.
text
=
[[
NSArray
arrayWithObjects
:
QUESTIONLIST
]
objectAtIndex
:
buttonIndex
];
_selectLabel1
.
text
=
[[
NSArray
arrayWithObjects
:
QUESTIONLIST
]
objectAtIndex
:
buttonIndex
];
[
_saveDict
setObject
:[[
NSArray
arrayWithObjects
:
QUESTIONLIST
]
objectAtIndex
:
buttonIndex
]
forKey
:
@"selectLabel1"
];
}
}
}
}
}
}
...
@@ -403,6 +436,8 @@
...
@@ -403,6 +436,8 @@
_tableView
.
dataSource
=
self
;
_tableView
.
dataSource
=
self
;
_tableView
.
showsVerticalScrollIndicator
=
NO
;
_tableView
.
showsVerticalScrollIndicator
=
NO
;
_tableView
.
showsHorizontalScrollIndicator
=
NO
;
_tableView
.
showsHorizontalScrollIndicator
=
NO
;
_tableView
.
rowHeight
=
UITableViewAutomaticDimension
;
_tableView
.
estimatedRowHeight
=
100
.
0
;
[
self
.
view
addSubview
:
_tableView
];
[
self
.
view
addSubview
:
_tableView
];
NSLayoutConstraint
*
tableTop
=
[
NSLayoutConstraint
constraintWithItem
:
_tableView
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
view
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
0
];
NSLayoutConstraint
*
tableTop
=
[
NSLayoutConstraint
constraintWithItem
:
_tableView
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
view
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
0
];
...
@@ -423,13 +458,7 @@
...
@@ -423,13 +458,7 @@
-
(
AddQuestionFooterView
*
)
footerView
-
(
AddQuestionFooterView
*
)
footerView
{
{
if
(
!
_footerView
)
{
if
(
!
_footerView
)
{
if
(
kScreenHeight
==
480
)
{
_footerView
=
[[
AddQuestionFooterView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
50
)];
_footerView
=
[[
AddQuestionFooterView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
400
)];
}
else
{
_footerView
=
[[
AddQuestionFooterView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
(
kScreenHeight
-
100
-
64
))];
}
_footerView
.
titleTextView
.
delegate
=
self
;
_footerView
.
contentTextView
.
delegate
=
self
;
}
}
return
_footerView
;
return
_footerView
;
}
}
...
@@ -438,41 +467,7 @@
...
@@ -438,41 +467,7 @@
[
self
.
tableView
endEditing
:
YES
];
[
self
.
tableView
endEditing
:
YES
];
}
}
#pragma mark - UITextView Delegate
-
(
BOOL
)
textView
:
(
UITextView
*
)
textView
shouldChangeTextInRange
:
(
NSRange
)
range
replacementText
:
(
NSString
*
)
text
{
if
(
!
[
text
isEqualToString
:
@""
])
{
if
(
textView
.
tag
==
1001
)
{
self
.
footerView
.
placeholderLabel1
.
hidden
=
YES
;
}
else
{
self
.
footerView
.
placeholderLabel2
.
hidden
=
YES
;
}
}
if
([
text
isEqualToString
:
@""
]
&&
range
.
location
==
0
&&
range
.
length
==
1
)
{
if
(
textView
.
tag
==
1001
)
{
self
.
footerView
.
placeholderLabel1
.
hidden
=
NO
;
}
else
{
self
.
footerView
.
placeholderLabel2
.
hidden
=
NO
;
}
}
if
([
text
isEqualToString
:
@"
\n
"
])
{
[
self
.
footerView
.
titleTextView
resignFirstResponder
];
[
self
.
footerView
.
contentTextView
resignFirstResponder
];
if
(
textView
.
text
.
length
!=
0
)
{
self
.
footerView
.
placeholderLabel1
.
hidden
=
YES
;
self
.
footerView
.
placeholderLabel2
.
hidden
=
YES
;
}
else
{
self
.
footerView
.
placeholderLabel1
.
hidden
=
NO
;
self
.
footerView
.
placeholderLabel2
.
hidden
=
NO
;
}
return
NO
;
}
return
YES
;
}
@end
@end
redstar/Classes/Module/Home/ViewController/HomeViewController.m
View file @
30be1a46
...
@@ -84,6 +84,7 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
...
@@ -84,6 +84,7 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
@end
@end
@implementation
HomeViewController
@implementation
HomeViewController
#pragma mark - ViewDidLoad
#pragma mark - ViewDidLoad
-
(
void
)
viewDidLoad
-
(
void
)
viewDidLoad
{
{
...
@@ -154,7 +155,6 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
...
@@ -154,7 +155,6 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
self
.
tableView
.
tableHeaderView
=
self
.
headView
;
self
.
tableView
.
tableHeaderView
=
self
.
headView
;
// 设置下拉刷新
// 设置下拉刷新
self
.
tableView
.
header
=
[
MJRefreshNormalHeader
headerWithRefreshingBlock
:
^
{
self
.
tableView
.
header
=
[
MJRefreshNormalHeader
headerWithRefreshingBlock
:
^
{
// 进入刷新状态后会自动调用这个block
// 进入刷新状态后会自动调用这个block
...
@@ -162,6 +162,7 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
...
@@ -162,6 +162,7 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
}];
}];
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
refreshInspectList
)
selector
:
@selector
(
refreshInspectList
)
name
:
kRefreshInspectPointNotification
name
:
kRefreshInspectPointNotification
...
@@ -275,6 +276,7 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
...
@@ -275,6 +276,7 @@ typedef NSComparisonResult (^NSComparator)(id obj1, id obj2);
self
.
tabBarController
.
tabBar
.
hidden
=
NO
;
self
.
tabBarController
.
tabBar
.
hidden
=
NO
;
self
.
navigationController
.
navigationBar
.
hidden
=
YES
;
self
.
navigationController
.
navigationBar
.
hidden
=
YES
;
[
self
.
tableView
.
header
beginRefreshing
];
}
}
-
(
void
)
didReceiveMemoryWarning
{
-
(
void
)
didReceiveMemoryWarning
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment