我正在Xamarin.ios上工作,并使用Visual Studio进行开发。我已经添加了LaunchScreen.Storyboard来显示启动图像,因为我也想定位新的iPhoneX设备。我当前面临的问题是,我无法在设备或模拟器上看到启动图像。
我无法使用LaunchImage.launchimage资产图像方法,因为iPhoneX没有可用于在xamarin中添加图像的占位符。
我尝试在Images.xcassets文件夹中添加图像并在情节提要中访问它。但是,它只是显示空白屏幕。
还尝试编辑contents.json以添加iphoneX启动图像,仍然没有成功。
如果有人遇到过同样的问题并解决了,请告诉我。
我正在玩reactQuery一个小演示应用程序,您可以在这个存储库中看到。应用程序调用此模拟 API。
我遇到了一个问题,即我使用钩子在产品 API文件useQuery中调用此函数:
export const getAllProducts = async (): Promise<Product[]> => {
const productEndPoint = 'http://localhost:5000/api/product';
const { data } = await axios.get(productEndPoint);
return data as Array<Product>;
};
Run Code Online (Sandbox Code Playgroud)
然后在我的ProductTable组件中,我使用以下方法调用此函数:
const { data } = useQuery('products', getAllProducts);
Run Code Online (Sandbox Code Playgroud)
我发现确实调用了 API,并且返回了数据。但网格中的表始终是空的。
如果我调试,我会看到 useQuery 返回的数据对象未定义。
Web 请求确实成功完成,我可以在浏览器中的请求下的网络选项卡中看到返回的数据。
我怀疑它的结构方式getAllProducts可能是异步等待问题,但无法完全弄清楚。
谁能建议 IO 可能出问题的地方吗?
我正在使用Xamarin.forms构建一个在IOS,Windows Phone和Android上运行的应用程序.当没有可用的网络时,我需要能够在设备上缓存图像.
基础:
我正在使用MVVM方法并且具有带有IconImageId属性的MenuViewModel,该属性具有针对不同图像的GUID.
然后,我视图单元格中的图标将绑定到此属性:
var icon = new Image
{
Aspect = Aspect.AspectFit,
HeightRequest = 80,
WidthRequest = 80
};
icon.SetBinding(Image.SourceProperty, new Binding("IconImageId",BindingMode.Default, new ImageIdToUriImageSourceValueConverter(80, 80, iconColor)));
Run Code Online (Sandbox Code Playgroud)
然后我使用名为ImageIdToUriImageSourceValueConverter的自定义值转换器将我的图像Id转换为图像:
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
var applicationUrl = App.ApplicationUrl;
if (string.IsNullOrEmpty(value as string))
{
return null;
}
var includeColorOld = string.IsNullOrEmpty(_colorOld) ? "" : string.Format("/{0}", _colorOld);
// I have an image api which which handles the image itself and that works fine.
var …Run Code Online (Sandbox Code Playgroud) axios ×1
c# ×1
image ×1
iphone-x ×1
react-query ×1
reactjs ×1
swift ×1
typescript ×1
xamarin.ios ×1
xcode8 ×1