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
16252f9d
Commit
16252f9d
authored
Oct 31, 2015
by
admin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改轮播图 添加点击事件
parent
3a46e680
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
274 additions
and
115 deletions
+274
-115
UserInterfaceState.xcuserstate
...userdata/admin.xcuserdatad/UserInterfaceState.xcuserstate
+0
-0
Contents.json
redstar/Assets.xcassets/Rank/Contents.json
+6
-0
Contents.json
...xcassets/Rank/blue-trilateral_down.imageset/Contents.json
+22
-0
blue-trilateral_down@2x.png
...blue-trilateral_down.imageset/blue-trilateral_down@2x.png
+0
-0
blue-trilateral_down@3x.png
...blue-trilateral_down.imageset/blue-trilateral_down@3x.png
+0
-0
Contents.json
...cassets/Rank/grey-trilateral_right.imageset/Contents.json
+22
-0
grey-trilateral_right@2x.png
...ey-trilateral_right.imageset/grey-trilateral_right@2x.png
+0
-0
grey-trilateral_right@3x.png
...ey-trilateral_right.imageset/grey-trilateral_right@3x.png
+0
-0
Contents.json
redstar/Assets.xcassets/Rank/medal_01.imageset/Contents.json
+22
-0
medal_red@2x.png
...r/Assets.xcassets/Rank/medal_01.imageset/medal_red@2x.png
+0
-0
medal_red@3x.png
...r/Assets.xcassets/Rank/medal_01.imageset/medal_red@3x.png
+0
-0
Contents.json
redstar/Assets.xcassets/Rank/medal_02.imageset/Contents.json
+22
-0
medal_orange@2x.png
...ssets.xcassets/Rank/medal_02.imageset/medal_orange@2x.png
+0
-0
medal_orange@3x.png
...ssets.xcassets/Rank/medal_02.imageset/medal_orange@3x.png
+0
-0
Contents.json
redstar/Assets.xcassets/Rank/medal_03.imageset/Contents.json
+22
-0
medal_blue@2x.png
.../Assets.xcassets/Rank/medal_03.imageset/medal_blue@2x.png
+0
-0
medal_blue@3x.png
.../Assets.xcassets/Rank/medal_03.imageset/medal_blue@3x.png
+0
-0
Constant.h
redstar/Classes/Macro/Constant.h
+13
-0
RankingListCell.h
...on/WordOfMouth/Ranking/RankingList/Cell/RankingListCell.h
+1
-0
RankingListCell.m
...on/WordOfMouth/Ranking/RankingList/Cell/RankingListCell.m
+39
-17
RankingListViewController.m
...ng/RankingList/ViewController/RankingListViewController.m
+76
-30
HomeHeaderView.m
redstar/Classes/Module/Home/View/HomeHeaderView.m
+29
-68
No files found.
redstar.xcworkspace/xcuserdata/admin.xcuserdatad/UserInterfaceState.xcuserstate
View file @
16252f9d
No preview for this file type
redstar/Assets.xcassets/Rank/Contents.json
0 → 100644
View file @
16252f9d
{
"info"
:
{
"version"
:
1
,
"author"
:
"xcode"
}
}
\ No newline at end of file
redstar/Assets.xcassets/Rank/blue-trilateral_down.imageset/Contents.json
0 → 100644
View file @
16252f9d
{
"images"
:
[
{
"idiom"
:
"universal"
,
"scale"
:
"1x"
},
{
"idiom"
:
"universal"
,
"filename"
:
"blue-trilateral_down@2x.png"
,
"scale"
:
"2x"
},
{
"idiom"
:
"universal"
,
"filename"
:
"blue-trilateral_down@3x.png"
,
"scale"
:
"3x"
}
],
"info"
:
{
"version"
:
1
,
"author"
:
"xcode"
}
}
\ No newline at end of file
redstar/Assets.xcassets/Rank/blue-trilateral_down.imageset/blue-trilateral_down@2x.png
0 → 100644
View file @
16252f9d
1.16 KB
redstar/Assets.xcassets/Rank/blue-trilateral_down.imageset/blue-trilateral_down@3x.png
0 → 100644
View file @
16252f9d
1.29 KB
redstar/Assets.xcassets/Rank/grey-trilateral_right.imageset/Contents.json
0 → 100644
View file @
16252f9d
{
"images"
:
[
{
"idiom"
:
"universal"
,
"scale"
:
"1x"
},
{
"idiom"
:
"universal"
,
"filename"
:
"grey-trilateral_right@2x.png"
,
"scale"
:
"2x"
},
{
"idiom"
:
"universal"
,
"filename"
:
"grey-trilateral_right@3x.png"
,
"scale"
:
"3x"
}
],
"info"
:
{
"version"
:
1
,
"author"
:
"xcode"
}
}
\ No newline at end of file
redstar/Assets.xcassets/Rank/grey-trilateral_right.imageset/grey-trilateral_right@2x.png
0 → 100644
View file @
16252f9d
1.11 KB
redstar/Assets.xcassets/Rank/grey-trilateral_right.imageset/grey-trilateral_right@3x.png
0 → 100644
View file @
16252f9d
1.25 KB
redstar/Assets.xcassets/Rank/medal_01.imageset/Contents.json
0 → 100644
View file @
16252f9d
{
"images"
:
[
{
"idiom"
:
"universal"
,
"scale"
:
"1x"
},
{
"idiom"
:
"universal"
,
"filename"
:
"medal_red@2x.png"
,
"scale"
:
"2x"
},
{
"idiom"
:
"universal"
,
"filename"
:
"medal_red@3x.png"
,
"scale"
:
"3x"
}
],
"info"
:
{
"version"
:
1
,
"author"
:
"xcode"
}
}
\ No newline at end of file
redstar/Assets.xcassets/Rank/medal_01.imageset/medal_red@2x.png
0 → 100644
View file @
16252f9d
2.57 KB
redstar/Assets.xcassets/Rank/medal_01.imageset/medal_red@3x.png
0 → 100644
View file @
16252f9d
3.44 KB
redstar/Assets.xcassets/Rank/medal_02.imageset/Contents.json
0 → 100644
View file @
16252f9d
{
"images"
:
[
{
"idiom"
:
"universal"
,
"scale"
:
"1x"
},
{
"idiom"
:
"universal"
,
"filename"
:
"medal_orange@2x.png"
,
"scale"
:
"2x"
},
{
"idiom"
:
"universal"
,
"filename"
:
"medal_orange@3x.png"
,
"scale"
:
"3x"
}
],
"info"
:
{
"version"
:
1
,
"author"
:
"xcode"
}
}
\ No newline at end of file
redstar/Assets.xcassets/Rank/medal_02.imageset/medal_orange@2x.png
0 → 100644
View file @
16252f9d
2.83 KB
redstar/Assets.xcassets/Rank/medal_02.imageset/medal_orange@3x.png
0 → 100644
View file @
16252f9d
3.83 KB
redstar/Assets.xcassets/Rank/medal_03.imageset/Contents.json
0 → 100644
View file @
16252f9d
{
"images"
:
[
{
"idiom"
:
"universal"
,
"scale"
:
"1x"
},
{
"idiom"
:
"universal"
,
"filename"
:
"medal_blue@2x.png"
,
"scale"
:
"2x"
},
{
"idiom"
:
"universal"
,
"filename"
:
"medal_blue@3x.png"
,
"scale"
:
"3x"
}
],
"info"
:
{
"version"
:
1
,
"author"
:
"xcode"
}
}
\ No newline at end of file
redstar/Assets.xcassets/Rank/medal_03.imageset/medal_blue@2x.png
0 → 100644
View file @
16252f9d
3.03 KB
redstar/Assets.xcassets/Rank/medal_03.imageset/medal_blue@3x.png
0 → 100644
View file @
16252f9d
4.17 KB
redstar/Classes/Macro/Constant.h
View file @
16252f9d
...
...
@@ -46,6 +46,19 @@
// #666666
#define kHomeItemTextColor [UIColor colorWithRed:102 / 255.0 green:102 / 255.0 blue:102 / 255.0 alpha:1.0]
// RankingList
// #999999
#define kRankHeadTitleTextColor [UIColor colorWithRed:153 / 255.0 green:153 / 255.0 blue:153 / 255.0 alpha:1.0]
// #006fbc
#define kDateButtonTextColor [UIColor colorWithRed:0 / 255.0 green:111 / 255.0 blue:188 / 255.0 alpha:1.0]
#define kShopCountTextColor [UIColor colorWithRed:255 / 255.0 green:0 / 255.0 blue:0 / 255.0 alpha:1.0]
// #006fbc
#define kScoreTextColor [UIColor colorWithRed:0 / 255.0 green:111 / 255.0 blue:188 / 255.0 alpha:1.0]
// #444444
#define kShopNameTextColor [UIColor colorWithRed:68 / 255.0 green:68 / 255.0 blue:68 / 255.0 alpha:1.0]
// #fe6903
#define kGradeNumberTextColor [UIColor colorWithRed:254 / 255.0 green:105 / 255.0 blue:3 / 255.0 alpha:1.0]
#import "UIView+Extension.h"
#endif
/* Constant_h */
redstar/Classes/Module/Function/WordOfMouth/Ranking/RankingList/Cell/RankingListCell.h
View file @
16252f9d
...
...
@@ -25,4 +25,5 @@ typedef enum ScoreState : NSUInteger {
@property
(
nonatomic
,
strong
)
UILabel
*
someoneLabel
;
// 发表评语的人
@property
(
nonatomic
,
strong
)
UILabel
*
dateLabel
;
// 发表时间
@property
(
nonatomic
,
strong
)
UILabel
*
remarkLabel
;
// 评语
@property
(
nonatomic
,
strong
)
UIImageView
*
arrowImageView
;
@end
redstar/Classes/Module/Function/WordOfMouth/Ranking/RankingList/Cell/RankingListCell.m
View file @
16252f9d
...
...
@@ -24,11 +24,10 @@
#pragma mark - Private Methods
-
(
void
)
setup
{
[
self
.
shopNameButton
setTitle
:
@"上海真北店"
forState
:
UIControlStateNormal
];
self
.
scoreLabel
.
text
=
@"99分"
;
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
];
}
-
(
void
)
setSelected
:
(
BOOL
)
selected
animated
:
(
BOOL
)
animated
{
...
...
@@ -42,32 +41,55 @@
{
_scoreState
=
scoreState
;
if
(
self
.
scoreState
==
ScoreStateHigh
)
{
self
.
gradeImageView
.
backgroundColor
=
[
UIColor
gray
Color
];
self
.
gradeImageView
.
backgroundColor
=
[
UIColor
clear
Color
];
}
else
{
self
.
gradeLabel
.
text
=
@"4"
;
self
.
gradeLabel
.
text
Color
=
kScoreTextColor
;
}
}
#pragma mark - Layz loading
-
(
UIImageView
*
)
arrowImageView
{
if
(
!
_arrowImageView
)
{
_arrowImageView
=
[[
UIImageView
alloc
]
init
];
_arrowImageView
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
[
self
.
contentView
insertSubview
:
_arrowImageView
aboveSubview
:
self
.
shopNameButton
];
NSLayoutConstraint
*
shoppingTop
=
[
NSLayoutConstraint
constraintWithItem
:
_arrowImageView
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
19
];
[
self
.
contentView
addConstraint
:
shoppingTop
];
NSLayoutConstraint
*
shoppingRight
=
[
NSLayoutConstraint
constraintWithItem
:
_arrowImageView
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
shopNameButton
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
10
];
[
self
.
contentView
addConstraint
:
shoppingRight
];
NSLayoutConstraint
*
shoppingWidth
=
[
NSLayoutConstraint
constraintWithItem
:
_arrowImageView
attribute
:
NSLayoutAttributeWidth
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
8
];
[
self
.
contentView
addConstraint
:
shoppingWidth
];
NSLayoutConstraint
*
shoppingHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_arrowImageView
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
12
];
[
self
.
contentView
addConstraint
:
shoppingHeight
];
}
return
_arrowImageView
;
}
-
(
UIButton
*
)
shopNameButton
{
if
(
!
_shopNameButton
)
{
_shopNameButton
=
[[
UIButton
alloc
]
init
];
_shopNameButton
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
_shopNameButton
.
titleLabel
.
textAlignment
=
NSTextAlignmentCenter
;
[
_shopNameButton
setTitleColor
:
[
UIColor
blackColor
]
forState
:
UIControlStateNormal
];
[
_shopNameButton
setTitleColor
:
kShopNameTextColor
forState
:
UIControlStateNormal
];
[
self
.
contentView
addSubview
:
_shopNameButton
];
NSLayoutConstraint
*
shoppingTop
=
[
NSLayoutConstraint
constraintWithItem
:
_shopNameButton
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
0
];
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
:
0
];
NSLayoutConstraint
*
shoppingLeft
=
[
NSLayoutConstraint
constraintWithItem
:
_shopNameButton
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
1
0
];
[
self
.
contentView
addConstraint
:
shoppingLeft
];
NSLayoutConstraint
*
shoppingRight
=
[
NSLayoutConstraint
constraintWithItem
:
_shopNameButton
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
scoreLabel
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
0
];
[
self
.
contentView
addConstraint
:
shoppingRight
];
NSLayoutConstraint
*
shoppingHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_shopNameButton
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
4
0
];
NSLayoutConstraint
*
shoppingHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_shopNameButton
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
5
0
];
[
self
.
contentView
addConstraint
:
shoppingHeight
];
NSLayoutConstraint
*
shoppingWidth
=
[
NSLayoutConstraint
constraintWithItem
:
_shopNameButton
attribute
:
NSLayoutAttributeWidth
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
scoreLabel
attribute
:
NSLayoutAttributeWidth
multiplier
:
1
.
2
constant
:
0
];
...
...
@@ -84,9 +106,10 @@
_scoreLabel
=
[[
UILabel
alloc
]
init
];
_scoreLabel
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
_scoreLabel
.
textAlignment
=
NSTextAlignmentCenter
;
_scoreLabel
.
font
=
[
UIFont
systemFontOfSize
:
17
.
0
];
[
self
.
contentView
addSubview
:
_scoreLabel
];
NSLayoutConstraint
*
scoreTop
=
[
NSLayoutConstraint
constraintWithItem
:
_scoreLabel
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
0
];
NSLayoutConstraint
*
scoreTop
=
[
NSLayoutConstraint
constraintWithItem
:
_scoreLabel
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
1
];
[
self
.
contentView
addConstraint
:
scoreTop
];
NSLayoutConstraint
*
scoreRight
=
[
NSLayoutConstraint
constraintWithItem
:
_scoreLabel
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
gradeView
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
0
];
...
...
@@ -95,7 +118,7 @@
NSLayoutConstraint
*
scoreWidth
=
[
NSLayoutConstraint
constraintWithItem
:
_scoreLabel
attribute
:
NSLayoutAttributeWidth
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
gradeView
attribute
:
NSLayoutAttributeWidth
multiplier
:
1
.
0
constant
:
0
];
[
self
.
contentView
addConstraint
:
scoreWidth
];
NSLayoutConstraint
*
scoreHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_scoreLabel
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
4
0
];
NSLayoutConstraint
*
scoreHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_scoreLabel
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
5
0
];
[
self
.
contentView
addConstraint
:
scoreHeight
];
}
return
_scoreLabel
;
...
...
@@ -110,13 +133,13 @@
}
//
NSLayoutConstraint
*
gradeTop
=
[
NSLayoutConstraint
constraintWithItem
:
_gradeView
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
0
];
NSLayoutConstraint
*
gradeTop
=
[
NSLayoutConstraint
constraintWithItem
:
_gradeView
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
2
];
[
self
.
contentView
addConstraint
:
gradeTop
];
NSLayoutConstraint
*
gradeRight
=
[
NSLayoutConstraint
constraintWithItem
:
_gradeView
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
contentView
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:
0
];
[
self
.
contentView
addConstraint
:
gradeRight
];
NSLayoutConstraint
*
gradeHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_gradeView
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
4
0
];
NSLayoutConstraint
*
gradeHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_gradeView
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
5
0
];
[
self
.
contentView
addConstraint
:
gradeHeight
];
return
_gradeView
;
...
...
@@ -128,7 +151,6 @@
_gradeLabel
=
[[
UILabel
alloc
]
init
];
_gradeLabel
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
_gradeLabel
.
textAlignment
=
NSTextAlignmentCenter
;
[
self
.
gradeView
addSubview
:
_gradeLabel
];
//
...
...
@@ -161,10 +183,10 @@
NSLayoutConstraint
*
gradeCenterY
=
[
NSLayoutConstraint
constraintWithItem
:
_gradeImageView
attribute
:
NSLayoutAttributeCenterY
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
gradeView
attribute
:
NSLayoutAttributeCenterY
multiplier
:
1
.
0
constant
:
0
];
[
self
.
gradeView
addConstraint
:
gradeCenterY
];
NSLayoutConstraint
*
gradeWidth
=
[
NSLayoutConstraint
constraintWithItem
:
_gradeImageView
attribute
:
NSLayoutAttributeWidth
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
3
0
];
NSLayoutConstraint
*
gradeWidth
=
[
NSLayoutConstraint
constraintWithItem
:
_gradeImageView
attribute
:
NSLayoutAttributeWidth
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
3
5
];
[
self
.
gradeView
addConstraint
:
gradeWidth
];
NSLayoutConstraint
*
gradeHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_gradeImageView
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
3
0
];
NSLayoutConstraint
*
gradeHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_gradeImageView
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
3
4
];
[
self
.
gradeView
addConstraint
:
gradeHeight
];
}
return
_gradeImageView
;
...
...
redstar/Classes/Module/Function/WordOfMouth/Ranking/RankingList/ViewController/RankingListViewController.m
View file @
16252f9d
...
...
@@ -15,7 +15,7 @@
@interface
RankingListViewController
()
<
UITableViewDataSource
,
UITableViewDelegate
>
@property
(
nonatomic
,
strong
)
UITableView
*
tableView
;
@property
(
nonatomic
,
strong
)
UIView
*
headView
;
@property
(
nonatomic
,
strong
)
UIView
*
lineView1
;
@property
(
nonatomic
,
strong
)
NSMutableDictionary
*
selectedIndexes
;
@end
...
...
@@ -57,7 +57,8 @@
self
.
tableView
.
tableHeaderView
=
self
.
headView
;
self
.
pointLabel1
.
text
=
@"月度排名"
;
self
.
pointLabel2
.
text
=
@"参与商家数量"
;
self
.
lineView
.
backgroundColor
=
kLineColor
;
self
.
lineView
.
backgroundColor
=
kSeparateLineColor
;
self
.
lineView1
.
backgroundColor
=
kSeparateLineColor
;
self
.
shoppingCountLabel
.
textAlignment
=
NSTextAlignmentCenter
;
[
self
.
dateButton
addTarget
:
self
action
:
@selector
(
changeDateClick
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
}
...
...
@@ -87,11 +88,18 @@
[
_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
=
[
UIColor
grayColor
]
;
cell
.
someoneLabel
.
textColor
=
kRankHeadTitleTextColor
;
cell
.
someoneLabel
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
[
cell
.
contentView
addSubview
:
cell
.
someoneLabel
];
...
...
@@ -99,7 +107,7 @@
cell
.
dateLabel
.
text
=
@"2015-09-25 12:12:09"
;
cell
.
dateLabel
.
font
=
[
UIFont
systemFontOfSize
:
15
.
0
];
cell
.
dateLabel
.
textAlignment
=
NSTextAlignmentCenter
;
cell
.
dateLabel
.
textColor
=
[
UIColor
grayColor
]
;
cell
.
dateLabel
.
textColor
=
kRankHeadTitleTextColor
;
cell
.
dateLabel
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
[
cell
.
contentView
addSubview
:
cell
.
dateLabel
];
...
...
@@ -107,8 +115,7 @@
cell
.
remarkLabel
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
cell
.
remarkLabel
.
text
=
@"评语:该店进步非常大,值得大家一起学习!"
;
cell
.
remarkLabel
.
font
=
[
UIFont
systemFontOfSize
:
15
.
0
];
cell
.
remarkLabel
.
textAlignment
=
NSTextAlignmentCenter
;
cell
.
remarkLabel
.
textColor
=
[
UIColor
grayColor
];
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
];
...
...
@@ -140,7 +147,7 @@
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
:
0
];
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
];
...
...
@@ -150,6 +157,12 @@
[
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
;
...
...
@@ -186,10 +199,21 @@
// 前三个店名次显示图片
if
(
indexPath
.
row
<
3
)
{
cell
.
scoreState
=
ScoreStateHigh
;
NSString
*
imageName
=
[
NSString
stringWithFormat
:
@"medal_0%ld"
,
(
long
)(
indexPath
.
row
+
1
)];
cell
.
gradeImageView
.
image
=
[
UIImage
imageNamed
:
imageName
];
}
else
{
cell
.
scoreState
=
ScoreStateLow
;
NSString
*
rankStr
=
[
NSString
stringWithFormat
:
@"第 %ld 名"
,
(
long
)(
indexPath
.
row
+
1
)];
NSMutableAttributedString
*
rankAttr
=
[[
NSMutableAttributedString
alloc
]
initWithString
:
rankStr
];
[
rankAttr
addAttributes
:@{
NSForegroundColorAttributeName
:
kRankHeadTitleTextColor
,
NSFontAttributeName
:
[
UIFont
systemFontOfSize
:
14
.
0
f
]}
range
:
NSMakeRange
(
0
,
1
)];
[
rankAttr
addAttributes
:@{
NSForegroundColorAttributeName
:
kGradeNumberTextColor
}
range
:
NSMakeRange
(
1
,
rankStr
.
length
-
2
)];
[
rankAttr
addAttribute
:
NSFontAttributeName
value
:[
UIFont
fontWithName
:
@"Arial-BoldMT"
size
:
18
.
0
]
range
:
NSMakeRange
(
1
,
rankStr
.
length
-
2
)];
[
rankAttr
addAttributes
:@{
NSForegroundColorAttributeName
:
kRankHeadTitleTextColor
,
NSFontAttributeName
:
[
UIFont
systemFontOfSize
:
14
.
0
f
]}
range
:
NSMakeRange
(
rankStr
.
length
-
1
,
1
)];
[
cell
.
gradeLabel
setAttributedText
:
rankAttr
];
}
[
cell
.
shopNameButton
setTitle
:
@"上海真北店"
forState
:
UIControlStateNormal
];
cell
.
scoreLabel
.
text
=
@"98"
;
cell
.
selectionStyle
=
UITableViewCellSelectionStyleNone
;
// 添加点击事件
[
cell
.
shopNameButton
addTarget
:
self
action
:
@selector
(
loadMoreInfo
:
)
forControlEvents
:
UIControlEventTouchUpInside
];
...
...
@@ -208,10 +232,10 @@
-
(
CGFloat
)
tableView
:
(
UITableView
*
)
tableView
heightForRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
if
([
self
cellIsSelected
:
indexPath
])
{
return
90
;
return
108
;
}
return
4
0
;
return
5
0
;
}
// section高度
...
...
@@ -230,14 +254,14 @@
{
// 创建sectionView
UIView
*
sectionView
=
[[
UIView
alloc
]
init
];
sectionView
.
backgroundColor
=
k
Mine
BackGroundColor
;
sectionView
.
backgroundColor
=
k
Section
BackGroundColor
;
// 商场
UILabel
*
shoppingLabel
=
[[
UILabel
alloc
]
init
];
shoppingLabel
.
text
=
@"商场名称"
;
shoppingLabel
.
textAlignment
=
NSTextAlignmentCenter
;
shoppingLabel
.
textColor
=
k
HomeSection
TitleTextColor
;
shoppingLabel
.
font
=
[
UIFont
systemFontOfSize
:
1
6
.
0
];
shoppingLabel
.
textColor
=
k
RankHead
TitleTextColor
;
shoppingLabel
.
font
=
[
UIFont
systemFontOfSize
:
1
7
.
0
];
shoppingLabel
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
[
sectionView
addSubview
:
shoppingLabel
];
...
...
@@ -245,8 +269,8 @@
UILabel
*
scoreLabel
=
[[
UILabel
alloc
]
init
];
scoreLabel
.
text
=
@"总分"
;
scoreLabel
.
textAlignment
=
NSTextAlignmentCenter
;
scoreLabel
.
textColor
=
k
HomeSection
TitleTextColor
;
scoreLabel
.
font
=
[
UIFont
systemFontOfSize
:
1
6
.
0
];
scoreLabel
.
textColor
=
k
RankHead
TitleTextColor
;
scoreLabel
.
font
=
[
UIFont
systemFontOfSize
:
1
7
.
0
];
scoreLabel
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
[
sectionView
addSubview
:
scoreLabel
];
...
...
@@ -254,13 +278,13 @@
UILabel
*
gradeLabel
=
[[
UILabel
alloc
]
init
];
gradeLabel
.
text
=
@"排名"
;
gradeLabel
.
textAlignment
=
NSTextAlignmentCenter
;
gradeLabel
.
textColor
=
k
HomeSection
TitleTextColor
;
gradeLabel
.
font
=
[
UIFont
systemFontOfSize
:
1
6
.
0
];
gradeLabel
.
textColor
=
k
RankHead
TitleTextColor
;
gradeLabel
.
font
=
[
UIFont
systemFontOfSize
:
1
7
.
0
];
gradeLabel
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
[
sectionView
addSubview
:
gradeLabel
];
//
NSLayoutConstraint
*
shoppingTop
=
[
NSLayoutConstraint
constraintWithItem
:
shoppingLabel
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
sectionView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
0
];
NSLayoutConstraint
*
shoppingTop
=
[
NSLayoutConstraint
constraintWithItem
:
shoppingLabel
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
sectionView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
5
];
[
sectionView
addConstraint
:
shoppingTop
];
NSLayoutConstraint
*
shoppingLeft
=
[
NSLayoutConstraint
constraintWithItem
:
shoppingLabel
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
sectionView
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
0
];
...
...
@@ -276,7 +300,7 @@
[
sectionView
addConstraint
:
shoppingWidth
];
//
NSLayoutConstraint
*
scoreTop
=
[
NSLayoutConstraint
constraintWithItem
:
scoreLabel
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
sectionView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
0
];
NSLayoutConstraint
*
scoreTop
=
[
NSLayoutConstraint
constraintWithItem
:
scoreLabel
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
sectionView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
5
];
[
sectionView
addConstraint
:
scoreTop
];
NSLayoutConstraint
*
scoreRight
=
[
NSLayoutConstraint
constraintWithItem
:
scoreLabel
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
gradeLabel
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
0
];
...
...
@@ -289,7 +313,7 @@
[
sectionView
addConstraint
:
scoreBottom
];
//
NSLayoutConstraint
*
gradeTop
=
[
NSLayoutConstraint
constraintWithItem
:
gradeLabel
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
sectionView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
0
];
NSLayoutConstraint
*
gradeTop
=
[
NSLayoutConstraint
constraintWithItem
:
gradeLabel
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
sectionView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
5
];
[
sectionView
addConstraint
:
gradeTop
];
NSLayoutConstraint
*
gradeRight
=
[
NSLayoutConstraint
constraintWithItem
:
gradeLabel
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
sectionView
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:
0
];
...
...
@@ -308,12 +332,12 @@
if
(
!
_pointLabel1
)
{
_pointLabel1
=
[[
UILabel
alloc
]
init
];
_pointLabel1
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
_pointLabel1
.
textColor
=
k
HomeSection
TitleTextColor
;
_pointLabel1
.
font
=
[
UIFont
systemFontOfSize
:
1
4
.
0
];
_pointLabel1
.
textColor
=
k
RankHead
TitleTextColor
;
_pointLabel1
.
font
=
[
UIFont
systemFontOfSize
:
1
5
.
0
];
_pointLabel1
.
textAlignment
=
NSTextAlignmentCenter
;
[
self
.
headView
addSubview
:
_pointLabel1
];
NSLayoutConstraint
*
point1Top
=
[
NSLayoutConstraint
constraintWithItem
:
_pointLabel1
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
headView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
5
];
NSLayoutConstraint
*
point1Top
=
[
NSLayoutConstraint
constraintWithItem
:
_pointLabel1
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
headView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
7
];
[
self
.
headView
addConstraint
:
point1Top
];
NSLayoutConstraint
*
point1Right
=
[
NSLayoutConstraint
constraintWithItem
:
_pointLabel1
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
lineView
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
0
];
...
...
@@ -333,12 +357,12 @@
if
(
!
_pointLabel2
)
{
_pointLabel2
=
[[
UILabel
alloc
]
init
];
_pointLabel2
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
_pointLabel2
.
textColor
=
k
HomeSection
TitleTextColor
;
_pointLabel2
.
font
=
[
UIFont
systemFontOfSize
:
1
4
.
0
];
_pointLabel2
.
textColor
=
k
RankHead
TitleTextColor
;
_pointLabel2
.
font
=
[
UIFont
systemFontOfSize
:
1
5
.
0
];
_pointLabel2
.
textAlignment
=
NSTextAlignmentCenter
;
[
self
.
headView
addSubview
:
_pointLabel2
];
NSLayoutConstraint
*
point2Top
=
[
NSLayoutConstraint
constraintWithItem
:
_pointLabel2
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
headView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
5
];
NSLayoutConstraint
*
point2Top
=
[
NSLayoutConstraint
constraintWithItem
:
_pointLabel2
attribute
:
NSLayoutAttributeTop
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
headView
attribute
:
NSLayoutAttributeTop
multiplier
:
1
.
0
constant
:
7
];
[
self
.
headView
addConstraint
:
point2Top
];
NSLayoutConstraint
*
point2Right
=
[
NSLayoutConstraint
constraintWithItem
:
_pointLabel2
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
headView
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:
0
];
...
...
@@ -385,9 +409,9 @@
NSString
*
dateStr
=
[
NSString
stringWithFormat
:
@"2015 年 08 月"
];
NSMutableAttributedString
*
dateAttr
=
[[
NSMutableAttributedString
alloc
]
initWithString
:
dateStr
];
[
dateAttr
addAttributes
:@{
NSForegroundColorAttributeName
:
k
NavigationBarColor
,
NSFontAttributeName
:
[
UIFont
systemFontOfSize
:
20
.
0
f
]}
range
:
NSMakeRange
(
0
,
5
)];
[
dateAttr
addAttributes
:@{
NSForegroundColorAttributeName
:
k
DateButtonTextColor
,
NSFontAttributeName
:
[
UIFont
systemFontOfSize
:
21
.
0
f
]}
range
:
NSMakeRange
(
0
,
5
)];
[
dateAttr
addAttributes
:@{
NSForegroundColorAttributeName
:
[
UIColor
blackColor
],
NSFontAttributeName
:
[
UIFont
systemFontOfSize
:
15
.
0
f
]}
range
:
NSMakeRange
(
5
,
1
)];
[
dateAttr
addAttributes
:@{
NSForegroundColorAttributeName
:
k
NavigationBarColor
,
NSFontAttributeName
:
[
UIFont
systemFontOfSize
:
20
.
0
f
]}
range
:
NSMakeRange
(
6
,
4
)];
[
dateAttr
addAttributes
:@{
NSForegroundColorAttributeName
:
k
DateButtonTextColor
,
NSFontAttributeName
:
[
UIFont
systemFontOfSize
:
21
.
0
f
]}
range
:
NSMakeRange
(
6
,
4
)];
[
dateAttr
addAttributes
:@{
NSForegroundColorAttributeName
:
[
UIColor
blackColor
],
NSFontAttributeName
:
[
UIFont
systemFontOfSize
:
15
.
0
f
]}
range
:
NSMakeRange
(
10
,
1
)];
[
_dateButton
setAttributedTitle
:
dateAttr
forState
:
UIControlStateNormal
];
...
...
@@ -415,7 +439,7 @@
_shoppingCountLabel
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
NSString
*
shopCount
=
[
NSString
stringWithFormat
:
@"21 家"
];
NSMutableAttributedString
*
shopAttr
=
[[
NSMutableAttributedString
alloc
]
initWithString
:
shopCount
];
[
shopAttr
addAttributes
:@{
NSForegroundColorAttributeName
:
[
UIColor
redColor
],
NSFontAttributeName
:
[
UIFont
systemFontOfSize
:
20
.
0
f
]}
range
:
NSMakeRange
(
0
,
shopCount
.
length
-
2
)];
[
shopAttr
addAttributes
:@{
NSForegroundColorAttributeName
:
kShopCountTextColor
,
NSFontAttributeName
:
[
UIFont
systemFontOfSize
:
21
.
0
f
]}
range
:
NSMakeRange
(
0
,
shopCount
.
length
-
2
)];
[
shopAttr
addAttributes
:@{
NSForegroundColorAttributeName
:
[
UIColor
blackColor
],
NSFontAttributeName
:
[
UIFont
systemFontOfSize
:
15
.
0
f
]}
range
:
NSMakeRange
(
shopCount
.
length
-
2
,
2
)];
_shoppingCountLabel
.
attributedText
=
shopAttr
;
...
...
@@ -462,10 +486,32 @@
return
_tableView
;
}
-
(
UIView
*
)
lineView1
{
if
(
!
_lineView1
)
{
_lineView1
=
[[
UIView
alloc
]
init
];
_lineView1
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
[
self
.
headView
addSubview
:
_lineView1
];
NSLayoutConstraint
*
lineBottom
=
[
NSLayoutConstraint
constraintWithItem
:
_lineView1
attribute
:
NSLayoutAttributeBottom
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
headView
attribute
:
NSLayoutAttributeBottom
multiplier
:
1
.
0
constant
:
0
];
[
self
.
headView
addConstraint
:
lineBottom
];
NSLayoutConstraint
*
lineLeft
=
[
NSLayoutConstraint
constraintWithItem
:
_lineView1
attribute
:
NSLayoutAttributeLeft
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
headView
attribute
:
NSLayoutAttributeLeft
multiplier
:
1
.
0
constant
:
0
];
[
self
.
headView
addConstraint
:
lineLeft
];
NSLayoutConstraint
*
lineRight
=
[
NSLayoutConstraint
constraintWithItem
:
_lineView1
attribute
:
NSLayoutAttributeRight
relatedBy
:
NSLayoutRelationEqual
toItem
:
self
.
headView
attribute
:
NSLayoutAttributeRight
multiplier
:
1
.
0
constant
:
0
];
[
self
.
headView
addConstraint
:
lineRight
];
NSLayoutConstraint
*
lineHeight
=
[
NSLayoutConstraint
constraintWithItem
:
_lineView1
attribute
:
NSLayoutAttributeHeight
relatedBy
:
NSLayoutRelationEqual
toItem
:
nil
attribute
:
NSLayoutAttributeNotAnAttribute
multiplier
:
1
.
0
constant
:
2
];
[
_lineView1
addConstraint
:
lineHeight
];
}
return
_lineView1
;
}
-
(
UIView
*
)
headView
{
if
(
!
_headView
)
{
_headView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
7
0
)];
_headView
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
7
6
)];
_headView
.
backgroundColor
=
[
UIColor
whiteColor
];
}
return
_headView
;
...
...
redstar/Classes/Module/Home/View/HomeHeaderView.m
View file @
16252f9d
...
...
@@ -7,16 +7,14 @@
//
#import "HomeHeaderView.h"
#define
k
Count 5
#define
Image
Count 5
@interface
HomeHeaderView
()
<
UIScrollViewDelegate
>
{
UIImageView
*
_centerView
;
UIImageView
*
_reusableView
;
}
@property
(
nonatomic
,
assign
)
BOOL
isDragging
;
//是否正在拖动
@property
(
nonatomic
,
strong
)
NSTimer
*
timer
;
//设置动画
@end
@implementation
HomeHeaderView
...
...
@@ -36,34 +34,29 @@
#pragma mark - Private Methods
-
(
void
)
setup
{
_isDragging
=
NO
;
// 天气label
self
.
weatherLabel
.
text
=
@"上海 ⛅️ 多云转晴 21-29℃"
;
// 设置代理
self
.
scrollView
.
delegate
=
self
;
CGFloat
w
=
_scrollView
.
frame
.
size
.
width
;
CGFloat
h
=
_scrollView
.
frame
.
size
.
height
;
_scrollView
.
pagingEnabled
=
YES
;
_scrollView
.
contentSize
=
CGSizeMake
(
w
*
3
,
0
);
_scrollView
.
contentOffset
=
CGPointMake
(
w
,
0
);
_scrollView
.
showsHorizontalScrollIndicator
=
NO
;
CGFloat
width
=
self
.
scrollView
.
frame
.
size
.
width
;
CGFloat
height
=
self
.
scrollView
.
frame
.
size
.
height
;
_scrollView
.
contentSize
=
CGSizeMake
(
ImageCount
*
width
,
0
);
_centerView
=
[[
UIImageView
alloc
]
init
];
_centerView
.
image
=
[
UIImage
imageNamed
:
@"00.jpg"
];
_centerView
.
frame
=
CGRectMake
(
w
,
0
,
w
,
h
);
_centerView
.
tag
=
0
;
_centerView
.
userInteractionEnabled
=
YES
;
[
_scrollView
addSubview
:
_centerView
];
for
(
int
i
=
0
;
i
<
ImageCount
;
i
++
)
{
UIImageView
*
imageView
=
[[
UIImageView
alloc
]
init
];
CGFloat
imageX
=
i
*
width
;
CGFloat
imageY
=
0
.
f
;
imageView
.
frame
=
CGRectMake
(
imageX
,
imageY
,
width
,
height
);
imageView
.
image
=
[
UIImage
imageNamed
:[
NSString
stringWithFormat
:
@"0%d"
,
i
]];
imageView
.
userInteractionEnabled
=
YES
;
UITapGestureRecognizer
*
tapGR
=
[[
UITapGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
@selector
(
tapGRClick
:
)];
[
imageView
addGestureRecognizer
:
tapGR
];
[
_scrollView
addSubview
:
imageView
];
}
// 添加点击事件
UITapGestureRecognizer
*
tapCenterGR
=
[[
UITapGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
@selector
(
tapGRClick
:
)];
[
_centerView
addGestureRecognizer
:
tapCenterGR
];
_reusableView
=
[[
UIImageView
alloc
]
init
];
_reusableView
.
frame
=
_scrollView
.
bounds
;
UITapGestureRecognizer
*
tapReusableGR
=
[[
UITapGestureRecognizer
alloc
]
initWithTarget
:
self
action
:
@selector
(
tapGRClick
:
)];
[
_reusableView
addGestureRecognizer
:
tapReusableGR
];
// 设置时钟动画 定时器
self
.
timer
=
[
NSTimer
scheduledTimerWithTimeInterval
:
1
.
5
f
target
:
self
selector
:
@selector
(
update
:
)
userInfo
:
nil
repeats
:
YES
];
...
...
@@ -78,12 +71,16 @@
return
;
}
CGPoint
offSet
=
self
.
scrollView
.
contentOffset
;
offSet
.
x
+=
offSet
.
x
;
if
(
offSet
.
x
==
0
)
{
offSet
.
x
=
_scrollView
.
frame
.
size
.
width
;
}
else
if
(
offSet
.
x
<=
(
ImageCount
-
2
)
*
_scrollView
.
frame
.
size
.
width
){
offSet
.
x
+=
_scrollView
.
frame
.
size
.
width
;
}
else
{
offSet
.
x
=
0
;
}
[
self
.
scrollView
setContentOffset
:
offSet
animated
:
YES
];
if
(
offSet
.
x
>=
self
.
frame
.
size
.
width
*
2
)
{
offSet
.
x
=
self
.
frame
.
size
.
width
;
}
}
-
(
void
)
tapGRClick
:
(
UITapGestureRecognizer
*
)
sender
...
...
@@ -95,44 +92,7 @@
#pragma mark - UIScrollView Delegate
-
(
void
)
scrollViewDidScroll
:
(
UIScrollView
*
)
scrollView
{
CGFloat
offsetX
=
scrollView
.
contentOffset
.
x
;
CGFloat
w
=
scrollView
.
frame
.
size
.
width
;
// 1.设置 循环利用view 的位置
CGRect
f
=
_reusableView
.
frame
;
NSInteger
index
=
0
;
if
(
offsetX
>
_centerView
.
frame
.
origin
.
x
)
{
// 显示在最右边
f
.
origin
.
x
=
scrollView
.
contentSize
.
width
-
w
;
index
=
_centerView
.
tag
+
1
;
if
(
index
>=
kCount
)
index
=
0
;
}
else
{
// 显示在最左边
f
.
origin
.
x
=
0
;
index
=
_centerView
.
tag
-
1
;
if
(
index
<
0
)
index
=
kCount
-
1
;
}
_reusableView
.
frame
=
f
;
_reusableView
.
tag
=
index
;
NSString
*
icon
=
[
NSString
stringWithFormat
:
@"0%ld.jpg"
,
(
long
)
index
];
_reusableView
.
image
=
[
UIImage
imageNamed
:
icon
];
// 2.显示了 最左 或者 最右 的图片
if
(
offsetX
<=
0
||
offsetX
>=
w
*
2
)
{
// 2.1.交换 中间的 和 循环利用的
UIImageView
*
temp
=
_centerView
;
_centerView
=
_reusableView
;
_reusableView
=
temp
;
// 2.2.设置显示位置
_centerView
.
frame
=
_reusableView
.
frame
;
scrollView
.
contentOffset
=
CGPointMake
(
w
,
0
);
[
_reusableView
removeFromSuperview
];
}
else
{
[
_scrollView
addSubview
:
_reusableView
];
}
}
-
(
void
)
scrollViewWillBeginDragging
:
(
UIScrollView
*
)
scrollView
...
...
@@ -152,6 +112,7 @@
_scrollView
=
[[
UIScrollView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
self
.
bounds
.
size
.
width
,
self
.
bounds
.
size
.
height
)];
_scrollView
.
bounces
=
NO
;
_scrollView
.
pagingEnabled
=
YES
;
_scrollView
.
delegate
=
self
;
_scrollView
.
showsHorizontalScrollIndicator
=
NO
;
_scrollView
.
showsVerticalScrollIndicator
=
NO
;
[
self
addSubview
:
_scrollView
];
...
...
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