I have just started to use Xcode in my Mac, so I am pretty new. I know the basics but I don't know how to code icons into my script. For example, I namely want to add a thumbs up emoji, or a smile, but I really don't know how to really code that.
I have tried adding "👍", "thumbsup.fill" and I looked into other comments and tried their things, but it doesn't seem to work. all I see is a blank screen.
Anybody got suggestions?
You need to put an imageview and add the following code :
Image(systemName: "hand.thumbsup.fill")
.resizable()
.aspectRatio(contentMode: .fill)
.frame(width: 25.0, height: 25.0, alignment: .center)
Related
I'm migrating to amCharts5 but I'm having some issues with labelling axis. Is the following the correct way to add a title to the x axis? I'd prefer not to specify a percent and just add it to the axis container with a vertical layout etc.
chart.children.unshift(am5.Label.new(root, {
text: "This is a chart title",
fontSize: 25,
fontWeight: "500",
textAlign: "center",
x: am5.percent(50),
y: am5.percent(90),
centerX: am5.percent(50),
paddingTop: 0,
paddingBottom: 0
}));
I know this is odd but maybe my thoughts will help someone else: Yeah that looks good to me guy. I use a similar way. Been doing a lot with AM5 recently (multiple charts, dynamic stuff). Sometimes tough to find what you need on their docs but they have solid documentation I think. Their tutorials help a lot too. Here is their label docs if you haven't found it already:
https://www.amcharts.com/docs/v5/concepts/common-elements/labels/
I find it's easier to run their Codepens and mess around with that code to try achieve want you want in your code and then incorporate it.
I was taking a look at the background that Apple Music uses when displaying the currently playing song, like these:
I really like the way that these backgrounds echo the color of the album cover, but I'm not entirely sure how I could implement something similar, given an Image. At first I thought it was just a magnified and blurred copy of the album Image, like this:
Image("album cover")
.resizable()
.frame(width: 300, height: 300)
.blur(radius: 20)
But looking at the two images above I don't think this is the case, as not all colors in the cover image are included. Instead, do they use a radial gradient? If so, how do they pick which colors to use, and how could I do something similar, given an Image?
Thanks for the help!
I went through a similar exercise lately and here is what I've used
.background {
ZStack {
Rectangle()
.fill(backgroundColor().gradient)
.edgesIgnoringSafeArea(.all)
Rectangle()
.fill(.ultraThinMaterial)
.edgesIgnoringSafeArea(.all)
}
}
Note that .gradient is available since iOS 16. The background color can be any swiftui color. In my case I'm using the average color of the song artwork available with MusicKit since iOS 15.
I am trying to display a network image of mario in a circleavatar using flutter. Nothing is displaying and no errors are returned. Please help! This is my code (Indents are screwed up):
CircleAvatar(
backgroundImage: NetworkImage("https://blogs.forbes.com/olliebarder/files/2018/03/super_mario_plumber_new.jpg") ,
radius: 40.0,
),
It is part of a class which extends StatelessWidget and it is wrapped in a padding, and a column.
You just need to hard-reset, use the green circle in vs code or android studio, or CTRL + C, then flutter run in terminal.
I have a code for View with Image in swiftUI, I wonder if the frame() function will produces different size for each devices(like iPhone 8, Xs, Xs+, etc)
struct CircleImage : View {
var body: some View {
Image("jorge")
.resizable()
.frame(width: 100, height: 100)
.clipShape(Circle())
.overlay(
Circle().stroke(Color.white, lineWidth: 4))
.shadow(radius: 10)
}
}
I have Xcode 11 with beta of course, but I don't have catalina since I have to do my work with Mojave and Catalina doesn't support it. So I can't find any clues with SwiftUI Preview.
I also tried to see above code with multiple simulators(with 8 and Xs+) and I saw that images seems have same size but I'm not sure for it.
And If the sizes are same, what is the standard size of screen? and if not, how can I find each screen's standards?
I'm not sure I understand your question, but I'll do my best to answer. When you specify a frame(width: 100, height: 100), SwiftUI will make it 100x100 points. No matter which device. If you would like to adapt to the available space of a device, check the example I posted in this other question: https://stackoverflow.com/a/56853211/7786555
Additionally, here's the documentation to get the screen size for your current device:
The bounding rectangle of the screen, measured in points:
https://developer.apple.com/documentation/uikit/uiscreen/1617838-bounds
The bounding rectangle of the physical screen, measured in pixels.
https://developer.apple.com/documentation/uikit/uiscreen/1617810-nativebounds
Okay. So I set the color of a background div to: rgb(0, 163, 140)
According to "Digital Colour Meter" I get the correct value in Firefox: rgb(0, 163, 140)
This is what I see in Chrome and Safari however: rgb(71, 160, 141)
What the heck? I tried different color profiles in Chrome using "force color profile" but that did not change anything. I tried two different MacBooks on the latest MacOS Mojave.
I found a couple of threads here on StackOverflow but no solution whatsoever. There has to be some kind of workaround?!
Okay so,
I made some researches about that and looks like this is a known issue and it's displayed here: https://bugs.chromium.org/p/chromium/issues/detail?id=44872
The only solution seems to be using a different color that gets displayed the same in different browsers
Example: Chrome renders #FF3A00 as #FF0000 so you could just use #FF0000.
Still, if someone has a rgb setting on its display it will still show as a different color for that.
It's your choiche to adapt the colors or just leave them like that, sadly you can't fix that even in the 20th century :)