I'm trying to create a fancy-looking header to a view. I'm using a TTView with styling applied, but my problem is I want the drop shadow to just drop below the image, and not to the sides. I want the sides hard up against the screen edges.
Here is what it looks like at the moment:
How can I make it so the sides are hard up against the edge of the screen?
Here is my code for the styling:
UIColor* black = RGBCOLOR(158, 163, 172);
UIColor* blue = RGBCOLOR(191, 197, 208);
TTStyle *style =
[TTShadowStyle styleWithColor:RGBACOLOR(0,0,0,0.5) blur:5 offset:CGSizeMake(0, 2) next:
[TTLinearGradientFillStyle styleWithColor1:RGBCOLOR(255, 255, 255)
color2:RGBCOLOR(216, 221, 231) next:
[TTFourBorderStyle styleWithTop:blue right:black bottom:black left:blue width:1 next:nil]]];
headerView.style = style;
I would appreciate any help with this issue as I've never used three20 before now.
I figured it out by experimentation in the end - if you use a negative UIEdgeMask on the sides before the drop-shadow in the style chain, it pushes the main view out to the edges.
TTStyle *style =
[TTInsetStyle styleWithInset:UIEdgeInsetsMake(0, -5, 0, -5) next:
[TTShadowStyle styleWithColor:RGBACOLOR(0,0,0,0.5) blur:5 offset:CGSizeMake(0, 2) next:
[TTLinearGradientFillStyle styleWithColor1:RGBCOLOR(255, 255, 255)
color2:RGBCOLOR(216, 221, 231) next:
[TTFourBorderStyle styleWithBottom:black width:1 next:nil]]]];
self.btn1.layer.shadowOffset = CGSizeMake(10, 10); //set the the value for the shade size when the negative that goes to oposite side of current.
self.btn1.layer.shadowOpacity = 0.9;
self.btn1.layer.shouldRasterize = YES;
self.btn1.layer.shadowColor=[[UIColor grayColor]CGColor];
May this code is helping to you
Related
I am trying to plot a table on my indicator and conditionally color the text color depending on the value "c1_1" (if c1_1 >= 0.0 then green else red)
var table XYZ = table.new(position.top_right, 1, 1, bgcolor = color.white, frame_width = 4, frame_color = color.black)
if barstate.islast
table.cell(XYZ, 0, 0, str.tostring(c1_1, format.mintick), text_color = c1_1 >= 0.0 ? color.green : color.red)
The problem is that sometimes the color is as expected while other times it is not, I do not understand what I am doing incorrectly, would appreciate any inputs on what could be the issue or if there's a better way of doing this.
https://www.tradingview.com/pine-script-docs/en/v5/essential/Colors.html link is not working.
my code :
up_col = input.color(#660990, 'Colors',inline='col'),
dn_col = input.color(#660999, '',inline='col' ),
this code is made for v5, but i can't add transparency for v5
https://prnt.sc/21lbtf8
https://prnt.sc/21lbvkb
thanks
you can use the below code if you want to adjust the transparency from the settings.
up_col = input.color(color.new(#660990,0), 'Colors',inline='col')
dn_col = input.color(color.new(#660990,0), '',inline='col' )
trans = input.int(0,title="",inline='col',minval=0,maxval=100)
plot(close,color=color.new(up_col,trans))```
To set a color transparency programmatically, you can use the below syntax:
colorItem = color.rgb(66, 25, 45, transp = 50)
up_col = color.rgb(66, 09, 90, transp = 85)
dn_col = color.rgb(66, 09, 99, transp = 85)
Or you can also use the answer given by Vishnu to give an option to the user to adjust it in the settings.
So here is the code:
local prt = Instance.new('Part',game.Workspace)
prt.Color = Color3.new(248, 248, 248)
prt.Size = Vector3.new(0.167, 5, 5)
prt.Rotation = Vector3.new(0, 0, math.rad(90))
prt.Anchored = true
prt.CFrame = CFrame.new(Vector3.new(19.1, 618.59, 116.85))
prt.Shape = "Cylinder"
what i want it to do is create a new part that is shaped like a cylinder, i want it to be a flat cylinder but it does the exact oppisite, it is standing up, i have tried many things.
The CFrame is setting the Rotation to 0,0,0. This is because you're doing CFrame.new() before prt.Rotation. If you did CFrame.new(Vector3.new(19.1,618.59,116.85)) * CFrame.Angles(0, 0, math.rad(90)), this would work and you can remove the "prt.Rotation" part.
This question already has answers here:
UIColor not working with RGBA values
(6 answers)
Closed 7 years ago.
I have a method called drawLine(), that draws a line between two points (obviously). It has a start point and an end point that are constantly being moved around, so everytime the update() method is called, the line is deleted, and drawLine() is called again, creating a new line.
func drawLine(firstPoint: CGPoint, secondPoint: CGPoint) -> SKShapeNode
{
var path = CGPathCreateMutable()
CGPathMoveToPoint(path, nil, firstPoint.x, firstPoint.y)
CGPathAddLineToPoint(path, nil, secondPoint.x, secondPoint.y)
let shape = SKShapeNode()
shape.path = path
let strength = sqrt(pow((firstPoint.x - secondPoint.x), 2) + pow((firstPoint.y - secondPoint.y), 2))
NSLog("\(strength)")
shape.strokeColor = UIColor(red: strength/3, green: 255 - strength/3, blue: 0, alpha: 1)
shape.lineWidth = 2
return shape
}
The line stretches from "firstPoint" to "secondPoint" without any problems, but the rgb value, which is calculated using a variable called "strength" that is proportional to the length of the line, doesn't seem to be working properly. The line is always yellow no matter what, until the "strength" reaches a value of 765 (which also happens to be 255 * 3) which is when it abruptly switches to red. Why aren't I getting a gradual change? Also I tried inputting the values for turquoise (r: 50, g: 214, b: 200) but I only got grey. Why is this? Thanks in advance (:
The RGB values range from 0.0 to 1.0, not 0 to 255.
I'm not able to draw, i've already read tutorials, i can't find the problem.
I simply have a correct UI drawed by Glade. Then i want to draw, for example 50 drawing areas. So i create a Grid with 50 cells; for each cell there is a vertical box (with a drawing area and a label inside each one). But i can't seen anything drawed.
class collega_GUI:
def __init__(self):
try:
self.__builder = Gtk.Builder()
self.__builder.add_from_file('UI2.glade')
self.__Grid = Gtk.Grid()
self.__Grid.set_margin_left(20)
self.__Grid.set_margin_right(20)
self.__Grid.set_row_spacing(10)
self.__Grid.set_column_spacing(15)
self.__Grid.set_column_homogeneous(True)
self.__GridBox = self.__builder.get_object('box11')
self.__GridBox.pack_end(self.__Grid, 1, 1, 20)
indirizzi_ip = []
for i in range(50):
indirizzi_ip.append(str(i))
cpu_info = {}
for ip in indirizzi_ip:
cpu_info[ip] = dict()
left = 0
right = 0
for ip in indirizzi_ip:
cpu_info[ip]['drawing_area'] = Gtk.DrawingArea()
cpu_info[ip]['drawing_area'].set_size_request(100, 100)
cpu_info[ip]['drawing_area'].set_name(ip)
box = Gtk.VBox(False, 5)
box.add(cpu_info[ip]['drawing_area'])
label = Gtk.Label(ip)
box.add(label)
self.__Grid.attach(box, left, right, 1, 1) #object,left,right,top,bottom
cpu_info[ip]['drawing_area'].connect("draw", self.__draw)
label.show()
cpu_info[ip]['drawing_area'].show() #the draw should start now!
box.show()
# 5 drawing areas in a row
left += 1
if left == 5:
right += 1
left = 0
self.__builder.get_object('Azioni_Window').show()
Gtk.main()
except Exception as xe:
logging.error('%s' % str(xe))
sys.exit()
def __draw(self, widget, context):
context.set_source_rgb(0.9, 0, 0.1) #rosso
context.set_source_rgb(0.1, 0.9, 0) #verde
context.set_source_rgb(0.8, 0.7, 0) #giallo
context.set_source_rgb(0.8, 0.7, 0.8) #inattivo
context.rectangle(0, 0, widget.get_allocated_width(), widget.get_allocated_height())
context.fill()
if __name__=='__main__':
try:
UINX=collega_GUI()
except Exception:
sys.exit()
You're missing
self.__Grid.show()
And hence nothing in the grid is shown.
In general it's easier to just call show_all() on some top-level container rather than trying to remember to show() every individual widget.