ios - How do I reach a sender's parent view? -
i have button within custom cell. when tapped button presents view via modal segue.
so, here's question, in prepareforsegue:sender: want pull indexpath of cell contains button(sender) pushed. how cell's indexpath?
i thought like:
uitableviewcell * cell = sender.parent
obviously doesn't work way.
please help me out.
update @rmaddy i've tried [[sender superview] superview]
, got cell in button held , it's indexpath. answers guys!
assuming sender
uiview
of sort (such uibutton
), then:
uiview *parentview = [(uiview *)sender superview];
if positive button's superview table cell can do:
uitableviewcell *cell = (uitableviewcell *)[(uiview *)sender superview];
once have cell, utilize table view's indexpathforcell:
method.
keep in mind if added button cell's contentview
or other subview of cell, getting cell button bit trickier.
ios objective-c cell
No comments:
Post a Comment