title: Calling a method in a UIViewController from a UIButton in a subview
body: <p>Still learning about Objective C and getting the structure right.</p>
  
  <p>I have an iOS App with a UIViewController that has a defined method named "doSomething". In my view controller I have a view and in that view a number of UIButton that I create programmatically (see example below with one button).</p>
  
  <p><img src="https://i.stack.imgur.com/5nMcw.jpg" alt="enter image description here"></p>
  
  <p>Now when I press the button I want to call my method "doSomething". The way I currently do it is like this:</p>
  
  <pre><code>[myButton addTarget:nil 
               action:@selector(doSomething:)
       forControlEvents:UIControlEventTouchUpInside];
  </code></pre>
  
  <p>Since my target is nil it goes up the responder chain until it finds a method called "doSomething". It works, but it does not really feel right.</p>
  
  <p>I have started to look into using @protocol but not really got my head around it. I have been looking at some tutorials but for me it is not clear enough. I have used protocols like  for the table view controllers, but defining one is new for me.</p>
  
  <p>Would it be possible to get an example for this specific case?</p>
  
  <p>Thanks!</p>