06 - Intermediate User Interface Recap


In intermediate user interfaces, you have to learn matters such as the use of delegations, frame size, autolayout and constraints.


Info plist

We use the info plist file as a property list to entail the details about our app. You can read further about info plist at:

https://developer.apple.com/library/archive/documentation/CoreFoundation/Conceptual/CFBundles/BundleTypes/BundleTypes.html#//apple_ref/doc/uid/10000123i-CH101-SW1


View Controller Lifecycle

View controller life cycle is an important aspect of an app. In learning that we should look into matters such as layoutIfNeeded and setNeedsDisplay. In discussing a view controller life cycle the following functions are most important:


  • viewDidLoad: View is now created. Initialize your objects.

  • viewWillAppear: It runs every time the view appears. Don't run codes that shouldn't be repeated

  • viewDidLayoutSubviews: When the subviews are properly laid out

  • viewWillAppear: when the view has been laid out and is visible to the user. a good place to run animation, etc

  • viewDidAppear: often happening before the transition to another view controller

  • viewDidDisappear: when the view controller is no longer visible. useful to stop any continuously running tasks

  • didReceiveMemoryWarning: gets notified when you used up the available memory. You can use the built-in simulator feature to simulate a memory warning

   

Progress View

We can use a progress view to demonstrate the progress of an event. For real-life applications, we do the progress increment using a real metric such as the downloaded amount. We could also simulate that using a Timer.


Autolayout and Constraints

Using Autolayout is an important aspect of iOS development. Auto layout helps with views that operate in both portrait and landscape mods. It is also useful for when different devices want to use the same app. We should also learn about intrinsic values and learn how to specifically choose what size our different outlets have to be. You can add or clear all constraints in a view using the buttons at the bottom of the screen.


Hard Coding Interface

Hard coding an outlet is an essential skill. You should know how to use a combination of Init, Frame, CGRect, CGPoint, and CGSize for a variety of situations to develop outlets programmatically.


Autolayout in Coding

Autolayout constraints can also be added programmatically. These are useful when a group of outlets is to be created dynamically.


Stack Views

As per Apple’s own documentation, we should try and use stack views for any situation where similar outlets are placed next to each other.