Hello World IOS App Part 2 AutoLayout: IOS Swift Tutorial

This entry is part 6 of 32 in the series iOS Apps

This IOS tutorial shows how to build first ios app hello world in swift and add autolayout constraints to arrange the uilabel centered horizontally and vertically with respect to parent view with the align center x to superview and align center y to superview constraints. It also shows how to change text color of UILabel and background color of UIView

Snapchat-Like Menu! (Swift in Xcode)

This entry is part 11 of 32 in the series iOS Apps

Snapchat-Like Menu! (Swift in Xcode)

import UIKit

class ViewController: UIViewController {

    @IBOutlet var scrollView: UIScrollView!
    
    override func viewDidLoad() {
        super.viewDidLoad()
        // Do any additional setup after loading the view, typically from a nib.
        
        let V1 : View1 = View1(nibName: "View1", bundle: nil)
        
        let V2 : View1 = View1(nibName: "View2", bundle: nil)
        
        let V3 : View1 = View1(nibName: "View3", bundle: nil)
        
        self.addChildViewController(V1)
        self.scrollView.addSubview(V1.view)
        V1.didMoveToParentViewController(self)
        
        self.addChildViewController(V2)
        self.scrollView.addSubview(V2.view)
        V2.didMoveToParentViewController(self)
        
        self.addChildViewController(V3)
        self.scrollView.addSubview(V3.view)
        V3.didMoveToParentViewController(self)
        
        var V2Frame : CGRect = V2.view.frame
        V2Frame.origin.x = self.view.frame.width
        V2.view.frame = V2Frame
        
        var V3Frame : CGRect = V3.view.frame
        V3Frame.origin.x = 2 * self.view.frame.width
        V3.view.frame = V3Frame
        
        self.scrollView.contentSize = CGSizeMake(self.view.frame.width*3, self.view.frame.size.height)
        
    }
    
    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }

}