프로젝트 설정 및 테스트

쏘스야·2023년 4월 5일
0

ios 개발자의 첫걸음

목록 보기
41/61
//
//  ViewController.swift
//  MyFirstApp
//
//  Created by 조소야 on 2023/04/05.
//

// 프레임 워크를 사용하겠다.
import UIKit


class ViewController: UIViewController {
    
    // IB : Interface Builder(뷰-객체), Outlet : 배출구
    // 코드상의 어떤 설정을 (스토리보드로) 전달하기 위한 키워드 (주석)
    @IBOutlet weak var mainLabel: UILabel!
    
    @IBOutlet weak var myButten: UIButton!
    
    /**
     앱의 화면에 들어오면 처음 실행시키는 함수
     */
    override func viewDidLoad() {
        super.viewDidLoad()
        mainLabel.text = "방가방가"
        mainLabel.backgroundColor = UIColor.yellow
    }
    
    
    
    // IB : Interface Builder(뷰-객체), Action : 동작
    // (스토리보드상에) 이벤트(동작)가 일어나는 경우 어떤 함수를 호출하여 실행시킬 것인지 알려주는 키워드(주석)
    @IBAction func buttenPressed(_ sender: UIButton) {
        // #colorLiteral( : 컬러를 쉽게 변경 가능한 기능
        // #imageLiteral( : 사진을 쉽게 변경 가능한 기능
        mainLabel.backgroundColor = #colorLiteral(red: 0.1764705926, green: 0.01176470611, blue: 0.5607843399, alpha: 1)
        
        mainLabel.text = "안녕하세요"
        
        mainLabel.textColor = #colorLiteral(red: 0.9098039269, green: 0.4784313738, blue: 0.6431372762, alpha: 1)
        mainLabel.textAlignment = NSTextAlignment.right
        
        myButten.backgroundColor = UIColor.yellow
        myButten.setTitleColor(.black, for: UIControl.State.normal)
    }
}


profile
개발자

0개의 댓글