Because we are creating a UIBarButtonItem that is using a customView which has an underlying implementation of UIButton, we must specify the target and selector on the UIButton itself.
Because the original implementation for a custom UIBarButtonItem Sets the target and action properties on the UIBarButtonItem itself, the selector function is never called because the selector needs to on the UIButton.
We could create our UIButton and specify the selector but then the delegate method for getting a custom done button is never called because we can't access it.
Because we are creating a
UIBarButtonItem
that is using acustomView
which has an underlying implementation ofUIButton
, we must specify the target and selector on theUIButton
itself.Because the original implementation for a custom
UIBarButtonItem
Sets thetarget
andaction
properties on theUIBarButtonItem
itself, theselector
function is never called because theselector
needs to on theUIButton
.We could create our UIButton and specify the
selector
but then the delegate method for getting a custom done button is never called because we can't access it.