I would like to set a background "overlay" for my UILabel, and have it to only color the part of the label with text, instead of the entire rectangle. See the image below.
What is the best way for this to be done?
Related
I'm trying to emulate the functionality of the Safari url text field (using NSTextField). I'd like the current text to be displayed centered, but when the user clicks on it the text should highlight and slide to the left. I've got the highlighting working but I'm not sure how to go about animating the text over to the left. Is it possible to animate the Alignment property or would I need to do some sort of custom drawing where I animate the position that the text is drawn?
Unfortunately this (Is there a way to animate changing a UILabel's textAlignment?) won't work, since a text field draws a background and border so animating the frame isn't an option.
I am trying to put a transparent table view over a map. First, I set backgroundcolor as clearColor and it didn't work. Then I set alpha on the table view as 0.5 then it is transparent but text in labels also transparent. I want to see through the map but text in label should stand out. I reset the alpha on the label but it is still not effective. How can I do this in iOS7?
Thanks!
You need to set the background color of each table cell as clearColor. Set this in your cellForRowAtIndexPath method.
How can I add a background color to the title label of a IKImageBrowserCell ?
The text is not anymore visible because of the background, I would like to change the background of the label only.
thanks
It Looks like, it is inherited from NSObject. may not possible to set background color. Because UIBackgroundcolor is property of UIView. It is having a view called IKImageBrowserView should be useful.
is it possible to set a background color to a transparent image in QML, so that the image will take the theme color as it's baclground color.
thanks...
Put your transparent Image over a coloured Item (like a Rectangle).
You just need to set z property of the Image greater than the Rectangle's one.
I have a NSSearchField and I want to change its background color but i am not able to do it i tried out few things:
1) I tried to set DrawBackground TRUE and then setBackgroundColor but the value of DrawBackGround is always False either I try to set it trough code or Nib.(i don't know why?)
2)I tried out setting NSText's BackgroundColor but it is not looking good because it is not covering whole NSSearchField the extreme corners where the small search icon and cancel icon is present are left uncolored.
3)I want the searchField to have the color of the view it is lying so i decreased the alpha value of the searchField which looks good but the alpha value of text is also decreased so is there any way to make text's alpha value to remain always 1.
Thanks :)
If you look at the documentation, Apple prevents background color rendering for rounded-rectangle fields:
"In order to prevent inconsistent rendering, background color rendering is disabled for rounded-bezel text fields."
https://developer.apple.com/library/prerelease/mac/documentation/Cocoa/Reference/ApplicationKit/Classes/NSTextField_Class/#//apple_ref/occ/instm/NSTextField/setDrawsBackground:
NSSearchField is extension of NSTextField, NSTextField again extension of NSView,
Not sure, but its possible to make a custom clas and overwrite drawRect function and paint with the background color.