It is my text label:
@property (strong, nonatomic) IBOutlet UILabel *textEmail;
_titleGet = [_dictionaryGeter objectForKey:@"Email"];
_textEmail.text= _titleGet;
objectForKey:@"Email" from plist
I want to make button. How to make that button title to be equal to the textEmail?
There are two ways to set the title of a UIButton
.
Option 1 (the wrong way):
myButton.titleLabel.text = myString
Option 2 (the right way):
[myButton setTitle:myString forState:UIControlStateNormal];
So, your code would be:
_titleGet = [_dictionaryGeter objectForKey:@"Email"];
[_btn setTitle:_titleGet forState:UIControlStateNormal];
To change a buttons text is pretty much the same
@property (strong, nonatomic) IBOutlet UIButton *buttonEmail;
_titleGet = [_dictionaryGeter objectForKey:@"Email"];
_textEmail.text= _titleGet;
buttonEmail.text = _titleGet;
Your code is great just a small bug i found:
Just change
_textEmail.text= _titleGet;
to
_textEmail.titleLabel.text= _titleGet;
Try This
_titleGet = [_dictionaryGeter objectForKey:@"Email"];
NSString *valueToSave = _titleGet
[[NSUserDefaults standardUserDefaults] setObject:valueToSave forKey:@"keyYourChoice"];
[[NSUserDefaults standardUserDefaults] synchronize];
NSString *xyx = [[NSUserDefaults standardUserDefaults]
stringForKey:@"keyYourChoice"];
_textEmail.text= xyx;
THANK YOU