UIButton Title doesn't return the correct value when re-setting it

Originator:eli.braginskiy
Number:rdar://16599786 Date Originated:12-Apr-2014 06:45 AM
Status:Open Resolved:NO
Product:iPhone Product Version:iOS
Classification:Serious Bug Reproducible:ALWAYS
 
Summary:
When creating a custom UIButton and setting its titleLabel text to a string, after setting it to an empty string `@""` or to nil button.titleLabel.text returns the previous value

Steps to Reproduce:
1.create a UIButton
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
2.Set its value to a string
[button setTitle:TITLE forState:UIControlStateNormal];
3.button.titleLabel.text returns the correct value
4.Set its value to an empty string `@""` or `nil` or `NULL`
[button setTitle:@"" forState:UIControlStateNormal];
[button setTitle:nil forState:UIControlStateNormal];
[button setTitle:NULL forState:UIControlStateNormal];
5.button.titleLabel.text returns the previous value, button.titleLabel.text.length returns the previous value.

Expected Results:
I would like for button.titleLabel.text.length return the correct length (0) instead of the value for the previous title that was set.
I would like for button.titleLabel.text to return an empty string or a nil

Actual Results:
button.titleLabel.text.length returns the previous length
button.titleLabel.text returns the previous title text

Version:
iOS 7,6, probably every single iOS 

Notes:


Configuration:
Xcode

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!