UILabel is built in the interface builder. This is part of a UITableViewCell, its color is set in the red color in the Builder Builder.
I create cells here:
- (UITableViewCell *) TableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) index {static NSString * CellIdentifier = @ "Notation Mail"; Notification cell * cell = [Tableview deevor reusable cell with iddatifier: Cell Identified for Indeppeth: IndexPath]; // Configure cell ... cell.Notation = [self.notation object atindex: indexpath.ro]; Before UIColor * = cell.symbolLabel.textColor; Cell.symbolLabel.text = @ "New Text"; UIColor * after = cell.symbolLabel.textColor; Return cell; } The first is red, as it is intended. But after changing the text UIDeviceWhiteColorSpace 0 becomes 1 after color, and the text becomes black I am using the layout myself.
Why does the text change its color?
found a solution I have created a category:
@implementation UILabel (KeepAttributes) - (Zero) setTextWithKeepingAttributes: (NSString *) Text {NSDictionary * attributes = [(NSAttributedString *) self.attributedText attributesAtIndex: 0 Effective Range: Zero]; Self.attributedText = [[NSAttributedString alloc] initWithString: Text attributes: attributes]; } @end Then this method was used to change the text.
No comments:
Post a Comment