ios - IBOutlets/actions and custom subview -


apologies if seems straightforward question! i'm using avfoundation build custom camera app allows user draw on image after it's taken (similar snapchat).

i have camera functionality working. currently, after shutter button pressed add (as subview) standard uiimageview display photo taken. seeing want there custom options @ stage (including drawing on image), proceeded create own subclass of uiimageview. designing view in interface builder (xib file).

say instance have button on custom view, when pressed, deletes image , takes me camera view take image. can handle ibactions custom view within viewcontroller camera view? bad practice?

any guidance on how best implement appreciated! thanks.

i not suggest putting button on custom view.

i have uiviewcontroller display custom view , give display button action. uiviewcontroller want display uitoolbar @ bottom of screen allow multiple buttons/actions, that's you.

but why this? compartmentalization. custom view has no need or use button. it's meaningless doing... displaying image. custom view used in many locations, several of won't want button displayed. if custom view had button wouldn't know if tapped it. have pass interaction off view controller cares action , and handle it. custom view have public methods allowing other code give directions (like clear or undo).

depending on things go, may decide want custom uiviewcontroller handles interactions on custom view. other view controllers add in containerized view controller , have same functionality no code duplication @ several places in applications.


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -