App does not update textfield from settings bundle but it does update settings from the app

StackOverflow https://stackoverflow.com/questions/16700219

문제

Hi if i change the required field in the application, then log out and log into settings, the settings have been updated perfectly. However if i then proceed to change the settings and then open the application once more the textfield has not changed.

how do i get the textfield to automatically update from the settings bundle and not just one way

this is the code i am using in the view did load

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
self.textField1.text = [defaults objectForKey:@"user_name"];
[defaults synchronize];
도움이 되었습니까?

해결책

Answered

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateMytex:)     name:UIApplicationWillEnterForegroundNotification object:nil];

I used notification center to call my updateMytex method.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top