UIStackView programmatically

demo This project demonstrates how to: – Create a UIStackView – add uiviews to it – add constraints to the uiviews – make each uiview appear and disappear http://angelolloqui.com/blog/36-Oddities-of-UIStackView https://developer.apple.com/documentation/uikit/uiview/1622572-translatesautoresizingmaskintoco Creating a constraint Say you want to create a constraint. That constraints sits on constraint creation conveniences such as heightAnchor, widthAnchor, topAnchor, leftAnchor, etc. Any […]

Table within a table

table within a table UITableViewDataSource’s cellForRowAtIndexPath For a certain row, use your custom cell that has the tableview.

UITableViewDelegate’s heightForRowAtIndexPath Make sure your table view delegate method heightForRowAtIndexPath is appropriate so people can see your custom cell.

The cell that contains the inner table Create your tableview with its associated data array, then […]

Table row animation

Assuming you have basic table with data set up, this is how you do row animations on it. To remove a row from the end

To add a row to the end

To reload all sections in a table

Move a row

Design pattern in ViewController, delegate, dataSource

ViewController.h

ViewController.m The concept of delegate is that we can delegate messages to another object, as long as that object conforms to the delegate. Once an object conforms to a delegate, it just simply needs to implement the delegate methods and that’s it. Hence in our example, everything starts at tableView. tableView has 2 […]

Static methods vs class methods

https://stackoverflow.com/questions/29636633/static-vs-class-functions-variables-in-swift-classes static and class both associate a method with a class, rather than an instance of a class. The difference is that subclasses can override class methods; they cannot override static methods. Cannot override final functions Finally, you can finalize your override like so:

Should IBOutlet be weak or strong?

https://stackoverflow.com/questions/7678469/should-iboutlets-be-strong-or-weak-under-arc/7729141#7729141 …the outlets to subviews of the view controller’s view can be weak, because these subviews are already strongly owned by the top-level object of the nib file. However, when an Outlet is defined as a weak pointer and the pointer is set, ARC calls the runtime function:

This adds the pointer (object) to […]