本文整理汇总了C#中UIViewController.DismissViewController方法的典型用法代码示例。如果您正苦于以下问题:C# UIViewController.DismissViewController方法的具体用法?C# UIViewController.DismissViewController怎么用?C# UIViewController.DismissViewController使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UIViewController
的用法示例。
在下文中一共展示了UIViewController.DismissViewController方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Show
public static GistCreateView Show(UIViewController parent)
{
var ctrl = new GistCreateView();
var weakVm = new WeakReference<GistCreateViewModel>(ctrl.ViewModel);
ctrl.ViewModel.SaveCommand.Subscribe(_ => parent.DismissViewController(true, null));
ctrl.NavigationItem.LeftBarButtonItem = new UIBarButtonItem { Image = Images.Buttons.CancelButton };
ctrl.NavigationItem.LeftBarButtonItem.GetClickedObservable().Subscribe(_ => {
weakVm.Get()?.CancelCommand.Execute(null);
parent.DismissViewController(true, null);
});
parent.PresentViewController(new ThemedNavigationController(ctrl), true, null);
return ctrl;
}
示例2: DoTransition
private static void DoTransition(UIViewController fromViewController, IBaseViewModel fromViewModel,
UIViewController toViewController, IBaseViewModel toViewModel)
{
var toViewDismissCommand = toViewModel.DismissCommand;
if (toViewController is LoginViewController)
{
toViewDismissCommand.Subscribe(_ => fromViewController.DismissViewController(true, null));
fromViewController.PresentViewController(new UINavigationController(toViewController), true, null);
}
else if (toViewController is MainViewController)
{
var nav = ((UINavigationController)UIApplication.SharedApplication.Delegate.GetWindow().RootViewController);
UIView.Transition(nav.View, 0.6f,
UIViewAnimationOptions.BeginFromCurrentState | UIViewAnimationOptions.TransitionCrossDissolve,
() => nav.PushViewController(toViewController, false), null);
}
else if (toViewController is AddInterestViewController)
{
toViewDismissCommand.Subscribe(_ => fromViewController.DismissViewController(true, null));
toViewController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Cancel, (s, e) => toViewDismissCommand.ExecuteIfCan());
fromViewController.PresentViewController(new UINavigationController(toViewController), true, null);
}
else if (toViewController is StumbleViewController || toViewController is RepositoryViewController ||
toViewController is StumbledRepositoryViewController || toViewController is SettingsViewController)
{
toViewDismissCommand.Subscribe(_ => fromViewController.DismissViewController(true, null));
toViewController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Done, (s, e) => toViewDismissCommand.ExecuteIfCan());
fromViewController.PresentViewController(new UINavigationController(toViewController), true, null);
}
else if (toViewController is LanguagesViewController && fromViewController is TrendingViewController)
{
toViewDismissCommand.Subscribe(_ => fromViewController.DismissViewController(true, null));
toViewController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Done, (s, e) => toViewDismissCommand.ExecuteIfCan());
var ctrlToPresent = new UINavigationController(toViewController);
ctrlToPresent.TransitioningDelegate = new SlideDownTransition();
fromViewController.PresentViewController(ctrlToPresent, true, null);
}
else if (toViewController is PurchaseProViewController)
{
toViewDismissCommand.Subscribe(_ => fromViewController.DismissViewController(true, null));
toViewController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Done, (s, e) => toViewDismissCommand.ExecuteIfCan());
fromViewController.PresentViewController(toViewController, true, null);
}
else
{
toViewDismissCommand.Subscribe(
_ => toViewController.NavigationController.PopToViewController(fromViewController, true));
fromViewController.NavigationController.PushViewController(toViewController, true);
}
}
示例3: DoTransition
private void DoTransition(UIViewController fromViewController, IBaseViewModel fromViewModel, UIViewController toViewController, IBaseViewModel toViewModel)
{
var toViewDismissCommand = toViewModel.DismissCommand;
// if (toViewController is SettingsViewController)
// {
// toViewController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(CodeFramework.iOS.Images.Cancel, UIBarButtonItemStyle.Plain, (s, e) => toViewDismissCommand.ExecuteIfCan());
// toViewDismissCommand.Subscribe(__ => toViewController.DismissViewController(true, null));
// fromViewController.PresentViewController(new UINavigationController(toViewController), true, null);
// }
if (toViewController is AccountsView)
{
var rootNav = (UINavigationController)UIApplication.SharedApplication.Delegate.Window.RootViewController;
toViewController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(Images.Cancel, UIBarButtonItemStyle.Plain, (s, e) => toViewDismissCommand.ExecuteIfCan());
toViewDismissCommand.Subscribe(_ => rootNav.DismissViewController(true, null));
rootNav.PresentViewController(new UINavigationController(toViewController), true, null);
}
// else if (fromViewController is RepositoriesViewController)
// {
// fromViewController.NavigationController.PresentViewController(toViewController, true, null);
// }
else if (toViewController is MenuView)
{
var nav = ((UINavigationController)UIApplication.SharedApplication.Delegate.Window.RootViewController);
var slideout = new SlideoutNavigationController();
slideout.MenuViewController = new MenuNavigationController(toViewController, slideout);
UIView.Transition(nav.View, 0.1, UIViewAnimationOptions.BeginFromCurrentState | UIViewAnimationOptions.TransitionCrossDissolve,
() => nav.PushViewController(slideout, false), null);
}
else if (toViewController is NewAccountView && fromViewController is StartupView)
{
toViewDismissCommand.Subscribe(_ => toViewController.DismissViewController(true, null));
fromViewController.PresentViewController(new UINavigationController(toViewController), true, null);
}
else if (fromViewController is MenuView)
{
fromViewController.NavigationController.PushViewController(toViewController, true);
}
else if (toViewController is LanguagesView && fromViewController is RepositoriesTrendingView)
{
toViewDismissCommand.Subscribe(_ => fromViewController.DismissViewController(true, null));
toViewController.NavigationItem.LeftBarButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.Done, (s, e) => toViewDismissCommand.ExecuteIfCan());
var ctrlToPresent = new UINavigationController(toViewController);
ctrlToPresent.TransitioningDelegate = new SlideDownTransition();
fromViewController.PresentViewController(ctrlToPresent, true, null);
}
else
{
toViewDismissCommand.Subscribe(_ => toViewController.NavigationController.PopToViewController(fromViewController, true));
fromViewController.NavigationController.PushViewController(toViewController, true);
}
}
示例4: ViewDidLoad
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
// Wireup Show button
ShowButton.TouchUpInside += (sender, e) => {
// Create a UIImage view to show in the popover
UIImageView monkeyIcon = new UIImageView(new CGRect(0,0,256,256));
monkeyIcon.Image = UIImage.FromFile("MonkeyIcon.png");
monkeyIcon.UserInteractionEnabled = true;
// Create a view controller to act as the popover
UIViewController popover = new UIViewController();
popover.View = monkeyIcon;
popover.ModalPresentationStyle = UIModalPresentationStyle.Popover;
// Grab Image
var image = UIImage.FromFile("298-circlex.png");
// Add a close button
var closeButton = new ImageButton(new CGRect(popover.View.Frame.Size.Width,20,image.Size.Width,image.Size.Height));
closeButton.UserInteractionEnabled = true;
closeButton.Image = image;
monkeyIcon.AddSubview(closeButton);
// Wireup the close button
closeButton.Touched += (button) => {
popover.DismissViewController(true,null);
};
// Present the popover
PresentViewController(popover,true,null);
// Configure the popover for the iPad, the popover displays as a modal view on the
// iPhone
UIPopoverPresentationController presentationPopover = popover.PopoverPresentationController;
if (presentationPopover!=null) {
presentationPopover.SourceView = this.View;
presentationPopover.PermittedArrowDirections = UIPopoverArrowDirection.Up;
presentationPopover.SourceRect = ShowButton.Frame;
}
};
}
示例5: showSplash
public void showSplash (RootViewController rootController)
{
var splashView = new UIImageView (UIScreen.MainScreen.Bounds);// (new RectangleF (0f, 0f, 320f, 480f));
splashView.Image = UIImage.FromFile ("Default.png");
UIViewController modalViewController = new UIViewController ();
modalViewController.View = splashView;
modalViewController.ModalTransitionStyle = UIModalTransitionStyle.FlipHorizontal;
rootController.PresentViewController (modalViewController, false, null);
NSTimer.CreateScheduledTimer (new TimeSpan (0, 0, 3),
delegate {
modalViewController.DismissViewController(true, null);
UIApplication.SharedApplication.SetStatusBarHidden (false, false);
});
}
示例6: DismissModalAndOpen
public static void DismissModalAndOpen(UIViewController current, UIViewController next)
{
current.DismissViewController (true, delegate {
Deck.CenterController = new UINavigationController (next);
});
}
示例7: DismissModal
public static void DismissModal(UIViewController current)
{
current.DismissViewController (true, null);
}
示例8: HideViewController
private static void HideViewController(UIViewController viewController)
{
if (!UIDevice.CurrentDevice.CheckSystemVersion(6, 0))
{
#pragma warning disable 618
// Disable DismissModalViewControllerAnimated warning, still need to support iOS 5 and older
viewController.DismissModalViewController(true);
#pragma warning restore 618
}
else
{
// Dismiss view controller for iOS 6+
viewController.DismissViewController(true, delegate {});
}
IsVisible = false;
TouchPanel.EnabledGestures = prevGestures;
}
示例9: Present
protected virtual IDisposable Present(UIViewController controller)
{
var app = UIApplication.SharedApplication;
var top = this.viewControllerFunc();
app.InvokeOnMainThread(() => top.PresentViewController(controller, true, null));
return new DisposableAction(() =>
{
try
{
app.InvokeOnMainThread(() => controller.DismissViewController(true, null));
}
catch { }
});
}
示例10: Present
/// <summary>
/// Presents a new color picker.
/// </summary>
/// <param name="parent">The parent <see cref="UIViewController"/>.</param>
/// <param name="title">The picker title.</param>
/// <param name="initialColor">The initial selected color.</param>
/// <param name="done">The method invoked when the picker closes.</param>
/// <param name="colorPicked">The method invoked as colors are picked.</param>
public static void Present(UIViewController parent, string title, UIColor initialColor, Action<UIColor> done, Action<UIColor> colorPicked)
{
if (parent == null)
{
throw new ArgumentNullException("parent");
}
var picker = new ColorPickerViewController
{
Title = title,
SelectedColor = initialColor
};
picker.ColorPicked += (_, args) =>
{
if (colorPicked != null)
{
colorPicked(args.SelectedColor);
}
};
var pickerNav = new UINavigationController(picker);
pickerNav.ModalPresentationStyle = UIModalPresentationStyle.FormSheet;
pickerNav.NavigationBar.Translucent = false;
var doneBtn = new UIBarButtonItem(UIBarButtonSystemItem.Done);
picker.NavigationItem.RightBarButtonItem = doneBtn;
doneBtn.Clicked += delegate
{
if (done != null)
{
done(picker.SelectedColor);
}
// hide the picker
parent.DismissViewController(true, null);
};
// show the picker
parent.PresentViewController(pickerNav, true, null);
}
示例11: TryDismiss
void TryDismiss(UIViewController controller, Action completionHandler)
{
if (controller != null)
controller.DismissViewController (false, completionHandler);
else if(completionHandler != null)
completionHandler ();
}
示例12: Show
public static void Show (UIViewController controller, string email, AuthResult res, Mode mode, bool googleAuth=false)
{
switch (res) {
case AuthResult.InvalidCredentials:
if (mode == Mode.Login && !googleAuth) {
new UIAlertView (
"AuthErrorLoginTitle".Tr (),
"AuthErrorLoginMessage".Tr (),
null, "AuthErrorOk".Tr ()).Show ();
} else if (mode == Mode.Login && googleAuth) {
new UIAlertView (
"AuthErrorGoogleLoginTitle".Tr (),
"AuthErrorGoogleLoginMessage".Tr (),
null, "AuthErrorOk".Tr ()).Show ();
} else if (mode == Mode.Signup) {
new UIAlertView (
"AuthErrorSignupTitle".Tr (),
"AuthErrorSignupMessage".Tr (),
null, "AuthErrorOk".Tr ()).Show ();
}
break;
case AuthResult.NoDefaultWorkspace:
if (MFMailComposeViewController.CanSendMail) {
var dia = new UIAlertView (
"AuthErrorNoWorkspaceTitle".Tr (),
"AuthErrorNoWorkspaceMessage".Tr (),
null, "AuthErrorNoWorkspaceCancel".Tr (),
"AuthErrorNoWorkspaceOk".Tr ());
dia.Clicked += (sender, e) => {
if (e.ButtonIndex == 1) {
var mail = new MFMailComposeViewController ();
mail.SetToRecipients (new[] { "AuthErrorNoWorkspaceEmail".Tr () });
mail.SetSubject ("AuthErrorNoWorkspaceSubject".Tr ());
mail.SetMessageBody (String.Format ("AuthErrorNoWorkspaceBody".Tr (), email), false);
mail.Finished += delegate {
controller.DismissViewController (true, null);
};
controller.PresentViewController (mail, true, null);
}
};
dia.Show ();
} else {
new UIAlertView (
"AuthErrorNoWorkspaceTitle".Tr (),
"AuthErrorNoWorkspaceMessage".Tr (),
null, "AuthErrorOk".Tr ()).Show();
}
break;
case AuthResult.NetworkError:
new UIAlertView (
"AuthErrorNetworkTitle".Tr (),
"AuthErrorNetworkMessage".Tr (),
null, "AuthErrorOk".Tr ()).Show ();
break;
default:
new UIAlertView (
"AuthErrorSystemTitle".Tr (),
"AuthErrorSystemMessage".Tr (),
null, "AuthErrorOk".Tr ()).Show ();
break;
}
}
示例13: ResignModelViewController
public void ResignModelViewController( UIViewController modelViewController, object context )
{
// if the image cropper is resigning
if ( modelViewController == ImageCropViewController )
{
// if croppedImage is null, they simply cancelled
UIImage croppedImage = (UIImage)context;
if ( croppedImage != null )
{
NSData croppedImageData = croppedImage.AsJPEG( );
// if the image converts, we're good.
if ( croppedImageData != null )
{
MemoryStream memStream = new MemoryStream();
Stream nsDataStream = croppedImageData.AsStream( );
nsDataStream.CopyTo( memStream );
memStream.Position = 0;
RockMobileUser.Instance.SaveProfilePicture( memStream );
RockMobileUser.Instance.UploadSavedProfilePicture( null ); // we don't care about the response. just do it.
nsDataStream.Dispose( );
}
else
{
// notify them about a problem saving the profile picture
DisplayError( SpringboardStrings.ProfilePicture_Error_Title, SpringboardStrings.ProfilePicture_Error_Message );
}
}
}
else if ( modelViewController == ProfileViewController )
{
// make sure we update the UI if they just finished editing their profile
View.SetNeedsLayout( );
}
modelViewController.DismissViewController( true, delegate
{
// if this resign is while the OOBE is running, it was the register or login finishing up,
// so wrap up the OOBE
if ( IsOOBERunning == true )
{
CompleteOOBE( );
}
ModalControllerVisible = false;
View.SetNeedsLayout( );
} );
}