This might be a silly and really simple question, but I've not been able to solve it.
I have a view controller with a black background onto which I have placed a PickerView control. I have set the delegate and datasource and have confirmed they are working properly.
When I place the same picker view onto a black background, and set the tint to white and the background color to clear, the picker view is invisible. All I am trying to do is have white fonts on a black background, that is, have the picker view visible. The only way I have found to make the picker view visible is to set the background to white, which defeats the design of this app.
Obviously I am missing something, but what? Any suggestions? Thanks!
The tint option will make the background view tinted.
If you want the text to be in white color you should set the text color to white like this (source):
- (NSAttributedString *)pickerView:(UIPickerView *)pickerView attributedTitleForRow:(NSInteger)row forComponent:(NSInteger)component {
NSString *title = @"sample title";
NSAttributedString *attString = [[NSAttributedString alloc] initWithString:title attributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]}];
return attString;
}