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
c694e41b
Commit
c694e41b
authored
9 years ago
by
admin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复了我的 部分bug
parent
4b9a9bb0
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
158 additions
and
350 deletions
+158
-350
UserInterfaceState.xcuserstate
...userdata/admin.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
Contents.json
...r/Assets.xcassets/home/SystemImage.imageset/Contents.json
+22
-0
SystemImage.png
...Assets.xcassets/home/SystemImage.imageset/SystemImage.png
+0
-0
SystemImage@2x.png
...ets.xcassets/home/SystemImage.imageset/SystemImage@2x.png
+0
-0
QuestionDetailViewController.m
...stionDetail/ViewController/QuestionDetailViewController.m
+2
-13
RankingListCell.h
...on/WordOfMouth/Ranking/RankingList/Cell/RankingListCell.h
+1
-2
RankingListCell.m
...on/WordOfMouth/Ranking/RankingList/Cell/RankingListCell.m
+6
-29
HomeViewController.m
...r/Classes/Module/Home/ViewController/HomeViewController.m
+76
-280
MineTableHeaderView.h
redstar/Classes/Module/Mine/View/MineTableHeaderView.h
+1
-1
MineTableHeaderView.m
redstar/Classes/Module/Mine/View/MineTableHeaderView.m
+50
-25
No files found.
redstar.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate
View file @
c694e41b
No preview for this file type
This diff is collapsed.
Click to expand it.
redstar/Assets.xcassets/home/SystemImage.imageset/Contents.json
0 → 100644
View file @
c694e41b
{
"images"
:
[
{
"idiom"
:
"universal"
,
"filename"
:
"SystemImage.png"
,
"scale"
:
"1x"
},
{
"idiom"
:
"universal"
,
"filename"
:
"SystemImage@2x.png"
,
"scale"
:
"2x"
},
{
"idiom"
:
"universal"
,
"scale"
:
"3x"
}
],
"info"
:
{
"version"
:
1
,
"author"
:
"xcode"
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
redstar/Assets.xcassets/home/SystemImage.imageset/SystemImage.png
0 → 100644
View file @
c694e41b
54.7 KB
This diff is collapsed.
Click to expand it.
redstar/Assets.xcassets/home/SystemImage.imageset/SystemImage@2x.png
0 → 100644
View file @
c694e41b
178 KB
This diff is collapsed.
Click to expand it.
redstar/Classes/Module/Function/Question/QuestionDetail/ViewController/QuestionDetailViewController.m
View file @
c694e41b
...
...
@@ -10,7 +10,6 @@
#import "QuestionDetailCell.h"
#import "QuestionCommentCell.h"
#import "QuestionDescribeCell.h"
#import "QuestionDetailFooterView.h"
#import "CommentView.h"
#import "HttpClient.h"
...
...
@@ -24,7 +23,6 @@
#define kQuestionDescribeCell @"QuestionDescribeCell" // 问题描述
@interface
QuestionDetailViewController
()
<
UITableViewDelegate
,
UITableViewDataSource
,
UIAlertViewDelegate
,
UITextViewDelegate
>
@property
(
nonatomic
,
strong
)
UITableView
*
tableView
;
@property
(
nonatomic
,
strong
)
QuestionDetailFooterView
*
footerView
;
@property
(
nonatomic
,
strong
)
UIView
*
backGroundView
;
@property
(
nonatomic
,
strong
)
CommentView
*
commentView
;
...
...
@@ -47,7 +45,6 @@
self
.
navigationController
.
navigationBar
.
translucent
=
NO
;
}
[
self
.
footerView
.
addButon
addTarget
:
self
action
:
@selector
(
addComment
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
self
setupNav
];
...
...
@@ -97,8 +94,7 @@
[
_allCommentArray
addObject
:
comment
];
}
[
MBProgressHUD
hideHUDForView
:
self
.
view
animated
:
YES
];
self
.
tableView
.
tableFooterView
=
self
.
footerView
;
[
self
.
tableView
reloadData
];
}];
}
...
...
@@ -471,14 +467,7 @@
return
_tableView
;
}
-
(
QuestionDetailFooterView
*
)
footerView
{
if
(
!
_footerView
)
{
_footerView
=
[[
QuestionDetailFooterView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
140
)];
_footerView
.
backgroundColor
=
kSectionBackGroundColor
;
}
return
_footerView
;
}
...
...
This diff is collapsed.
Click to expand it.
redstar/Classes/Module/Function/WordOfMouth/Ranking/RankingList/Cell/RankingListCell.h
View file @
c694e41b
...
...
@@ -19,7 +19,7 @@ typedef enum ScoreState : NSUInteger {
@interface
RankingListCell
:
UITableViewCell
@property
(
nonatomic
,
assign
)
BOOL
isDrop
;
// 判断是否drop
@property
(
nonatomic
,
strong
)
UI
Button
*
shopNameButton
;
// 商店名称
@property
(
nonatomic
,
strong
)
UI
Label
*
shopNameButton
;
// 商店名称
@property
(
nonatomic
,
strong
)
UILabel
*
scoreLabel
;
// 分数
@property
(
nonatomic
,
assign
)
ScoreState
scoreState
;
// 判断类型
@property
(
nonatomic
,
strong
)
UIView
*
gradeView
;
...
...
@@ -29,7 +29,6 @@ typedef enum ScoreState : NSUInteger {
@property
(
nonatomic
,
strong
)
UILabel
*
someoneLabel
;
// 发表评语的人
@property
(
nonatomic
,
strong
)
UILabel
*
dateLabel
;
// 发表时间
@property
(
nonatomic
,
strong
)
UILabel
*
remarkLabel
;
// 评语
@property
(
nonatomic
,
strong
)
UIImageView
*
arrowImageView
;
@property
(
nonatomic
,
strong
)
RankListModel
*
rankList
;
@end
This diff is collapsed.
Click to expand it.
redstar/Classes/Module/Function/WordOfMouth/Ranking/RankingList/Cell/RankingListCell.m
View file @
c694e41b
...
...
@@ -25,8 +25,6 @@
#pragma mark - Private Methods
-
(
void
)
setup
{
self
.
arrowImageView
.
image
=
[
UIImage
imageNamed
:
@"grey-trilateral_right"
];
self
.
shopNameButton
.
titleLabel
.
font
=
[
UIFont
systemFontOfSize
:
18
.
0
];
self
.
scoreLabel
.
textColor
=
kDateButtonTextColor
;
self
.
gradeView
.
backgroundColor
=
[
UIColor
clearColor
];
}
...
...
@@ -34,7 +32,7 @@
-
(
void
)
setRankList
:
(
RankListModel
*
)
rankList
{
_rankList
=
rankList
;
[
self
.
shopNameButton
setTitle
:[
NSString
stringWithFormat
:
@"%@"
,
rankList
.
store_name
]
forState
:
UIControlStateNormal
];
self
.
shopNameButton
.
text
=
[
NSString
stringWithFormat
:
@"%@"
,
rankList
.
store_name
];
self
.
scoreLabel
.
text
=
[
NSString
stringWithFormat
:
@"%@"
,
rankList
.
score
];
}
...
...
@@ -58,41 +56,20 @@
#pragma mark - Layz loading
-
(
UIImageView
*
)
arrowImageView
{
if
(
!
_arrowImageView
)
{
_arrowImageView
=
[[
UIImageView
alloc
]
init
];
_arrowImageView
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
[
self
.
contentView
insertSubview
:
_arrowImageView
aboveSubview
:
self
.
shopNameButton
];
NSLayoutConstraint
*
shoppingTop
=
[
NSLayoutConstraint
constraintWithItem
:
_arrowImageView
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
19
];
[
self
.
contentView
addConstraint
:
shoppingTop
];
NSLayoutConstraint
*
shoppingRight
=
[
NSLayoutConstraint
constraintWithItem
:
_arrowImageView
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
shopNameButton
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
10
];
[
self
.
contentView
addConstraint
:
shoppingRight
];
NSLayoutConstraint
*
shoppingWidth
=
[
NSLayoutConstraint
constraintWithItem
:
_arrowImageView
attribute
:
NSLayoutAttributeWidth
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
8
];
[
self
.
contentView
addConstraint
:
shoppingWidth
];
NSLayoutConstraint
*
shoppingHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_arrowImageView
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
12
];
[
self
.
contentView
addConstraint
:
shoppingHeight
];
}
return
_arrowImageView
;
}
-
(
UI
Button
*
)
shopNameButton
-
(
UI
Label
*
)
shopNameButton
{
if
(
!
_shopNameButton
)
{
_shopNameButton
=
[[
UI
Button
alloc
]
init
];
_shopNameButton
=
[[
UI
Label
alloc
]
init
];
_shopNameButton
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
_shopNameButton
.
t
itleLabel
.
textAlignment
=
NSTextAlignmentCente
r
;
[
_shopNameButton
setTitleColor
:
kShopNameTextColor
forState
:
UIControlStateNormal
];
_shopNameButton
.
t
extColor
=
kShopNameTextColo
r
;
_shopNameButton
.
font
=
[
UIFont
systemFontOfSize
:
17
.
0
];
[
self
.
contentView
addSubview
:
_shopNameButton
];
NSLayoutConstraint
*
shoppingTop
=
[
NSLayoutConstraint
constraintWithItem
:
_shopNameButton
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
1
];
[
self
.
contentView
addConstraint
:
shoppingTop
];
NSLayoutConstraint
*
shoppingLeft
=
[
NSLayoutConstraint
constraintWithItem
:
_shopNameButton
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
10
];
NSLayoutConstraint
*
shoppingLeft
=
[
NSLayoutConstraint
constraintWithItem
:
_shopNameButton
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
25
];
[
self
.
contentView
addConstraint
:
shoppingLeft
];
NSLayoutConstraint
*
shoppingRight
=
[
NSLayoutConstraint
constraintWithItem
:
_shopNameButton
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
scoreLabel
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
0
];
...
...
This diff is collapsed.
Click to expand it.
redstar/Classes/Module/Home/ViewController/HomeViewController.m
View file @
c694e41b
...
...
@@ -79,7 +79,6 @@
@property
(
nonatomic
,
strong
)
NSMutableArray
*
allQuestionArray
;
// 问题与知识
@property
(
nonatomic
,
strong
)
NSMutableArray
*
taskListDataArray
;
// 问题与知识
@property
(
nonatomic
,
strong
)
NSMutableArray
*
allRankListArray
;
@property
(
nonatomic
,
strong
)
NSArray
*
rankData
;
@end
@implementation
HomeViewController
...
...
@@ -97,28 +96,32 @@
self
.
titleArray
=
[
NSMutableArray
array
];
NSArray
*
permissions
=
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"permissions"
];
if
([
permissions
containsObject
:
@"500101"
]
||
[
permissions
containsObject
:
@"500102"
])
{
[
self
.
titleArray
addObject
:
@"口碑巡检"
];
[
self
requestInspectList
];
}
if
([
permissions
containsObject
:
@"500201"
])
{
[
self
.
titleArray
addObject
:
@"口碑排名"
];
[
self
requestRankingList
];
}
if
([
permissions
containsObject
:
@"500301"
]
||
[
permissions
containsObject
:
@"500302"
])
{
[
self
.
titleArray
addObject
:
@"图说口碑"
];
}
if
([
permissions
containsObject
:
@"500401"
]
||
[
permissions
containsObject
:
@"500402"
])
{
[
self
.
titleArray
addObject
:
@"口碑标准"
];
}
if
([
permissions
containsObject
:
@"500501"
]
||
[
permissions
containsObject
:
@"500502"
])
{
[
self
.
titleArray
addObject
:
@"问题知识"
];
[
self
requestQuestionList
];
}
if
([
permissions
containsObject
:
@"500101"
]
||
[
permissions
containsObject
:
@"500102"
])
{
[
self
.
titleArray
addObject
:
@"口碑巡检"
];
[
self
requestInspectList
];
}
if
([
permissions
containsObject
:
@"500301"
]
||
[
permissions
containsObject
:
@"500302"
])
{
//[self.titleArray addObject:@"图说口碑"];
}
if
([
permissions
containsObject
:
@"500401"
]
||
[
permissions
containsObject
:
@"500402"
])
{
//[self.titleArray addObject:@"口碑标准"];
}
if
([
permissions
containsObject
:
@"500701"
]
||
[
permissions
containsObject
:
@"500702"
])
{
[
self
.
titleArray
addObject
:
@"在线抽查"
];
//
[self.titleArray addObject:@"在线抽查"];
}
NSLog
(
@"self.titlar = %@"
,
self
.
titleArray
);
...
...
@@ -278,7 +281,7 @@
RankListModel
*
rankList
=
[
RankListModel
rankListModelWithDict
:
ListDict
];
[
tgArray
addObject
:
rankList
];
}
_
rankData
=
tgArray
;
_
allRankListArray
=
tgArray
;
[
self
.
tableView
reloadData
];
[
MBProgressHUD
hideHUDForView
:
self
.
view
animated
:
YES
];
...
...
@@ -396,12 +399,9 @@
UINavigationController
*
nav
;
if
(
button
.
tag
-
332892
==
0
)
{
PictureViewController
*
pictureVC
=
[[
PictureViewController
alloc
]
init
];
nav
=
[[
UINavigationController
alloc
]
initWithRootViewController
:
pictureVC
];
}
else
if
(
button
.
tag
-
332892
==
1
)
{
RankingListViewController
*
rankingListVC
=
[[
RankingListViewController
alloc
]
init
];
nav
=
[[
UINavigationController
alloc
]
initWithRootViewController
:
rankingListVC
];
}
else
if
(
button
.
tag
-
332892
==
2
)
{
}
else
if
(
button
.
tag
-
332892
==
1
)
{
QuestionViewController
*
questionVC
=
[[
QuestionViewController
alloc
]
init
];
nav
=
[[
UINavigationController
alloc
]
initWithRootViewController
:
questionVC
];
...
...
@@ -431,11 +431,9 @@
}
else
if
([
item
.
titleLabel
.
text
isEqualToString
:
@"图说口碑"
])
{
PictureViewController
*
pictureVC
=
[[
PictureViewController
alloc
]
init
];
nav
=
[[
UINavigationController
alloc
]
initWithRootViewController
:
pictureVC
];
}
else
if
([
item
.
titleLabel
.
text
isEqualToString
:
@"问题
与
知识"
])
{
}
else
if
([
item
.
titleLabel
.
text
isEqualToString
:
@"问题知识"
])
{
QuestionViewController
*
questionVC
=
[[
QuestionViewController
alloc
]
init
];
nav
=
[[
UINavigationController
alloc
]
initWithRootViewController
:
questionVC
];
}
else
if
([
item
.
titleLabel
.
text
isEqualToString
:
@"优秀案例"
])
{
return
;
}
else
if
([
item
.
titleLabel
.
text
isEqualToString
:
@"口碑排名"
]){
RankingListViewController
*
rankingListVC
=
[[
RankingListViewController
alloc
]
init
];
nav
=
[[
UINavigationController
alloc
]
initWithRootViewController
:
rankingListVC
];
...
...
@@ -450,148 +448,24 @@
}
// rank Cell
-
(
BOOL
)
cellIsSelected
:
(
NSIndexPath
*
)
indexPath
{
// Return whether the cell at the specified index path is selected or not
NSNumber
*
selectedIndex
=
[
_selectedIndexes
objectForKey
:
indexPath
];
return
selectedIndex
==
nil
?
FALSE
:
[
selectedIndex
boolValue
];
}
-
(
void
)
loadMoreInfo
:
(
UIButton
*
)
sender
{
RankingListCell
*
cell
=
(
RankingListCell
*
)[[
sender
superview
]
superview
];
cell
.
isDrop
=
!
cell
.
isDrop
;
NSIndexPath
*
path
=
[
self
.
tableView
indexPathForCell
:
cell
];
[
_tableView
deselectRowAtIndexPath
:
path
animated
:
TRUE
];
BOOL
isSelected
=
!
[
self
cellIsSelected
:
path
];
NSNumber
*
selectedIndex
=
[
NSNumber
numberWithBool
:
isSelected
];
[
_selectedIndexes
setObject
:
selectedIndex
forKey
:
path
];
if
(
cell
.
isDrop
)
{
[
UIView
animateWithDuration
:
0
.
2
animations
:
^
{
cell
.
arrowImageView
.
transform
=
CGAffineTransformIdentity
;
cell
.
arrowImageView
.
transform
=
CGAffineTransformMakeRotation
(
M_PI
/
2
);
}];
cell
.
someoneLabel
=
[[
UILabel
alloc
]
init
];
cell
.
someoneLabel
.
text
=
@"集团领导某总"
;
cell
.
someoneLabel
.
font
=
[
UIFont
systemFontOfSize
:
15
.
0
];
cell
.
someoneLabel
.
textAlignment
=
NSTextAlignmentCenter
;
cell
.
someoneLabel
.
textColor
=
kRankHeadTitleTextColor
;
cell
.
someoneLabel
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
[
cell
.
contentView
addSubview
:
cell
.
someoneLabel
];
cell
.
dateLabel
=
[[
UILabel
alloc
]
init
];
cell
.
dateLabel
.
text
=
@"2015-09-25 12:12:09"
;
cell
.
dateLabel
.
font
=
[
UIFont
systemFontOfSize
:
15
.
0
];
cell
.
dateLabel
.
textAlignment
=
NSTextAlignmentCenter
;
cell
.
dateLabel
.
textColor
=
kRankHeadTitleTextColor
;
cell
.
dateLabel
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
[
cell
.
contentView
addSubview
:
cell
.
dateLabel
];
cell
.
remarkLabel
=
[[
UILabel
alloc
]
init
];
cell
.
remarkLabel
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
cell
.
remarkLabel
.
text
=
@"评语:该店进步非常大,值得大家一起学习!"
;
cell
.
remarkLabel
.
font
=
[
UIFont
systemFontOfSize
:
15
.
0
];
cell
.
remarkLabel
.
textColor
=
kRankHeadTitleTextColor
;
[
cell
.
contentView
addSubview
:
cell
.
remarkLabel
];
NSLayoutConstraint
*
someoneTop
=
[
NSLayoutConstraint
constraintWithItem
:
cell
.
someoneLabel
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
cell
.
shopNameButton
attribute
:
NSLayoutAttributeBottom
multiplier
:
1
.
0
constant
:
0
];
[
cell
.
contentView
addConstraint
:
someoneTop
];
NSLayoutConstraint
*
someoneCenterX
=
[
NSLayoutConstraint
constraintWithItem
:
cell
.
someoneLabel
attribute
:
NSLayoutAttributeCenterX
relatedBy
:
NSLayoutRelationEqual
toItem
:
cell
.
shopNameButton
attribute
:
NSLayoutAttributeCenterX
multiplier
:
1
.
0
constant
:
5
];
[
cell
.
contentView
addConstraint
:
someoneCenterX
];
NSLayoutConstraint
*
someoneWidth
=
[
NSLayoutConstraint
constraintWithItem
:
cell
.
someoneLabel
attribute
:
NSLayoutAttributeWidth
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
100
];
[
cell
.
contentView
addConstraint
:
someoneWidth
];
NSLayoutConstraint
*
someoneHeight
=
[
NSLayoutConstraint
constraintWithItem
:
cell
.
someoneLabel
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
25
];
[
cell
.
contentView
addConstraint
:
someoneHeight
];
//
NSLayoutConstraint
*
dateTop
=
[
NSLayoutConstraint
constraintWithItem
:
cell
.
dateLabel
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
cell
.
shopNameButton
attribute
:
NSLayoutAttributeBottom
multiplier
:
1
.
0
constant
:
0
];
[
cell
.
contentView
addConstraint
:
dateTop
];
NSLayoutConstraint
*
dateLeft
=
[
NSLayoutConstraint
constraintWithItem
:
cell
.
dateLabel
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
cell
.
someoneLabel
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:
10
];
[
cell
.
contentView
addConstraint
:
dateLeft
];
NSLayoutConstraint
*
dateRight
=
[
NSLayoutConstraint
constraintWithItem
:
cell
.
dateLabel
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
cell
.
contentView
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:-
20
];
[
cell
.
contentView
addConstraint
:
dateRight
];
NSLayoutConstraint
*
dateHeight
=
[
NSLayoutConstraint
constraintWithItem
:
cell
.
dateLabel
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
25
];
[
cell
.
contentView
addConstraint
:
dateHeight
];
//
NSLayoutConstraint
*
remarkTop
=
[
NSLayoutConstraint
constraintWithItem
:
cell
.
remarkLabel
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
cell
.
someoneLabel
attribute
:
NSLayoutAttributeBottom
multiplier
:
1
.
0
constant
:
0
];
[
cell
.
contentView
addConstraint
:
remarkTop
];
NSLayoutConstraint
*
remarkLeft
=
[
NSLayoutConstraint
constraintWithItem
:
cell
.
remarkLabel
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
cell
.
someoneLabel
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
5
];
[
cell
.
contentView
addConstraint
:
remarkLeft
];
NSLayoutConstraint
*
remarkRight
=
[
NSLayoutConstraint
constraintWithItem
:
cell
.
remarkLabel
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
cell
.
contentView
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:-
20
];
[
cell
.
contentView
addConstraint
:
remarkRight
];
NSLayoutConstraint
*
remarkHeight
=
[
NSLayoutConstraint
constraintWithItem
:
cell
.
remarkLabel
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
25
];
[
cell
.
contentView
addConstraint
:
remarkHeight
];
}
else
{
[
UIView
animateWithDuration
:
0
.
2
animations
:
^
{
cell
.
arrowImageView
.
transform
=
CGAffineTransformIdentity
;
cell
.
arrowImageView
.
transform
=
CGAffineTransformMakeRotation
(
0
);
}];
if
(
cell
.
someoneLabel
)
{
[
cell
.
someoneLabel
removeFromSuperview
];
cell
.
someoneLabel
=
nil
;
}
if
(
cell
.
dateLabel
)
{
[
cell
.
dateLabel
removeFromSuperview
];
cell
.
dateLabel
=
nil
;
}
if
(
cell
.
remarkLabel
)
{
[
cell
.
remarkLabel
removeFromSuperview
];
cell
.
remarkLabel
=
nil
;
}
}
[
_tableView
beginUpdates
];
[
_tableView
endUpdates
];
}
#pragma mark - TableView Delegate/DataSource
-
(
NSInteger
)
numberOfSectionsInTableView
:
(
UITableView
*
)
tableView
{
return
4
+
_rankData
.
count
;
return
_titleArray
.
count
;
}
-
(
NSInteger
)
tableView
:
(
UITableView
*
)
tableView
numberOfRowsInSection
:
(
NSInteger
)
section
{
if
(
section
==
0
)
{
return
2
;
}
else
if
(
section
==
1
)
{
return
1
;
}
else
if
(
section
==
2
+
_rankData
.
count
)
{
return
_allRankListArray
.
count
+
1
;
}
else
if
(
section
==
1
)
{
return
_allQuestionArray
.
count
;
}
else
if
(
section
==
3
+
_rankData
.
count
)
{
return
_taskListDataArray
.
count
;
}
else
{
RankListModel
*
rankList
=
_rankData
[
section
-
2
];
NSInteger
count
=
rankList
.
isOpened
?
rankList
.
comments
.
count
:
0
;
return
count
;
return
_taskListDataArray
.
count
;
}
}
...
...
@@ -599,31 +473,26 @@
-
(
UITableViewCell
*
)
tableView
:
(
UITableView
*
)
tableView
cellForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
if
(
indexPath
.
section
==
0
)
{
// 图说口碑
PictureTableCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
kHomePictureList
Cell
];
if
(
indexPath
.
section
==
0
)
{
if
(
indexPath
.
row
==
0
)
{
HomeTitleTableCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
kHomeTitleTable
Cell
];
if
(
!
cell
)
{
cell
=
[[
PictureTableCell
alloc
]
initWithStyle
:
UITableViewCellStyleValue1
reuseIdentifier
:
kHomePictureList
Cell
];
cell
=
[[
HomeTitleTableCell
alloc
]
initWithStyle
:
UITableViewCellStyleValue1
reuseIdentifier
:
kHomeTitleTable
Cell
];
}
cell
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
cell
.
titleLabel
.
text
=
_test1Array
[
indexPath
.
row
];
cell
.
detailsLabel
.
text
=
_test2Array
[
indexPath
.
row
];
cell
.
dateLabel
.
text
=
[
NSString
stringWithFormat
:
@"发布时间: %@"
,
_test3Array
[
indexPath
.
row
]];
[
cell
.
thumbBtn
setTitle
:
@"220"
forState
:
UIControlStateNormal
];
[
cell
.
commentBtn
setTitle
:
@"18"
forState
:
UIControlStateNormal
];
return
cell
;
}
else
if
(
indexPath
.
section
==
1
)
{
HomeTitleTableCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
kHomeTitleTableCell
];
}
else
{
RankingListCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
kHomeRankingListCell
];
if
(
!
cell
)
{
cell
=
[[
HomeTitleTableCell
alloc
]
initWithStyle
:
UITableViewCellStyleValue1
reuseIdentifier
:
kHomeTitleTable
Cell
];
cell
=
[[
RankingListCell
alloc
]
initWithStyle
:
UITableViewCellStyleValue1
reuseIdentifier
:
kHomeRankingList
Cell
];
}
cell
.
rankList
=
_allRankListArray
[
indexPath
.
row
-
1
];
cell
.
gradeImageView
.
image
=
[
UIImage
imageNamed
:[
NSString
stringWithFormat
:
@"medal_0%d"
,
(
int
)
indexPath
.
row
]];
cell
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
return
cell
;
}
else
if
(
indexPath
.
section
==
2
+
_rankData
.
count
)
{
}
}
else
if
(
indexPath
.
section
==
1
)
{
// 问题与知识
QuestionListTableCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
kHomeQuestionListTableCell
];
if
(
!
cell
)
{
...
...
@@ -634,7 +503,7 @@
cell
.
question
=
question
;
return
cell
;
}
else
if
(
indexPath
.
section
==
3
+
_rankData
.
count
)
{
}
else
{
InspectListCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
kHomeInspectListCell
];
if
(
!
cell
)
{
cell
=
[[
InspectListCell
alloc
]
initWithStyle
:
UITableViewCellStyleValue1
reuseIdentifier
:
kHomeInspectListCell
];
...
...
@@ -647,15 +516,6 @@
image
=
[
image
resizableImageWithCapInsets
:
UIEdgeInsetsZero
resizingMode
:
UIImageResizingModeTile
];
cell
.
alreadyView
.
image
=
image
;
return
cell
;
}
else
{
RankCommentCell
*
cell
=
[
tableView
dequeueReusableCellWithIdentifier
:
kHomeRankingListCell
];
if
(
!
cell
)
{
cell
=
[[
RankCommentCell
alloc
]
initWithStyle
:
UITableViewCellStyleValue1
reuseIdentifier
:
kHomeRankingListCell
];
}
RankListModel
*
rankListModel
=
_rankData
[
indexPath
.
section
-
2
];
RankCommentModel
*
commentModel
=
rankListModel
.
comments
[
indexPath
.
row
];
cell
.
rankComment
=
commentModel
;
return
cell
;
}
}
...
...
@@ -663,21 +523,28 @@
-
(
void
)
tableView
:
(
UITableView
*
)
tableView
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
if
(
indexPath
.
section
==
0
)
{
PictureStoryViewController
*
storyVC
=
[[
PictureStoryViewController
alloc
]
init
];
UINavigationController
*
nav
=
[[
UINavigationController
alloc
]
initWithRootViewController
:
storyVC
];
[
nav
.
navigationBar
setBarTintColor
:
kNavigationBarColor
];
[
nav
.
navigationBar
setTitleTextAttributes
:[
NSDictionary
dictionaryWithObjectsAndKeys
:[
UIColor
whiteColor
],
NSForegroundColorAttributeName
,
nil
]];
[
self
presentViewController
:
nav
animated
:
YES
completion
:
nil
];
}
else
if
(
indexPath
.
section
==
1
)
{
if
(
indexPath
.
row
==
0
)
{
NSLog
(
@"不能点击"
);
}
else
{
RankListModel
*
rankList
=
_allRankListArray
[
indexPath
.
row
-
1
];
RankDetailViewController
*
rankDetailVC
=
[[
RankDetailViewController
alloc
]
init
];
rankDetailVC
.
indexRow
=
indexPath
.
section
-
2
;
rankDetailVC
.
uuid
=
rankList
.
uuid
;
rankDetailVC
.
store_uuid
=
rankList
.
store_uuid
;
rankDetailVC
.
storeAddress
=
rankList
.
storeAddress
;
rankDetailVC
.
storePictures
=
rankList
.
storePictures
;
self
.
hidesBottomBarWhenPushed
=
YES
;
[
self
.
navigationController
pushViewController
:
rankDetailVC
animated
:
YES
];
}
}
else
if
(
indexPath
.
section
==
2
+
_rankData
.
count
)
{
}
else
if
(
indexPath
.
section
==
1
)
{
QuestionDetailViewController
*
questionDetailVC
=
[[
QuestionDetailViewController
alloc
]
init
];
QuestionModel
*
question
=
self
.
allQuestionArray
[
indexPath
.
row
];
questionDetailVC
.
questionUuid
=
question
.
uuid
;
self
.
hidesBottomBarWhenPushed
=
YES
;
[
self
.
navigationController
pushViewController
:
questionDetailVC
animated
:
YES
];
}
else
if
(
indexPath
.
section
==
3
+
_rankData
.
count
)
{
}
else
{
InspectTaskViewController
*
inspectTaskVC
=
[[
InspectTaskViewController
alloc
]
init
];
TaskListModel
*
taskList
=
self
.
taskListDataArray
[
indexPath
.
row
];
...
...
@@ -687,72 +554,25 @@
self
.
hidesBottomBarWhenPushed
=
YES
;
[
self
.
navigationController
pushViewController
:
inspectTaskVC
animated
:
YES
];
}
else
{
RankListModel
*
rankList
=
_rankData
[
indexPath
.
section
-
2
];
RankDetailViewController
*
rankDetailVC
=
[[
RankDetailViewController
alloc
]
init
];
rankDetailVC
.
indexRow
=
indexPath
.
section
-
2
;
rankDetailVC
.
uuid
=
rankList
.
uuid
;
rankDetailVC
.
store_uuid
=
rankList
.
store_uuid
;
rankDetailVC
.
storeAddress
=
rankList
.
storeAddress
;
rankDetailVC
.
storePictures
=
rankList
.
storePictures
;
[
self
.
navigationController
pushViewController
:
rankDetailVC
animated
:
YES
];
}
}
// cell的高度
//- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
//{
// if (indexPath.section == 0) {
// return 123;
// } else if (indexPath.section == 1) {
// return 40;
// } else if (indexPath.section == 2 + _rankData.count) {
// return 120;
// } else if (indexPath.section == 3 + _rankData.count){
// return 145;
// } else {
// return 50;
// }
//}
// section高度
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForHeaderInSection
:
(
NSInteger
)
section
{
if
(
section
==
0
)
{
return
36
;
}
else
if
(
section
==
1
)
{
return
36
;
}
else
if
(
section
==
2
+
_rankData
.
count
)
{
return
36
;
}
else
if
(
section
==
3
+
_rankData
.
count
){
return
36
;
}
else
{
return
50
;
}
}
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForFooterInSection
:
(
NSInteger
)
section
{
if
(
section
==
0
)
{
return
10
;
}
else
if
(
section
==
1
)
{
return
CGFLOAT_MIN
;
}
else
if
(
section
==
1
+
_rankData
.
count
)
{
return
10
;
}
else
if
(
section
==
2
+
_rankData
.
count
)
{
return
10
;
}
else
if
(
section
==
3
+
_rankData
.
count
){
return
10
;
}
else
{
return
CGFLOAT_MIN
;
}
}
// 自定义section
-
(
UIView
*
)
tableView
:
(
UITableView
*
)
tableView
viewForHeaderInSection
:
(
NSInteger
)
section
{
if
(
section
==
0
||
section
==
1
||
section
==
2
+
_rankData
.
count
||
section
==
3
+
_rankData
.
count
)
{
// 创建sectionView
UIView
*
sectionView
=
[[
UIView
alloc
]
init
];
sectionView
.
userInteractionEnabled
=
YES
;
...
...
@@ -780,24 +600,9 @@
titleLabel
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
titleLabel
.
textColor
=
kPictureCellDetailsColor
;
titleLabel
.
font
=
[
UIFont
systemFontOfSize
:
17
.
0
];
titleLabel
.
text
=
_titleArray
[
section
];
if
(
section
==
0
)
{
titleLabel
.
text
=
@"问题知识"
;
//titleLabel.text = _titleArray[section];
}
else
if
(
section
==
1
)
{
titleLabel
.
text
=
@"问题知识"
;
// titleLabel.text = _titleArray[section];
}
else
if
(
section
==
2
+
_rankData
.
count
)
{
titleLabel
.
text
=
@"问题知识"
;
// titleLabel.text = _titleArray[section - _rankData.count];
}
else
{
titleLabel
.
text
=
@"问题知识"
;
// titleLabel.text = _titleArray[section - _rankData.count];
}
[
sectionView
addSubview
:
titleLabel
];
...
...
@@ -861,30 +666,21 @@
return
sectionView
;
}
else
{
RankListHeaderView
*
headerView
=
[
RankListHeaderView
headViewWithTableView
:
tableView
section
:
section
-
2
];
headerView
.
delegate
=
self
;
[
headerView
.
pushButton
addTarget
:
self
action
:
@selector
(
pushclick
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
headerView
.
rankListModel
=
_rankData
[
section
-
2
];
return
headerView
;
}
}
-
(
void
)
pushclick
:
(
UIButton
*
)
sender
{
NSInteger
section
=
sender
.
tag
-
kPushTag
;
RankListModel
*
rankList
=
_rankData
[
section
-
2
];
RankDetailViewController
*
rankDetailVC
=
[[
RankDetailViewController
alloc
]
init
];
rankDetailVC
.
indexRow
=
section
;
rankDetailVC
.
uuid
=
rankList
.
uuid
;
rankDetailVC
.
store_uuid
=
rankList
.
store_uuid
;
self
.
hidesBottomBarWhenPushed
=
YES
;
[
self
.
navigationController
pushViewController
:
rankDetailVC
animated
:
YES
];
}
//
- (void)pushclick:(UIButton *)sender
//
{
//
NSInteger section = sender.tag - kPushTag;
//
//
RankListModel *rankList = _rankData[section-2];
//
//
RankDetailViewController *rankDetailVC = [[RankDetailViewController alloc] init];
//
rankDetailVC.indexRow = section;
//
rankDetailVC.uuid = rankList.uuid;
//
rankDetailVC.store_uuid = rankList.store_uuid;
//
self.hidesBottomBarWhenPushed = YES;
//
[self.navigationController pushViewController:rankDetailVC animated:YES];
//
}
#pragma mark - lazy loading
-
(
UIImageView
*
)
bgImageView
...
...
@@ -1014,7 +810,7 @@
_tableView
.
tableFooterView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
40
)];
[
_tableView
registerClass
:[
PictureTableCell
class
]
forCellReuseIdentifier
:
kHomePictureListCell
];
[
_tableView
registerClass
:[
HomeTitleTableCell
class
]
forCellReuseIdentifier
:
kHomeTitleTableCell
];
[
_tableView
registerClass
:[
Rank
Commen
tCell
class
]
forCellReuseIdentifier
:
kHomeRankingListCell
];
[
_tableView
registerClass
:[
Rank
ingLis
tCell
class
]
forCellReuseIdentifier
:
kHomeRankingListCell
];
[
_tableView
registerClass
:[
QuestionListTableCell
class
]
forCellReuseIdentifier
:
kHomeQuestionListTableCell
];
[
self
.
view
addSubview
:
_tableView
];
...
...
This diff is collapsed.
Click to expand it.
redstar/Classes/Module/Mine/View/MineTableHeaderView.h
View file @
c694e41b
...
...
@@ -9,7 +9,7 @@
#import <UIKit/UIKit.h>
@interface
MineTableHeaderView
:
UIView
@property
(
nonatomic
,
strong
)
UIImageView
*
bgImageView
;
@property
(
nonatomic
,
strong
)
UILabel
*
companyLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
userLabel
;
@property
(
nonatomic
,
strong
)
UILabel
*
numberLabel
;
...
...
This diff is collapsed.
Click to expand it.
redstar/Classes/Module/Mine/View/MineTableHeaderView.m
View file @
c694e41b
...
...
@@ -13,7 +13,6 @@
@end
@implementation
MineTableHeaderView
#pragma mark - init
-
(
instancetype
)
initWithFrame
:(
CGRect
)
frame
{
...
...
@@ -29,35 +28,61 @@
#pragma mark - Private Methods
-
(
void
)
setup
{
self
.
userLabel
.
text
=
@"用户: 陈宁"
;
self
.
numberLabel
.
text
=
@"代码: 0005"
;
self
.
companyLabel
.
text
=
@"公司: 红星美凯龙家居集团股份有限公司"
;
self
.
bgImageView
.
image
=
[
UIImage
imageNamed
:
@"SystemImage"
];
self
.
userLabel
.
text
=
[
NSString
stringWithFormat
:
@"用户: %@"
,
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"user_name"
]];
self
.
numberLabel
.
text
=
[
NSString
stringWithFormat
:
@"代码: %@"
,
[[
NSUserDefaults
standardUserDefaults
]
objectForKey
:
@"user_code"
]];
self
.
companyLabel
.
text
=
@"公司: 红星美凯龙"
;
}
#pragma mark - lazy loading
-
(
UIImageView
*
)
bgImageView
{
if
(
!
_bgImageView
)
{
_bgImageView
=
[[
UIImageView
alloc
]
init
];
_bgImageView
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
[
self
addSubview
:
_bgImageView
];
NSLayoutConstraint
*
companyHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_bgImageView
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
150
];
[
self
addConstraint
:
companyHeight
];
NSLayoutConstraint
*
companyTop
=
[
NSLayoutConstraint
constraintWithItem
:
_bgImageView
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
0
];
[
self
addConstraint
:
companyTop
];
NSLayoutConstraint
*
companyRight
=
[
NSLayoutConstraint
constraintWithItem
:
_bgImageView
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:
0
];
[
self
addConstraint
:
companyRight
];
NSLayoutConstraint
*
companyLeft
=
[
NSLayoutConstraint
constraintWithItem
:
_bgImageView
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
0
];
[
self
addConstraint
:
companyLeft
];
}
return
_bgImageView
;
}
-
(
UILabel
*
)
companyLabel
{
if
(
!
_companyLabel
)
{
_companyLabel
=
[[
UILabel
alloc
]
init
];
}
_companyLabel
.
textAlignment
=
NSTextAlignmentCenter
;
_companyLabel
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
_companyLabel
.
minimumScaleFactor
=
.
5
f
;
_companyLabel
.
adjustsFontSizeToFitWidth
=
YES
;
_companyLabel
.
textColor
=
[
UIColor
whiteColor
];
[
self
addSubview
:
_companyLabel
];
[
self
.
bgImageView
addSubview
:
_companyLabel
];
NSLayoutConstraint
*
companyHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_companyLabel
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
45
];
[
self
addConstraint
:
companyHeight
];
[
self
.
bgImageView
addConstraint
:
companyHeight
];
NSLayoutConstraint
*
companyTop
=
[
NSLayoutConstraint
constraintWithItem
:
_companyLabel
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
40
];
[
self
addConstraint
:
companyTop
];
NSLayoutConstraint
*
companyTop
=
[
NSLayoutConstraint
constraintWithItem
:
_companyLabel
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
bgImageView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
40
];
[
self
.
bgImageView
addConstraint
:
companyTop
];
NSLayoutConstraint
*
companyRight
=
[
NSLayoutConstraint
constraintWithItem
:
_companyLabel
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:-
20
];
[
self
addConstraint
:
companyRight
];
NSLayoutConstraint
*
companyRight
=
[
NSLayoutConstraint
constraintWithItem
:
_companyLabel
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
bgImageView
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:-
20
];
[
self
.
bgImageView
addConstraint
:
companyRight
];
NSLayoutConstraint
*
companyLeft
=
[
NSLayoutConstraint
constraintWithItem
:
_companyLabel
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
20
];
[
self
addConstraint
:
companyLeft
];
NSLayoutConstraint
*
companyLeft
=
[
NSLayoutConstraint
constraintWithItem
:
_companyLabel
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
bgImageView
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
20
];
[
self
.
bgImageView
addConstraint
:
companyLeft
];
return
_companyLabel
;
}
...
...
@@ -70,22 +95,22 @@
_userLabel
.
textAlignment
=
NSTextAlignmentCenter
;
_userLabel
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
_userLabel
.
textColor
=
[
UIColor
whiteColor
];
[
self
addSubview
:
_userLabel
];
[
self
.
bgImageView
addSubview
:
_userLabel
];
NSLayoutConstraint
*
userHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_userLabel
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
35
];
[
_userLabel
addConstraint
:
userHeight
];
NSLayoutConstraint
*
userLeft
=
[
NSLayoutConstraint
constraintWithItem
:
_userLabel
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
0
];
[
self
addConstraint
:
userLeft
];
NSLayoutConstraint
*
userLeft
=
[
NSLayoutConstraint
constraintWithItem
:
_userLabel
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
bgImageView
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
0
];
[
self
.
bgImageView
addConstraint
:
userLeft
];
NSLayoutConstraint
*
userRight
=
[
NSLayoutConstraint
constraintWithItem
:
_userLabel
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
numberLabel
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
0
];
[
self
addConstraint
:
userRight
];
[
self
.
bgImageView
addConstraint
:
userRight
];
NSLayoutConstraint
*
userBottom
=
[
NSLayoutConstraint
constraintWithItem
:
_userLabel
attribute
:
NSLayoutAttributeBottom
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
attribute
:
NSLayoutAttributeBottom
multiplier
:
1
.
0
constant
:
0
];
[
self
addConstraint
:
userBottom
];
NSLayoutConstraint
*
userBottom
=
[
NSLayoutConstraint
constraintWithItem
:
_userLabel
attribute
:
NSLayoutAttributeBottom
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
bgImageView
attribute
:
NSLayoutAttributeBottom
multiplier
:
1
.
0
constant
:
0
];
[
self
.
bgImageView
addConstraint
:
userBottom
];
NSLayoutConstraint
*
userWidth
=
[
NSLayoutConstraint
constraintWithItem
:
_userLabel
attribute
:
NSLayoutAttributeWidth
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
numberLabel
attribute
:
NSLayoutAttributeWidth
multiplier
:
1
.
0
constant
:
0
];
[
self
addConstraint
:
userWidth
];
[
self
.
bgImageView
addConstraint
:
userWidth
];
return
_userLabel
;
}
...
...
@@ -98,20 +123,20 @@
_numberLabel
.
textAlignment
=
NSTextAlignmentCenter
;
_numberLabel
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
_numberLabel
.
textColor
=
[
UIColor
whiteColor
];
[
self
addSubview
:
_numberLabel
];
[
self
.
bgImageView
addSubview
:
_numberLabel
];
NSLayoutConstraint
*
numberHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_numberLabel
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
35
];
[
_numberLabel
addConstraint
:
numberHeight
];
NSLayoutConstraint
*
numberLeft
=
[
NSLayoutConstraint
constraintWithItem
:
_numberLabel
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
_userLabel
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:
0
];
[
self
addConstraint
:
numberLeft
];
[
self
.
bgImageView
addConstraint
:
numberLeft
];
NSLayoutConstraint
*
numberRight
=
[
NSLayoutConstraint
constraintWithItem
:
_numberLabel
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:
0
];
[
self
addConstraint
:
numberRight
];
NSLayoutConstraint
*
numberRight
=
[
NSLayoutConstraint
constraintWithItem
:
_numberLabel
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
bgImageView
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:
0
];
[
self
.
bgImageView
addConstraint
:
numberRight
];
NSLayoutConstraint
*
numberBottom
=
[
NSLayoutConstraint
constraintWithItem
:
_numberLabel
attribute
:
NSLayoutAttributeBottom
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
attribute
:
NSLayoutAttributeBottom
multiplier
:
1
.
0
constant
:
0
];
[
self
addConstraint
:
numberBottom
];
NSLayoutConstraint
*
numberBottom
=
[
NSLayoutConstraint
constraintWithItem
:
_numberLabel
attribute
:
NSLayoutAttributeBottom
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
bgImageView
attribute
:
NSLayoutAttributeBottom
multiplier
:
1
.
0
constant
:
0
];
[
self
.
bgImageView
addConstraint
:
numberBottom
];
return
_numberLabel
;
}
...
...
This diff is collapsed.
Click to expand it.
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