【发布时间】:2020-08-03 18:51:00
【问题描述】:
我有一个应用程序,它在 Xamarin 表单(iOS 端)中有 2 个选项卡。我想知道在调用函数后如何让我的应用导航到不同的内容页面。让我告诉你我在代码中的意思:
这是我的内容页面中的两个功能:
protected override async void OnAppearing()
{
base.OnAppearing();
TakePhotoButton_Clicked();
}
async void TakePhotoButton_Clicked()
{
if (App.pictureTaken) return;
App.pictureTaken = true;
//Allows users to take pictures in the app
if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported)
{
DisplayAlert("No Camera", "Camera is not available.", "OK");
return;
}
var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions
{
//Sets the properties of the photo file
SaveToAlbum = true,
PhotoSize = PhotoSize.MaxWidthHeight,
DefaultCamera = CameraDevice.Rear
});
if (file == null)
return;
}
在调用 TakePhotoButton_Clicked() 之后,我想强制我的应用导航到我的其他内容页面。
在伪代码中它看起来像:
NavigateTo(MyOtherContentPage);
但我不确定这将如何工作或是否存在类似的东西。有什么建议吗?
【问题讨论】:
标签: ios xamarin xamarin.forms navigation content-pages