- View controllers implement your app’s behavior.
- All view controller objects in iOS are of type UIViewController or one of its subclasses.
- You define the behavior of your view controllers in code by creating and implementing custom view controller subclasses. You can then create a connection between those classes and scenes in your storyboard to get the behavior you defined in code and the user interface you defined in your storyboard.
- what is view controller? View controllers are the foundation of your app’s internal structure. Every app has at least one view controller, and most apps have several. Each view controller manages a portion of your app’s user interface as well as the interactions between that interface and the underlying data. View controllers also facilitate transitions between different parts of your user interface.
- what is segue? Use segues to define the flow of your app’s interface. A segue defines a transition between two view controllers in your app’s storyboard file. The starting point of a segue is the button, table row, or gesture recognizer that initiates the segue. The end point of a segue is the view controller you want to display.
- Aşağıda örnek bir storyboard gösterilmiştir.
Notes :
- To open your storyboard: In the project navigator, select Main.storyboard.
Xcode opens the storyboard in Interface Builder—its visual interface editor—in the editor area. The background of the storyboard is the canvas. You use the canvas to add and arrange user interface elements.
Your storyboard should look similar to this:
At this point, the storyboard in your app contains one scene, which represents a screen of content in your app. The arrow that points to the left side of the scene on the canvas is the storyboard entry point, which means that this scene is loaded first when the app starts. Right now, the scene that you see on the canvas contains a single view that’s managed by a view controller. You’ll learn more about the roles of views and view controllers soon. ( Android'deki activity'nin IOS'daki karşılığı scene'dir. )
- UI'da gösterilen element'ler örneğin button text image vs. hepsi birer View'dir aynı android'deki gibi.
- All view objects in iOS are of type UIView or one of its subclasses.
- View controllers and gesture recognizers, define the behavior of your app but don’t appear onscreen.
- In a storyboard, a scene represents one screen of content and typically one view controller. View controllers implement your app’s behavior. (Android'deki activity'nin IOS'daki karşılığı scene'dir. Scene 2 şey içerir :
1 - Screen : Ekranın UI'ının nasıl görüneceğini belirtir. buton image vs. gibi view'ler içerir.
2 - View controller : Uygulamanın davranışını implement eder. Örneğin butona listener register etmek gibi. )
- Question : So does storyboarding replace the need for .xib files?
Answer : Ideally, Yes. 1 .storyboard file = 'n' no. of .xib files. ( 1 storyboard dosyası n tane .xib dosyasına eşittir. Yani 10 ekranlı bir ios uygulaması geliştirmek için önceden 10 tane .xib dosyası geliştirmemiz gerekiyordu. Şimdi ise .xib dosyalarını bizim geliştirmemize gerek yoktur tek yapmamız gereken 1 tane storyboard dosyası geliştirmektir. Bu storyboard dosyası, .xib dosyalarını arka planda generate eder. )
Hiç yorum yok:
Yorum Gönder