Re: Control default color inconsistencies
On 14.12.2016 at 18:47 Gary L. Wade wrote: > Set the background color of self.view to something other than black > and your button and label will be more visible. Thanks, that was indeed the problem. UIButton and UILabel both seem to use a clear background color as the default, which resulted in the UIView's background color, which was black, shining through them. I'm now stealing the default background color of the UITableView for my UIView to get a consistent look, i.e. I'm doing the following in my view controller's viewDidLoad(): self.view.backgroundColor = tableView.backgroundColor; Everything looks correctly then. -- Best regards, Andreas Falkenhahnmailto:andr...@falkenhahn.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Control default color inconsistencies
On Dec 14, 2016, at 09:38 , Andreas Falkenhahnwrote: > > But, as I wrote in > my last mail, this default look is pretty confusing and irritating because > background and foreground color aren't consistent at all. You’re assuming that the “default” colors of the various controls (the colors you get if you don’t configure colors) are supposed to be the “standard” colors. What you’ve discovered is that this isn’t true. When you create controls programmatically, you take on the responsibility of deciding how your app should look. If you decide it should look like other apps, then it’s also your responsibility to implement that. If you implement that, it’s also your responsibility to change your app when the look of the rest of the apps changes with the iOS version. Looking at these controls as configured by IB, I see that the "IB default" is typically a clear background. — I’m not sure why your UILabel defaults to the same color as the foreground, but I don’t see why you should be concerned about programmatically setting its background color to clear. The IB default foreground color is black. — The IB default background for a UIView is gray, and the IB default background for a UITableView is clear. Cell views in IB have a white background. That means that section headers and footers let the gray background show through, and details rows have white backgrounds. — The IB default color for button text is the tint color, which happens to be blue. According to that information, you should set the UILabel background to clear or white, and set your cell view backgrounds to white, and leave everything else alone. Also, take a look at view appearances. You might be able to use that API to ensure a consist look for all your controls without configuring every property manually for each UIControl instance. I’d emphasize that if you set colors manually, you can’t necessarily expect that iOS will adjust your colors for new system designs in the future, whereas it may do this for apps that use IB-configured controls. That’s something you might lose by opting out of IB. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Control default color inconsistencies
Set the background color of self.view to something other than black and your button and label will be more visible. I believe the color for your table view is a UIColor defined as a category in UITableView.h or close to there. -- Gary L. Wade (Sent from my iPad) http://www.garywade.com/ > On Dec 14, 2016, at 9:38 AM, Andreas Falkenhahn> wrote: > >> On 14.12.2016 at 17:54 じょいすじょん wrote: >> >> Nobody can guess what you are actually doing. >> Please share some code so people can help you. > > There is not much code to share. My code just creates UILabel, UIButton, > and UITableView with absolutely minimal customization, the intention > being to check out the default look of those controls. But, as I wrote in > my last mail, this default look is pretty confusing and irritating because > background and foreground color aren't consistent at all. > > I'd like to avoid hard-coding specific colors as this is bad GUI coding > practice on the desktop systems I come from. I'd like iOS to use the > default colors instead but I'm not sure how to do this. > > For reference, here is how I create the objects: > >UIScreen *myScreen = [UIScreen mainScreen]; >CGRect rect = [myScreen bounds]; > >// results in a UILabel that has black background and foreground, i.e. > text is unreadable >UILabel *header1 = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, > rect.size.width, 48)]; >header1.text = @"Label test"; >[self.view addSubview:header1]; > >// results in gray background with black text >UITableView *tableView = [[UITableView alloc] > initWithFrame:CGRectMake(0, 48, rect.size.width, rect.size.height - (48 + > 80))]; >tableView.dataSource = self; >tableView.delegate = self; >tableView.autoresizingMask = > UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth; >[tableView registerClass:[UITableViewCell class] > forCellReuseIdentifier:@"Cell"]; >[tableView reloadData]; >[self.view addSubview:tableView]; > >// results in black background with blue label text >UIButton *optionsButton = [UIButton > buttonWithType:UIButtonTypeRoundedRect]; >[optionsButton addTarget:self action:@selector(clickOptions:) > forControlEvents:UIControlEventTouchUpInside]; >[optionsButton setFrame:CGRectMake(0, rect.size.height - 80, > rect.size.width, 80)]; >[optionsButton setTitle:@"Button test" forState:UIControlStateNormal]; >[optionsButton setExclusiveTouch:YES]; >[self.view addSubview:optionsButton]; > > The controls are created in a UIViewController inside the viewDidLoad() > method. This > UIViewController is then set as the UIWindow's rootViewController. > > -- > Best regards, > Andreas Falkenhahnmailto:andr...@falkenhahn.com > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Control default color inconsistencies
On 14.12.2016 at 18:41 Alex Zavatone wrote: > On Dec 14, 2016, at 9:47 AM, Andreas Falkenhahn wrote: > I'm creating my GUI programmatically. It simply consists of a UILabel, > a UITableView and two UIButtons. > Mac OS or iOS? Please state the specifics first so that we can > stop reading if we don't have experience in the area of your problem. Thanks. Huh? Aren't UIButton and UITableView iOS-specific with NSButton and NSTableView being the macOS equivalents? But to answer your question: It's iOS but I thought you could've guessed that because AFAIU UIButton and the likes are UIKit which is iOS. -- Best regards, Andreas Falkenhahnmailto:andr...@falkenhahn.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Control default color inconsistencies
On Dec 14, 2016, at 9:47 AM, Andreas Falkenhahn wrote: > I'm creating my GUI programmatically. It simply consists of a UILabel, > a UITableView and two UIButtons. Mac OS or iOS? Please state the specifics first so that we can stop reading if we don't have experience in the area of your problem. Thanks. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Control default color inconsistencies
On 14.12.2016 at 17:54 じょいすじょん wrote: > Nobody can guess what you are actually doing. > Please share some code so people can help you. There is not much code to share. My code just creates UILabel, UIButton, and UITableView with absolutely minimal customization, the intention being to check out the default look of those controls. But, as I wrote in my last mail, this default look is pretty confusing and irritating because background and foreground color aren't consistent at all. I'd like to avoid hard-coding specific colors as this is bad GUI coding practice on the desktop systems I come from. I'd like iOS to use the default colors instead but I'm not sure how to do this. For reference, here is how I create the objects: UIScreen *myScreen = [UIScreen mainScreen]; CGRect rect = [myScreen bounds]; // results in a UILabel that has black background and foreground, i.e. text is unreadable UILabel *header1 = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, rect.size.width, 48)]; header1.text = @"Label test"; [self.view addSubview:header1]; // results in gray background with black text UITableView *tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 48, rect.size.width, rect.size.height - (48 + 80))]; tableView.dataSource = self; tableView.delegate = self; tableView.autoresizingMask = UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth; [tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"Cell"]; [tableView reloadData]; [self.view addSubview:tableView]; // results in black background with blue label text UIButton *optionsButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [optionsButton addTarget:self action:@selector(clickOptions:) forControlEvents:UIControlEventTouchUpInside]; [optionsButton setFrame:CGRectMake(0, rect.size.height - 80, rect.size.width, 80)]; [optionsButton setTitle:@"Button test" forState:UIControlStateNormal]; [optionsButton setExclusiveTouch:YES]; [self.view addSubview:optionsButton]; The controls are created in a UIViewController inside the viewDidLoad() method. This UIViewController is then set as the UIWindow's rootViewController. -- Best regards, Andreas Falkenhahnmailto:andr...@falkenhahn.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Control default color inconsistencies
Seeing code and how you have things visually laid out will help, but most likely what you think are black backgrounds may be clear backgrounds showing through to another view or super view that has black as its background color. You may have very valid reasons for doing this in code, but before doing that, try working through things in Interface Builder first so you get an idea of what you need to do. -- Gary L. Wade (Sent from my iPad) http://www.garywade.com/ > On Dec 14, 2016, at 7:47 AM, Andreas Falkenhahn> wrote: > > I'm creating my GUI programmatically. It simply consists of a UILabel, > a UITableView and two UIButtons. > > When creating those three controls I've noticed that they all seem to > use different color schemes by default which makes the GUI look rather > silly. > > Here are my observations: > > 1) By default, UILabel seems to set both background and text color to > black, i.e. nothing is readable before you change the colors to some > more meaningful values. > > 2) By default, UITableView appears with a gray background and black > text on top. > > 3) By default, UIButton appears with a black background and blue (!) > text on top. > > Is there any rationale why all three controls seem to use entirely > different color schemes by default here? > > When writing desktop GUIs it's bad practice to use custom color schemes > because they might clash with the user's theme settings. Doesn't such > a paradigm apply to iOS as well? Or am I really forced to explicitly > set foreground and background colors for each UI control? I'd really > prefer to use the default iOS look instead. On Android I don't have to > set background and foreground colors either, the OS will automatically > use some meaningful and consistent (!) default colors. > > This makes me wonder if there is a default iOS color scheme for apps > at all? Or are all apps supposed to define their own color scheme? > If there is a default iOS color scheme, why don't the controls use > it then when not specifying any colors? > > It's all quite confusing... I hope somebody can shed some more light > onto this. But please no lectures on that I should use Interface Builder, > Storyboard, or whatever it is called now instead, I really like to do > things manually - always have, always will ;) > > -- > Best regards, > Andreas Falkenhahn mailto:andr...@falkenhahn.com > ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Re: Control default color inconsistencies
> On 2016 Dec 15, at 0:47, Andreas Falkenhahnwrote: > > I'm creating my GUI programmatically. It simply consists of a UILabel, > a UITableView and two UIButtons. > > When creating those three controls I've noticed that they all seem to > use different color schemes by default which makes the GUI look rather > silly. > > Here are my observations: > > 1) By default, UILabel seems to set both background and text color to > black, i.e. nothing is readable before you change the colors to some > more meaningful values. > > 2) By default, UITableView appears with a gray background and black > text on top. > > 3) By default, UIButton appears with a black background and blue (!) > text on top. > > Is there any rationale why all three controls seem to use entirely > different color schemes by default here? > > When writing desktop GUIs it's bad practice to use custom color schemes > because they might clash with the user's theme settings. Doesn't such > a paradigm apply to iOS as well? Or am I really forced to explicitly > set foreground and background colors for each UI control? I'd really > prefer to use the default iOS look instead. On Android I don't have to > set background and foreground colors either, the OS will automatically > use some meaningful and consistent (!) default colors. > > This makes me wonder if there is a default iOS color scheme for apps > at all? Or are all apps supposed to define their own color scheme? > If there is a default iOS color scheme, why don't the controls use > it then when not specifying any colors? > > It's all quite confusing... I hope somebody can shed some more light > onto this. But please no lectures on that I should use Interface Builder, > Storyboard, or whatever it is called now instead, I really like to do > things manually - always have, always will ;) > > -- > Best regards, > Andreas Falkenhahn mailto:andr...@falkenhahn.com Nobody can guess what you are actually doing. Please share some code so people can help you. ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com
Control default color inconsistencies
I'm creating my GUI programmatically. It simply consists of a UILabel, a UITableView and two UIButtons. When creating those three controls I've noticed that they all seem to use different color schemes by default which makes the GUI look rather silly. Here are my observations: 1) By default, UILabel seems to set both background and text color to black, i.e. nothing is readable before you change the colors to some more meaningful values. 2) By default, UITableView appears with a gray background and black text on top. 3) By default, UIButton appears with a black background and blue (!) text on top. Is there any rationale why all three controls seem to use entirely different color schemes by default here? When writing desktop GUIs it's bad practice to use custom color schemes because they might clash with the user's theme settings. Doesn't such a paradigm apply to iOS as well? Or am I really forced to explicitly set foreground and background colors for each UI control? I'd really prefer to use the default iOS look instead. On Android I don't have to set background and foreground colors either, the OS will automatically use some meaningful and consistent (!) default colors. This makes me wonder if there is a default iOS color scheme for apps at all? Or are all apps supposed to define their own color scheme? If there is a default iOS color scheme, why don't the controls use it then when not specifying any colors? It's all quite confusing... I hope somebody can shed some more light onto this. But please no lectures on that I should use Interface Builder, Storyboard, or whatever it is called now instead, I really like to do things manually - always have, always will ;) -- Best regards, Andreas Falkenhahn mailto:andr...@falkenhahn.com ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com