나는 : api를 가지고 있고 배열 날씨-> 아이콘에 아이콘을 표시하고 싶습니다.
지금은 iOS의 디스플레이 화면에이 API의 문자열 만 표시하지만 아이콘 이미지를 볼 수 없습니다.
내 MainPage.xaml
모습 :
<Frame CornerRadius="10"
OutlineColor="Red"
Margin="10,0,10,0"
BackgroundColor="White"
Opacity="0.5">
<StackLayout VerticalOptions="Center">
<Label x:Name="infoLabel"
Grid.ColumnSpan="3"
TextColor="Black"
HorizontalOptions="Center"
FontAttributes="Bold"
FontSize="15" />
<Label x:Name="infoLabel1"
Grid.ColumnSpan="3"
TextColor="Black"
HorizontalOptions="Center"
FontAttributes="Bold"
FontSize="15" />
</StackLayout>
</Frame>
내 MainPage.xaml.cs
모습 :
string Info = DateDays.DayOfWeek + DateDays.ToString(" MM/dd - HH:mm") + " " + weatherData.weatherForecast[0].Weather.Icon + " " + weatherData.weatherForecast[0].Temperature + "°C";
infoLabel.Text = Info;
string Info1 = DateDays1.DayOfWeek + DateDays1.ToString(" MM/dd - HH:mm") + " " + weatherData.weatherForecast[1].Weather.Icon + " " + weatherData.weatherForecast[1].Temperature + "°C";
infoLabel1.Text = Info1;
결과는 다음과 같습니다.
아이콘을 표시하는 올바른 방법은 무엇입니까?
코드 "r01n"을 URL로 번역해야합니다. 참조 https://www.weatherbit.io/api/codes를
<Image Source="https://www.weatherbit.io/static/img/icons/r01n.png" />
다음과 같은 URL을 만들 수 있습니다.
var url = $"https://www.weatherbit.io/static/img/icons/{weatherData.weatherForecast[0].Weather.Icon}.png";
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다