Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
@邻家的橘猫
Iosswift
提交
d3601c50
I
Iosswift
项目概览
@邻家的橘猫
/
Iosswift
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
I
Iosswift
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
d3601c50
编写于
3月 04, 2019
作者:
J
John Hampton
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Adds star images to the ratings button
上级
6b3d9f91
变更
9
隐藏空白更改
内联
并排
Showing
9 changed file
with
85 addition
and
13 deletion
+85
-13
iOSTemplate/Assets.xcassets/Rating Images/Contents.json
iOSTemplate/Assets.xcassets/Rating Images/Contents.json
+6
-0
iOSTemplate/Assets.xcassets/Rating Images/emptyStar.imageset/Contents.json
...s.xcassets/Rating Images/emptyStar.imageset/Contents.json
+21
-0
iOSTemplate/Assets.xcassets/Rating Images/emptyStar.imageset/emptyStar.png
...s.xcassets/Rating Images/emptyStar.imageset/emptyStar.png
+0
-0
iOSTemplate/Assets.xcassets/Rating Images/filledStar.imageset/Contents.json
....xcassets/Rating Images/filledStar.imageset/Contents.json
+21
-0
iOSTemplate/Assets.xcassets/Rating Images/filledStar.imageset/filledStar.png
...xcassets/Rating Images/filledStar.imageset/filledStar.png
+0
-0
iOSTemplate/Assets.xcassets/Rating Images/highlightedStar.imageset/Contents.json
...sets/Rating Images/highlightedStar.imageset/Contents.json
+21
-0
iOSTemplate/Assets.xcassets/Rating Images/highlightedStar.imageset/highlightedStar.png
...ating Images/highlightedStar.imageset/highlightedStar.png
+0
-0
iOSTemplate/Base.lproj/Main.storyboard
iOSTemplate/Base.lproj/Main.storyboard
+3
-11
iOSTemplate/RatingControl.swift
iOSTemplate/RatingControl.swift
+13
-2
未找到文件。
iOSTemplate/Assets.xcassets/Rating Images/Contents.json
0 → 100644
浏览文件 @
d3601c50
{
"info"
:
{
"version"
:
1
,
"author"
:
"xcode"
}
}
\ No newline at end of file
iOSTemplate/Assets.xcassets/Rating Images/emptyStar.imageset/Contents.json
0 → 100644
浏览文件 @
d3601c50
{
"images"
:
[
{
"idiom"
:
"universal"
,
"scale"
:
"1x"
},
{
"idiom"
:
"universal"
,
"filename"
:
"emptyStar.png"
,
"scale"
:
"2x"
},
{
"idiom"
:
"universal"
,
"scale"
:
"3x"
}
],
"info"
:
{
"version"
:
1
,
"author"
:
"xcode"
}
}
\ No newline at end of file
iOSTemplate/Assets.xcassets/Rating Images/emptyStar.imageset/emptyStar.png
0 → 100644
浏览文件 @
d3601c50
21.1 KB
iOSTemplate/Assets.xcassets/Rating Images/filledStar.imageset/Contents.json
0 → 100644
浏览文件 @
d3601c50
{
"images"
:
[
{
"idiom"
:
"universal"
,
"scale"
:
"1x"
},
{
"idiom"
:
"universal"
,
"filename"
:
"filledStar.png"
,
"scale"
:
"2x"
},
{
"idiom"
:
"universal"
,
"scale"
:
"3x"
}
],
"info"
:
{
"version"
:
1
,
"author"
:
"xcode"
}
}
\ No newline at end of file
iOSTemplate/Assets.xcassets/Rating Images/filledStar.imageset/filledStar.png
0 → 100644
浏览文件 @
d3601c50
12.3 KB
iOSTemplate/Assets.xcassets/Rating Images/highlightedStar.imageset/Contents.json
0 → 100644
浏览文件 @
d3601c50
{
"images"
:
[
{
"idiom"
:
"universal"
,
"scale"
:
"1x"
},
{
"idiom"
:
"universal"
,
"filename"
:
"highlightedStar.png"
,
"scale"
:
"2x"
},
{
"idiom"
:
"universal"
,
"scale"
:
"3x"
}
],
"info"
:
{
"version"
:
1
,
"author"
:
"xcode"
}
}
\ No newline at end of file
iOSTemplate/Assets.xcassets/Rating Images/highlightedStar.imageset/highlightedStar.png
0 → 100644
浏览文件 @
d3601c50
10.9 KB
iOSTemplate/Base.lproj/Main.storyboard
浏览文件 @
d3601c50
...
...
@@ -18,7 +18,7 @@
<rect
key=
"frame"
x=
"0.0"
y=
"0.0"
width=
"375"
height=
"667"
/>
<autoresizingMask
key=
"autoresizingMask"
widthSizable=
"YES"
heightSizable=
"YES"
/>
<subviews>
<stackView
opaque=
"NO"
contentMode=
"scaleToFill"
axis=
"vertical"
alignment=
"top"
spacing=
"8"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"l36-fK-dfQ"
>
<stackView
opaque=
"NO"
contentMode=
"scaleToFill"
a
mbiguous=
"YES"
a
xis=
"vertical"
alignment=
"top"
spacing=
"8"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"l36-fK-dfQ"
>
<rect
key=
"frame"
x=
"0.0"
y=
"40"
width=
"375"
height=
"532.5"
/>
<subviews>
<label
opaque=
"NO"
userInteractionEnabled=
"NO"
contentMode=
"left"
horizontalHuggingPriority=
"251"
verticalHuggingPriority=
"251"
text=
"Meal Name"
textAlignment=
"natural"
lineBreakMode=
"tailTruncation"
baselineAdjustment=
"alignBaselines"
adjustsFontSizeToFit=
"NO"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"n9u-9b-TSl"
>
...
...
@@ -50,16 +50,8 @@
<outletCollection
property=
"gestureRecognizers"
destination=
"UAM-fK-D64"
appends=
"YES"
id=
"uEG-WL-m3E"
/>
</connections>
</imageView>
<stackView
opaque=
"NO"
contentMode=
"scaleToFill"
spacing=
"8"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"5FE-RR-A0X"
customClass=
"RatingControl"
customModule=
"iOSTemplate"
customModuleProvider=
"target"
>
<rect
key=
"frame"
x=
"0.0"
y=
"432.5"
width=
"132"
height=
"100"
/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute
type=
"size"
keyPath=
"starSize"
>
<size
key=
"value"
width=
"20"
height=
"100"
/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute
type=
"number"
keyPath=
"starCount"
>
<integer
key=
"value"
value=
"5"
/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<stackView
opaque=
"NO"
contentMode=
"scaleToFill"
ambiguous=
"YES"
spacing=
"8"
translatesAutoresizingMaskIntoConstraints=
"NO"
id=
"5FE-RR-A0X"
customClass=
"RatingControl"
customModule=
"iOSTemplate"
customModuleProvider=
"target"
>
<rect
key=
"frame"
x=
"0.0"
y=
"432.5"
width=
"50"
height=
"100"
/>
</stackView>
</subviews>
<constraints>
...
...
iOSTemplate/RatingControl.swift
浏览文件 @
d3601c50
...
...
@@ -42,17 +42,28 @@ import UIKit
// MARK: Private Methods
private
func
setupButtons
()
{
//
c
lear any existing buttons
//
C
lear any existing buttons
for
button
in
ratingButtons
{
removeArrangedSubview
(
button
)
button
.
removeFromSuperview
()
}
ratingButtons
.
removeAll
()
// Load Button Images
let
bundle
=
Bundle
(
for
:
type
(
of
:
self
))
let
filledStar
=
UIImage
(
named
:
"filledStar"
,
in
:
bundle
,
compatibleWith
:
self
.
traitCollection
)
let
emptyStar
=
UIImage
(
named
:
"emptyStar"
,
in
:
bundle
,
compatibleWith
:
self
.
traitCollection
)
let
highlightedStar
=
UIImage
(
named
:
"highlightedStar"
,
in
:
bundle
,
compatibleWith
:
self
.
traitCollection
)
for
_
in
0
..<
starCount
{
// Create the button
let
button
=
UIButton
()
button
.
backgroundColor
=
UIColor
.
red
// Set the button images
button
.
setImage
(
emptyStar
,
for
:
.
normal
)
button
.
setImage
(
filledStar
,
for
:
.
selected
)
button
.
setImage
(
highlightedStar
,
for
:
.
highlighted
)
button
.
setImage
(
highlightedStar
,
for
:
[
.
highlighted
,
.
selected
])
// Add constraints
button
.
translatesAutoresizingMaskIntoConstraints
=
false
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录