General and UI

1. What are the states of an iOS App?

  • Non-running — The app is not running.
  • Inactive — The app is running in the foreground, but not receiving events. An iOS app can be placed into an inactive state, for example, when a call or SMS message is received.
  • Active — The app is running in the foreground, and receiving events.
  • Background — The app is running in the background, and executing code.
  • Suspended — The app is in the background, but no code is being executed.

2. What is reuse identifier in table view used for?

  • The reuse identifier is associated with a UITableViewCell object that the table-view's delegate creates with the intent to reuse it as the basis (for performance reasons) for multiple rows of a table view.
  • It is assigned to the cell object in initWithFrame:reuseIdentifier: and cannot be changed thereafter.
  • A UITableView object maintains a queue (or list) of the currently reusable cells, each with its own reuse identifier, and makes them available to the delegate in the dequeueReusableCell(withIdentifier:) method.

3. What is Responder Chain?

  • The responder chain is a series of linked responder objects.
  • It starts with the first responder and end with the application object.
  • If the first responder cannot handle an event, it forwards the event to the next responder in the responder chain.
  • Each of these events will be handled and processed by the application singleton before being dispatched to the appropriate receivers which follows the responder chain.

4. What's your preference when writing UI's? Xib files, Storyboards or programmatic UIView?

Storyboard's and Xib's are great for quickly producing UI's that match a design spec. They are also really easy for product managers to visually see how far along a screen is. Storyboard's are also great at representing a flow through an application and allowing a high-level visualization of an entire application. Storyboard's drawbacks are that in a team environment they are difficult to work on collaboratively because they're a single file and merge's become difficult to manage. Storyboards and Xib files can also suffer from duplication and become difficult to update. For example if all button's need to look identical and suddenly need a color change, then it can be a long/difficult process to do this across storyboards and xibs. Programmatically constructing UIView's can be verbose and tedious, but it can allow for greater control and also easier separation and sharing of code. They can also be more easily unit tested. Most developers will propose a combination of all 3 where it makes sense to share code, then re-usable UIViews or Xib files.

5. How to extract all UILabels in NSArray from given UIView?

results matching ""

    No results matching ""