Skip to content

Instantly share code, notes, and snippets.

@growvv
Created November 24, 2020 12:52
Show Gist options
  • Save growvv/e58860c589d1a3658265dc77585ca23e to your computer and use it in GitHub Desktop.
Save growvv/e58860c589d1a3658265dc77585ca23e to your computer and use it in GitHub Desktop.
创建一个页面:由于已经用storyboard绘制好,只需要给相应变量赋值即可
//
// DetailViewController.swift
// Swift-TableView-Example
//
// Created by Bilal ARSLAN on 12/10/14.
// Copyright (c) 2014 Bilal ARSLAN. All rights reserved.
//
import Foundation
import UIKit
class DetailViewController: UIViewController {
@IBOutlet var imageView: UIImageView!
@IBOutlet var nameLabel: UILabel!
@IBOutlet var prepTime: UILabel!
var recipe: Recipe?
override func viewDidLoad() {
super.viewDidLoad()
if let recipe = recipe {
navigationItem.title = recipe.name
imageView.image = UIImage(named: recipe.thumbnails)
nameLabel.text = recipe.name
prepTime.text = "Prep Time: " + recipe.prepTime
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment