私は現在、あなたが左にスワイプしたときにランダムな単語を生成する各半分で電話画面の2つの半分をスワイプできるアプリケーションに取り組んでいます。どのように1つの画面に2つのランダムな単語ジェネレータを持っていますか?
ランダムに単語を生成する画面の上半分の単語リストを作成しました。画面の下半分に同じ方法を適用するにはどうすればよいですか?私は現在、ビューコントローラ
import UIKit
class ViewController: UIViewController {
// put the labels and the buttons
@IBOutlet var InspirationalThought: UILabel!
@IBOutlet var Click: UIButton!
//what the label is going to show
var quotes = ["Geometrics", "Vectors", "Celebration", "Triangle", "Landscapes", "Seasons", "Snow", "Rain", "Sunrays", "Stencils", "Paint", "Graphics", "Graffiti", "Sports","Fashion","Ancient Greek", "Philosophers", "Fairy tales", "Fantasy", "Clouds", "Mystery", "Time Clocks", "Canvas", "Tie-dye", "Glitter", "Dessert", "Desert", "Energy", "Astrology", "Solar Systems", "Sea", "Beach", "Sphere", "Roots", "Lights", "Darks", "Fire", "Air", "Aperture", "Long exposure", "Portraits", "World", "Travel", "Architecture", "Freedom", "Old", "New", "Urban", "Lenses", "Fisheye", "Chords", "Music notes", "Spices", "Herbs", "Natural", "Marbles", "Wood", "Trees", "Forests", "Interior","Mammals", "Reptiles", "Ocean", "Birds", "Photography", "Exposure", "Opaque", "Translucent", "Freestyle", "Spots", "Stripes", "Zig Zag", "Spiral", "Glass", "Feathers", "Calm", "Bulb", "Heat", "Cold", "Stitches", "Views", "Birds", "Sunset", "Earth"]
var whichQuotestoChoose = 0
// what the button is going to show
var ButtonText = ["Inspiration", "Tell me more", "more inspirational"]
var whichButtonTexttoChoose = 0
@IBAction func ClickButtonClicked(sender: UIButton) {
chooseAQuote()
chooseTextonButton()
}
func chooseAQuote(){
showTheQuote()
whichQuotestoChoose = Int(arc4random_uniform (84))
}
func showTheQuote(){
InspirationalThought.text = "\(quotes[whichQuotestoChoose])"
}
func chooseTextonButton(){
Click.setTitle("\(ButtonText[whichButtonTexttoChoose])", forState:UIControlState.Normal)
}
}
もそうandhasコードがそのために追加され、あなたが答えを探している画面:以下
はサンプル実装ですか?それは一度だけですかVC –
最初の画面は私が現在持っているもので、コードはどこから来たのですか?はい、その唯一のVCです。第2の画面は、私もそれがストーリーボードのスクリーンショットのように見えるようにしたいです。 –