When I use UIColor.blue its changing, but when I try to apply RGB, its not reflected in scrollview indicator. func scrollViewDidScroll(_ scrollView: UIScrollView) { let verticalIndicator: UIImageView = (scrollView.subviews[(scrollView.subviews.count
How to get different lighter and darker variations of a given UIColor in Swift? Updated Use below UIColor Extension: extension UIColor { func lighter(by percentage:CGFloat=30.0) -> UIColor? { return self.adjust(by: abs(percentage) ) } func darker(by
So I've been reading up on how the auto-generated background color for contacts is created. Apparently it's based on a hashCode() of a key in the contact. I've seen it said that the email is used as the key, but that makes no sense, since not all my
Why is this giving me an error? var colorArray = [UIColor.self] colorArray.append(UIColor.redColor()) //error here colorArray.removeLast() how do I define a mutable array to store
[email protected] Asda: The error coming up is "Cannot convert value typ
If i give two colors UIColor *color1 = [UIColor blackColor]; UIColor *color2 = [UIColor whiteColor]; I should get grayColor as result, how shall I achieve it?A straightforward way of finding the "in between" is to average the four components, li
I am trying to set the background colour of cell to be equal to the UI colour in the dict, but I keep getting the error below. Even though when passing this as an array it works? import UIKit class ViewController: UIViewController, UITableViewDataSou
I have a navigation bar on a viewController that I can enable/disable. The problem is I can't get the font for the UIBarButtonItems to change colors after the view initially loads, though the back arrow will change. I disable the UINavigationBar on m
There's a macro in objc file like below. #define kSOME_COLOR [UIColor colorWithRed:100/255.0 green:100/255.0 blue:100/255.0 alpha:1.0] And i wanna access the macro from Swift. self.someView.backgroundColor = kSOME_COLOR But i got compile error Use of
The document of Swift says that adding initializers in extension is possible, and the example in the document is about adding an initializer to a strut. Xcode can not associated the designated initializer of UIColor in my convenience initializer: ext
First of all I want to inform you that I'm very new to Obj-C programming, so I don't have many experiences. I've got a problem on setting the background color of an UIView. I'm using the following code: self.view.backgroundColor = [UIColor colorWithR
I have this extension: extension UIColor { func rgba(r: Int, g: Int, b: Int, a: Float) -> UIColor { return UIColor(red: r/255, green: g/255, blue: b/255, alpha: a) } } This is giving me an error message: Extra argument 'green' in call I dont get why
I am using a .kendoChart() call to create my self a pie chart. seriesColors: config.colors, tooltip: { visible: true, template: function (e) { return shared.AssetClassName(e.category) + ' ' + shared.toString(e.percentage, "p0"); } } Using series
I am trying to change the text colour in a UITextField using the following code (RGBA value) however it just appears white, or clear, I'm not too sure as the background is white itself. passwordTextField.textColor = UIColor(red: CGFloat(202.0), green
I have three custom circle UIViews which are created. When a user clicks on one of these I would like to change the background Color of the view to be Grey. When the view is originally created, it is a randomColor. I would like this color to stay aro
Hey guys I have the following: - (void)viewDidLoad { [super viewDidLoad]; // SET BACKGROUND OF APPLICATION ON STARTUP [self.view setBackgroundColor: [self colorWithHexString:@"88C800"]]; // Do any additional setup after loading the view, typical
I want to define a global colour that I can reuse for a downstate for various custom ui cells Not sure if this is the correct way to do this but.. I've defined a Class called lightGreyUIColor which has this .h file - #import <UIKit/UIKit.h> @interfa
I've been trying to display three random colors using the labels in the screen when the button is clicked. -(IBAction)spinButton:(id)sender; { NSLog(@"Spin started."); NSLog(@"Message"); NSLog(@"Message %@", nsString); printf
I want not to change the backgroundColor of an UIImage, but rather to change the color of the whole image. Because I have got standard forms which I can move from popover to the view. In my App it is possible to tinker the images to one big image, i.
There is a UITabBarController - (void)getToMCGatherViewController { mCGatherViewController = [[MCGatherViewController alloc] initWithNibName:@"MCGatherViewController" bundle:nil]; UINavigationController *navigationController = [[UINavigationCont
i have a problem in converting uicolor to hex color, here what i found CGColorRef colorref = [[Colorview_ backgroundColor] CGColor]; int numComponents = CGColorGetNumberOfComponents(colorref); if (numComponents == 4) { const CGFloat *components = CGC
I'm trying to animate UITextField border color (fade in). Here is what I try tmp.layer.borderColor= [UIColor colorWithRed:255.0 green:0.0 blue:0.0 alpha:0.0].CGColor; tmp.layer.borderWidth = 1.0f; [UIView beginAnimations:nil context:nil]; [UIView set
I want to change UIButton color from brown color to darkbrown color. How i can do that myButton.backgroundColor = [UIColor brownColor]; Any ideas that how to change this brown color to darkbrown color. Thanks for help.If you just want a darker brown
I have troubles with setting my patterned UIColor. In iOS 5 it's all good, but in iOS 4.3 I get the issue. I added an image for better understanding. I already Googled a bit, and found that the answer is possibly the setting of the opaque property to
I want to make a global UIColor value. In AppDelegate.m I write UIColor *fontcolor; fontcolor = [UIColor colorWithRed:0.0 green:0.0 blue:1.0 alpha:1.0]; In MainViewController.m I write extern UIColor *fontcolor; [cell.textLabel setTextColor: fontcolo
In Objective-C xcode project I have a plist file with which associates integers with hex-color codes. Dynamically I want to use this color-code from plist file and pass that hex value to the following macro to get the UIColor object. Macro: #define U
I'm trying to change the background color of a button when it's selected and don't want to use an image. [mBtn setBackgroundColor:[UIColor grayColor] forState:UIControlStateHighlighted]; Any thoughts? [mBtn setTintColor:[UIColor grayColor]]; This onl
I stumbled upon this many times, never found a solution. A UINavigationController's navigationBar can be set to black translucent like: self.navigationController.navigationBar.barStyle=UIBarStyleBlackTranslucent; Also, there is a translucent property
I am just in the process of tracking down some memory leaks with Instruments. It claims I am leaking in the middle of a drawRect method. Here is the code: - (void)drawRect:(CGRect)rect { if (highColor && lowColor) { // Set the colors for the gradi
a noob question here. let's say I have RGB values of: R:53,G:37 and B:11 so i set a background color of a rectangle with: [UIColor colorWithRed:0.53 green:0.37 blue:0.11 alpha:1.00]; now I do a RGB to HSL conversion that yields: H:0.10,is S:0.16 and
I want to set a background image of UIToolbar in my iPhone application. Currently I am setting by using the UIColor's initWithPatternImage:. But it's not doing what I want. Kindly suggest some other solution.Or you can Make custom class and assign it