Code Monkey home page Code Monkey logo

studyroom's Introduction

This is Study Room Objective-C , swift language Study

  • IOS 공부 시작 2017. 07. 1 ~

  • 공부 언어 : Objective-C , swift

  • IOS Base Study

  1. Light the candle App Study
  1. MVC patternator
  1. property
  1. Universal Application Light the Candle을 Universal Application 으로 변경

Apple Guides and Sample Code [developer]

강의 내용 및 공부 출처

studyroom's People

Contributors

kanghoyong avatar

Stargazers

 avatar

Watchers

 avatar  avatar

studyroom's Issues

3. Light the candle Application access method changed property

property using

  • Light the candle Application access method changed property Code

  • @interface CandleModel : NSObject -> NSObject 최상의 객체 상속을 위해서 Interface 정의

  • property 선언하면 알아서 멤버 변수 선언 및 get set 정의부분 선언 할시 자동으로 구현부분 생성됨 모던 런타임에서만

  • @Property 사용 이득 -> synthesize 를 이용하여 get set 자동으로 정의
     

  • 기존 old 방식의 access method 선언
    1 외부에서 접근할수 있도록 access method 선언 (getter setter 추가)
      - (UIImage *) imageCandleOn; // getter
      - (void) setImageCnadleOn:(UIImage *)newImage; // setter
    하지만 여기서 property 로 선언하면 다음과 같음
    @Property (nonatomic, strong) UIImage *ImageCadlOn ; // getter , setter 선언  

First type option @Property (type, type)

  • nonatomic ( Singer Thread)
  • atomic : 멤버 접근안에 뮤텍스 설정 (멤버 접근에서만 사용 Multi Thread)

Second type option

  • weak , retain , copy , assing , strong : copy를 제외한 나머지는 동일
    Copy 경우는 Copy set에 대해서 인자값이 넘어오는 인자에대해서 Copy 수행

  • retain = strong , assing = strong

get Name 옵션 getter = name setter = name
@Property (nonatomic, strong, getter = name , setter = name) UIImage *ImageCadlOn ; // getter , setter 선언  

getter만 만들경우 옵션 readonly
 @Property (nonatomic, readonly, getter = name) UIImage *ImageCadlOn ; // getter , setter 선언

구현 부분
//@synthesize ImageCandlOn; 선언 하면 끝 하지만 이마저도 ios버전이 업데이트 후 자동으로 구현 되므로 필요 없음 하지만 개인이 필요시 수정이 필요하다면
||- (UIImage *) imageCandleOn
  {
  return imageCandleOn;
  }
  -(void) setImageCnadleOn:(UIImage *)newImage
  {
  imageCandleOn = newImage;
  }
이런식으로 수동으로 자기가 만들어서 사용할 수 도 있다.

 - 자료출저

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.