GithubHelp home page GithubHelp logo

Comments (2)

keumartist avatar keumartist commented on May 17, 2024 4

Navigation controller에 대한 좋은 이슈 남겨 주셔서 감사합니다!

'1. NC는 눈에 보이는 화면이 아니다' 라고 하신 말을 맞는 말인 것 같습니다. NC는 눈에 보이는 view들을 연결한 view controller들을 관리하는 container view controller 입니다. view controller들 뿐만 아니라 navigation bar 라는 객체도 관리를 하지요.

그런데 NC로 관리되는 view controller들은 linked list가 아닌 array(NSArray)로 구현된 stack에 들어갑니다. stack 안에서 현재 보이는 view의 controller가 top에 위치하게 되고, root view의 controller가 bottom에 위치하게 됩니다.

Screen Shot 2021-08-30 at 8 33 54 PM

실습을 할때 navigationController?.title = "waffle studio"가 view에 반영되지 않았던 것은, navigationController?.title과 연결된 view가 없기 때문입니다. 사실 제가 하려던 것은 navigationItem?.title = "waffle studio" 이었고, navigationItem은 해당 view controller와 연결된 view이기 떄문에 반영이 됩니다. 찾아주신 것처럼 ViewController의 property인 title = "waffle studio" 로 작성해도 타이틀이 반영이 됩니다. title과 navigationItem.title 중 무엇을 쓰는게 더 좋은지 생각해 봤는데, navigation controller 안에서는 의미상 navigationItem.title 가 더 정확하지만, title을 사용하면 tabbar controller를 쓰던 navigation controller를 쓰던 알아서 맞춰서 타이틀이 반영되어서 편합니다. 어떤 것을 써도 상관 없을 것 같습니다.

그런데 view가 연결되지 않은 navigationController?.title가 존재했던 이유는, NC가 view controller를 상속하기 때문입니다. 제 생각으로는 이게 상속의 단점 중에 하나인 것 같습니다. 필요 없는 property까지 상속을 해버린 거지요.

Navigation Controller에 대한 자세한 내용은 아래 링크를 참고하시면 됩니다!
https://developer.apple.com/documentation/uikit/uinavigationcontroller

from seminar-2021.

shp7724 avatar shp7724 commented on May 17, 2024

자세한 설명 감사합니다!
이슈 Close 하도록 하겠습니다.

from seminar-2021.

Related Issues (20)

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.