Giter Club home page Giter Club logo

uikit_basic's People

Contributors

yeahg-dev avatar

uikit_basic's Issues

UIView를 addSubview만 하면 위치와 사이즈가 결정될까?

발단

UIView의 frame프로퍼티는 superview의 좌표체계에 기반해서 뷰의 origin과 dimensions(크기)를 결정한다.
https://developer.apple.com/documentation/uikit/uiview

궁금증

그렇다면 UIView를 addSubview만 해주면, frame에 명시된 x,y값과 width, height 값으로 자신의 위치와 사이즈를 완전히 결정할 수 있을까?
오토레이아웃 없이도 가능할까?

결과

가능하다.


let subview = CustomSubview(frame: CGRect(x: 30, y: 30, width: 50, height: 50))
graySuperview.addSubview(subview)

스크린샷 2022-03-13 오후 12 12 56

frame프로퍼티의 값 대로, superview의 origin이 (0,0)일 때, subview는 origin은 (30,30), 크기는 (50,50)인 사각형으로 결정되었다.

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.