I am trying to remove the white view behind the alphabet indexer but have had no luck.
I am trying to make it clear but nothing has worked for me so far.
sectionIndexBackgroundColor is what your looking for. You can do something like this,
tableView.sectionIndexBackgroundColor = [UIColor clearColor];
If you want to change the color of the highlighted state, use the following property.
tableView.sectionIndexTrackingBackgroundColor = [UIColor redColor];
Keep in mind that sectionIndexBackgroundColor became available in iOS7. So if your supporting iOS6 you might want to call something like this.
if ([tableView respondsToSelector:#selector(sectionIndexBackgroundColor)]) {
tableView.sectionIndexBackgroundColor = [UIColor clearColor];
}
Related
I put a background image in a UITableViewCell to make it more visually appealing. In iOS 13, the background image is clipped by the reorder control.
This did not happen with older versions of the OS.
The code is simple:
// Put a border around mBackgroundImage. Make it slightly smaller than the size of the cell so that the border doesn't run all the way to the edges.
cell.mBackgroundImage.frame = CGRectMake(2, 2, cell.frame.size.width-4, cell.frame.size.height-4);
cell.mBackgroundImage.layer.cornerRadius = 4;
cell.mBackgroundImage.layer.borderColor = [UIColor colorWithWhite:0.92 alpha:1.0].CGColor;
cell.mBackgroundImage.layer.borderWidth = 1;
cell.mBackgroundImage.layer.backgroundColor = [UIColor colorWithRed:1.0 green:1.0 blue:0.95 alpha:1.0].CGColor;
Any suggestions?
Problem solved by setting cell.contentView.clipsToBounds to NO. It looks like cell.contentView.clipsToBounds=YES had been ignored prior to iOS 13.
I have tried to change the background color of NSView like this in iOS,
self.titleview.backgroundcolor = [UIColor redColor];
But no property like that exists so after it, I tried,
self.titleBarView.layer.backgroundColor = [[NSColor redColor]set];
But it shows some error.
self.titleBarView.layer.backgroundColor = [NSColor redColor].CGColor;
If you do not want to use view.layer. You can use NSBox (with custom style) over NSView. NSBox has fillColor property.
In the IOS 7 UILocalizedIndexedCollation are looking very odd and i would like to customise the background color and text color, i have googled everywhere but no success, If somebody able to get something on this please help me
self.tableView.sectionIndexColor = [UIColor darkGrayColor];
self.tableView.sectionIndexBackgroundColor = [UIColor clearColor];
this truly help by "rmaddy"
UILocalizedIndexedCollation has no public properties for setting its appearance, which means that you cannot customize it in a direct way.
It looks like this whenever off:
While I'd prefer more of a grey background. Do I really have to use a UIImageView?
Here is how I changed the fill color of my iOS7 UISwitch.
First you need to import QuartzCore.
#import <QuartzCore/QuartzCore.h>
Then set the background color and round the UISwitch's corners.
UISwitch *mySwitch = [[UISwitch alloc] initWithFrame:CGRectMake(0.0, 0.0, 51.0, 31.0)];
mySwitch.backgroundColor = [UIColor redColor];
mySwitch.layer.cornerRadius = 16.0; // you must import QuartzCore to do this.
[self addSubview:mySwitch];
This will give you a UISwitch with a custom off (background) color.
Hope this helps someone:)
You can set the setOnTintColor property of your UISwitch to the color you desire.
You can also set this for the switch in Interface Builder. Just set the background colour of the UISwitch to whatever colour you want (white, in the example below), then set a User Defined Runtime Attribute of layer.cornerRadius = 16:
There's no API support for changing the off fill color of a UISwitch.
Adjusting the tintColor will only affect the outline, and adjusting the backgroundColor will affect the whole frame, including the parts outside the rounded bounds.
You either have to place a properly shaped opaque UIView behind it or - easier - use a custom open source implementation, such as MBSwitch, which allows you to set the off fill color.
You can also use an image as background, using the [UIColor colorWithPatternImage];
mySwitch.onTintColor = [UIColor colorWithPatternImage:[UIImage imageNamed:#"toggle-bg-on"]];
mySwitch.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:#"toggle-bg-off"]];
Adding to Barry Wyckoff solution : set tint color also
UISwitch *mySwitch = [[UISwitch alloc] initWithFrame:CGRectMake(0.0, 0.0, 51.0, 31.0)];
mySwitch.backgroundColor = [UIColor redColor];
mySwitch.layer.cornerRadius = 16.0; // you must import QuartzCore to do this.
mySwitch.tintColor = [UIColor redColor];
[self addSubview:mySwitch];
I'd like to create a UISegmentedControl that's styled similarly to the flash and hdr controls in the camera app. (i.e. black outline, black text, frosted semi-translucent background)
Any suggestions to do this?
Thanks,
You might want to follow this tutorial http://www.raywenderlich.com/4344/user-interface-customization-in-ios-5 to understand how to customize UIKit controls with your own assets.
The idea is that you will use UIAppearance and will have to create a few assets for the various possible states (selected/unselected, left/right...)
#JP... Thanks for the answer. In the interim, I found a way to do it.
I'm placing the segmented controller as an overlay on a map to change the map's style (standard/satellite/hybrid) as in google maps. Note the subtle change in the background color - that's to increase readability on standard-style maps which tend do have a much lighter background than satellite-based images.
- (void) setMapSelectorColors:(UISegmentedControl *)control {
NSDictionary *mapStyleSelectorTextAttributes = [NSDictionary dictionaryWithObject:[UIColor blackColor] forKey:UITextAttributeTextColor];
[self.mapStyleSelector setTitleTextAttributes:mapStyleSelectorTextAttributes forState:UIControlStateNormal];
if (control.selectedSegmentIndex == 0) {
self.mapStyleSelector.tintColor = [UIColor lightGrayColor];
} else {
self.mapStyleSelector.tintColor = [UIColor whiteColor];
}
}