修复枚举, 类和结构体章节的图片链接 (#1220)
This commit is contained in:
@ -135,11 +135,11 @@ for beverage in Beverage.allCases {
|
||||
|
||||
例如,假设一个库存跟踪系统需要利用两种不同类型的条形码来跟踪商品。有些商品上标有使用 `0` 到 `9` 的数字的 UPC 格式的一维条形码。每一个条形码都有一个代表数字系统的数字,该数字后接五位代表厂商代码的数字,接下来是五位代表“产品代码”的数字。最后一个数字是检查位,用来验证代码是否被正确扫描:
|
||||
|
||||
<img width="252" height="120" alt="" src="https://docs.swift.org/swift-book/_images/barcode_UPC_2x.png">
|
||||
<img width="252" height="120" alt="" src="https://docs.swift.org/swift-book/images/barcode_UPC@2x.png">
|
||||
|
||||
其他商品上标有 QR 码格式的二维码,它可以使用任何 ISO 8859-1 字符,并且可以编码一个最多拥有 2,953 个字符的字符串:
|
||||
|
||||
<img width="169" height="169" alt="" src="https://docs.swift.org/swift-book/_images/barcode_QR_2x.png">
|
||||
<img width="169" height="169" alt="" src="https://docs.swift.org/swift-book/images/barcode_QR@2x.png">
|
||||
|
||||
这便于库存跟踪系统用包含四个整型值的元组存储 UPC 码,以及用任意长度的字符串储存 QR 码。
|
||||
|
||||
|
||||
@ -166,7 +166,7 @@ print("hd is still \(hd.width) pixels wide")
|
||||
|
||||
将 `hd` 赋值给 `cinema` 时,`hd` 中所存储的*值*会拷贝到新的 `cinema` 实例中。结果就是两个完全独立的实例包含了相同的数值。由于两者相互独立,因此将 `cinema` 的 `width` 修改为 `2048` 并不会影响 `hd` 中的 `width` 的值,如下图所示:
|
||||
|
||||

|
||||

|
||||
|
||||
枚举也遵循相同的行为准则:
|
||||
|
||||
@ -214,7 +214,7 @@ alsoTenEighty.frameRate = 30.0
|
||||
|
||||
因为类是引用类型,所以 `tenEight` 和 `alsoTenEight` 实际上引用的是同一个 `VideoMode` 实例。换句话说,它们是同一个实例的两种叫法,如下图所示:
|
||||
|
||||

|
||||

|
||||
|
||||
通过查看 `tenEighty` 的 `frameRate` 属性,可以看到它正确地显示了底层的 `VideoMode` 实例的新帧率 `30.0`:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user