Search code examples
iphonexcode4uiviewcontroller

Accessing views in relative way


I'm new to xcode and I've one basic question about relative accessing views in ViewController.

Here is the situation in ViewController:

View
  1
    1.1
  2

Questions:

  1. How can I access 2 from View
  2. How can I access 1.1 from 2
  3. How can I access from 1.1 to View

Thank you very much, single lines of code will be perfect answer.


Solution

    1. You can use tagging. I don't prefer this method but it's fast to implement. See viewWithTag:.
    2. Or you can save view as instance variables.