Question

I have a uitextview linked through IB. In my viewdidload I am setting a custom font (which works in other places so I know the name is right) and text color. None of this makes it when the view loads. I have tried every available option I can think of and the uitextview never gets the new commands to change color or use my font.

Is viewdidload the wrong place? Do IB settings override my code settings of the same object?

  [_uitv_0 setFont: [UIFont fontWithName:@"SabonLTStd-Roman" size:19.0]];

[_uitv_1 setFont: [UIFont fontWithName:@"SabonLTStd-Roman" size:19.0]];

[_uitv_2 setFont: [UIFont fontWithName:@"SabonLTStd-Roman" size:19.0]];

[_uitv_3 setFont: [UIFont fontWithName:@"SabonLTStd-Roman" size:19.0]];


[_uitv_0 setTextColor: [UIColor colorWithRed:72.0/255.0 green:72.0/255.0 blue:72.0/255.0 alpha:1.0]];

[_uitv_1 setTextColor: [UIColor colorWithRed:72.0/255.0 green:72.0/255.0 blue:72.0/255.0 alpha:1.0]];

[_uitv_2 setTextColor: [UIColor colorWithRed:72.0/255.0 green:72.0/255.0 blue:72.0/255.0 alpha:1.0]];

[_uitv_3 setTextColor: [UIColor colorWithRed:72.0/255.0 green:72.0/255.0 blue:72.0/255.0 alpha:1.0]];
Was it helpful?

Solution

viewDidLoad is a good method to init your objects and it should work.

Also, IB never overrides your settings in the viewDidLoad method. The settings loaded by IB are loaded before the viewDidLoad so you can do your custom initiation there.

Your code is correct and you are probably overriding it elsewhere or setting a transform after that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top