Dosen原創(chuàng)
這是我學(xué)習(xí)quartz composer份企,Origami也榄,看官方文檔翻譯下來的,每天一篇,有不準(zhǔn)確的地方希望能指出甜紫,一起交流進(jìn)步降宅。轉(zhuǎn)載請與我聯(lián)系,擅自轉(zhuǎn)載視作侵權(quán)囚霸。
States ? ? ?狀態(tài)
Every prototype has multiple states it can transition between. Origami has several patches to help you manage these states.
每一個原型都有多個狀態(tài)腰根,并可以在這些狀態(tài)間轉(zhuǎn)換。Origami有一些模塊幫助你管理這些狀態(tài)拓型。
1. State patches ? ? ?狀態(tài)模塊
Switch →? “?? S ” ? ? ? ?開關(guān)
The Switch patch works like a light switch. Flipping it when it's on will turn it off, and when it's off flipping it will turn it on. Switches help you build simple two-state interactions. For example you might have a Switch managing whether a photo is full screen or not or whether a modal view is on screen.
Switch模塊的作用像是一個燈的開關(guān)额嘿。輕擊它會在開和關(guān)的狀態(tài)間切換。Switch幫你建立簡單的兩個狀態(tài)的交互劣挫。例如册养,你可以用一個Switch管理一個圖是否全屏或者一個模型視圖是否在屏幕上。
![](http://upload-images.jianshu.io/upload_images/2404066-850693fa5f812818.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
Index Switch →? ? ? ? 索引切換
Index Switch patches are useful for mutually exclusive states that cannot coexist, e.g. a tab bar.
Index Switch模塊對于相互排斥無法共存的狀態(tài)非常有用压固。例如球拦,一個Tab bar(標(biāo)簽欄)。
Index Switches are commonly used with Multiplexers to pass different values depending the state. For example, if you wanted to change a navigation bar title between 3 states:
Index Switch通常和Multiplexers用于依賴狀態(tài)傳遞不同的值帐我。例如坎炼,你想在3個狀態(tài)間改變導(dǎo)航欄的標(biāo)題。
![](http://upload-images.jianshu.io/upload_images/2404066-96ba2338a8fbad18.png)
Counter 2 →? ? ? 計(jì)數(shù)器
Counter patches are useful for mutually exclusive states that cannot coexist, and increment in a fixed order e.g. an onboarding flow.
Counter模塊是對于相互排斥無法共存的狀態(tài)和固定順序的增量非常有用(和Index Switch很像)拦键,例如:入職流程谣光。
2. Index numbers represent states ? ? ?索引數(shù)字代表狀態(tài)
Both Switch and Index Switch patches output a number for the state that is active. Switch patches output a 0 (off) or a 1 (on), and Index Switch patches output a number starting from 0 for the first state, to 1 for the 2nd, and so on:
Index 0 → Initial state / Off State
Index 1 → 2nd state / On State
Index 2 → 3rd state
Index 3 → 4th state
...
Switch和Index Switch模塊都是給有效的狀態(tài)輸出一個數(shù)字,Switch模塊輸出一個0(關(guān))或1(開)芬为,Index Switch模塊輸出一個數(shù)字從0開始代表第一個狀態(tài)萄金,1代表第二個狀態(tài),如此...