I have a custom UIButton that has the label “Name”. When the user clicks this button, it loads another View that displays a list of names, and tapping a name pops this View off, and updates the UIButton with the selected name.
That part works. What doesn’t work is if the user doesn’t select a name from the View, but instead just hits Back. The view is popped off, but now the UIButton text “Name” is removed, and the button text is completely blank. How do I stop the text label from being erased?
I don’t have any code that updates the UIButton label except if a row is tapped (didSelectARowAtIndexPath) so I don’t understand how the label “Name” is being cleared upon loading a new View. Note that I have three of these buttons w/similar functionality, and only the text of the respective button is erased when tapped – the other two aren’t impacted.
Set a breakpoint in your
didSelectARowAtIndexPathmethod and see where it is being called from. You can read Apple’s Debugging Applications document for more on using XCode’s debugger, or you can just google for “xcode debugging tutorial”.