I'm having this problem regarding the displaying and updating of the username label.
User id 1 - ‘Felicia’
User id 2 - ‘Sam’
(1st screen: default user is 'Felicia')
(2nd screen: when change user to 'Sam')
(3rd screen: after clicking to another screen, the username's label auto revert back to 'Felicia' when it supposed to be 'Sam')
My ideal output is that the username's label will stay as the selected user unless user is changed and also to be able to reflect the name label on the side menu bar whenever the name is updated.
In my codes, I tried adding my methods(getUserInfo() and setUserNameLabel()) in viewDidAppear and viewDidLoad, however both scenarios are not generating the output I want.
viewDidAppear
Advantages: - Name label will reflect the update of selected user's name (User can change their name)
Disadvantages: - Name label will revert to the user id 1’s name on side menu bar when selecting other views
viewDidLoad
Advantages: - Name label won’t revert to the user id 1’s name on side menu bar when selecting other views
Disadvantages - Name label won’t reflect the update of selected user's name