Quantcast
Channel: Cocoanetics
Viewing all articles
Browse latest Browse all 428

Radar: First Responder defunct when used in Storyboard

$
0
0

Hot on the heels of my research into the responder chain comes this bug report. Nikita Korchagin deserves the main credit for mentioning this first to me.

Turns out that Apple broke the responder chain as it used to work on Mac and non-storyboard apps. I’m filing this as a bug report to find out if this indeed a bug or an “undocumented feature”. rdar://12402078

 

Summary

Controls hooked up to user-defined actions on the First Responder proxy object fail to message the responder chain.

Steps to Reproduce

  • Create a new Utility app
  • Add a doSomething:(id)sender to the app delegate, add a breakpoint there
  • in the storyboard for FlipsideViewController define doSomething: under user-defined actions
  • replace the link of the Done button with one to the First Responder proxy object and choose the doSomething action
  • Build&Run

Expected Results

The action should travel the responder chain and end up at the breakpoint in the app delegate

Actual Results

No action is invoked

Regression

The behavior is broken in Storyboards. It works when not using story boards.

Notes

On a non-storyboard app the sendAction of UIApplication has the next upper view controller as target. When using a storyboard the sendAction instead messages the UIBarButtonItem first. I suspect that because UIBarButtonItem is not a UIResponder subclass the default behavior is for the event bubbling to stop there.

If you add a new button to the FlipsideController and also hook this hop to the doSomething: action it doesn’t even call the application’s sendAction. On a non-storyboard app this would also normally send the action to the closest view controller.

flattr this!


Viewing all articles
Browse latest Browse all 428

Trending Articles