[source code] iOS Development with Swift Tutorial - 26 - Drawing Images and Photos

+2 Bucky Roberts · February 5, 2015
import UIKit

class DrawExamples: UIView {

    override func drawRect(rect: CGRect) {
        let context = UIGraphicsGetCurrentContext()
        
        let buckysFace = UIImage(named: "bucky.jpg")
        let logoImage = UIImage(named: "logo.png")
        
        // Draw normal
        // let location = CGPointMake(25, 25)
        // buckysFace?.drawAtPoint(location)
        
        // Fill the screen
        let entireScreen = UIScreen.mainScreen().bounds
        logoImage?.drawInRect(entireScreen)
    }

}

Post a Reply

Replies

Oldest  Newest  Rating
0 Hans Qian · December 9, 2015
Hi, Bucky.
 I can't find the supporting files in Xcode 7.1.1
Could you tell me where to find it?/images/forum/upload/2015-12-08/136080ff98171a0575cfe8b30e1ecbcb.png
  • 1

iOS Development / Swift

107,037 followers
About

This forum is for questions, comments, and general discussion about iOS Development and Swift.

Links
Moderators
Bucky Roberts Administrator