iOS Guides | Samples

MonoTouch.UIKit.UINavigationController Class

A UIViewController for managing hierarchical navigation.

See Also: UINavigationController

Syntax

[MonoTouch.Foundation.Register("UINavigationController", true)]
public class UINavigationController : UIViewController

Remarks

The MonoTouch API supports two styles of event notification: the Objective-C style that uses a delegate class or the C# style using event notifications.

The C# style allows the user to add or remove event handlers at runtime by assigning to the events of properties of this class. Event handlers can be anyone of a method, an anonymous methods or a lambda expression. Using the C# style events or properties will override any manual settings to the Objective-C Delegate or WeakDelegate settings.

The Objective-C style requires the user to create a new class derived from UINavigationControllerDelegate class and assign it to the UIKit.Delegate property. Alternatively, for low-level control, by creating a class derived from NSObject which has every entry point properly decorated with an [Export] attribute. The instance of this object can then be assigned to the UINavigationController.WeakDelegate property.

Prior to iOS 7, the screen area covered by the UINavigationController.NavigationBar and UINavigationController.Toolbar was excluded from the area of the UINavigationController.VisibleViewController. In iOS 7, the UINavigationController.NavigationBar and UINavigationController.Toolbar float over the child controllers' UIViewController.View. Application developers who wish to modify this behavior should manipulate the UIViewController.EdgesForExtendedLayout property.

The following illustration shows how layout of a UINavigationController is affected with UIViewController.EdgesForExtendedLayout. With the default value of UIRectEdge.All, the UIView.Frame of the UINavigationController's UIViewController.View includes the whole screen, extending beneath the toolbar at the bottom, the navigation bar, and even the status bar. The second image shows the UIView.Frame property when UIViewController.EdgesForExtendedLayout is set to UIRectEdge.None.

Layout can also be modified by setting the UINavigationBar.Translucent property of the UINavigationController.NavigationBar to true.

Related content

Requirements

Namespace: MonoTouch.UIKit
Assembly: monotouch (in monotouch.dll)
Assembly Versions: 0.0.0.0

The members of MonoTouch.UIKit.UINavigationController are listed below.

See Also: UIViewController

Public Constructors

Default constructor that initializes a new instance of this class with no parameters.
A constructor that initializes the object from the data stored in the unarchiver object.
Constructor to call on derived classes to skip initialization and merely allocate the object.
Constructor that takes a UIViewController to use as the topmost controller in the UINavigationController's controller stack.
A constructor used when creating managed representations of unmanaged objects; Called by the runtime.

Public Properties

[read-only]
BarHideOnSwipeGestureRecognizerUIPanGestureRecognizer. The gesture recognizer used to hide the navigation controller in response to a swipe. (Read-only.)
[read-only]
BarHideOnTapGestureRecognizerUITapGestureRecognizer. The gesture recognizer used to hide the navigation controller in response to a tap. (Read-only.)
[read-only]
override
ClassHandleIntPtr. The handle for this class.
DelegateUINavigationControllerDelegate. An instance of the MonoTouch.UIKit.UINavigationControllerDelegate model class which acts as the class delegate.
HidesBarsOnSwipeBoolean. Whether the navigation controller should hide its bars when swiped.
HidesBarsOnTapBoolean. Whether the navigation controller should hide its bars when tapped.
HidesBarsWhenKeyboardAppearsBoolean. Whether the navigation controller should hide its bars when the keyboard appears.
HidesBarsWhenVerticallyCompactBoolean. Whether the navigation controller should hide its bars in a vertically-compact environment.
[read-only]
static
HideShowBarDurationSingle. Represents the value associated with the constant UINavigationControllerHideShowBarDuration
[read-only]
InteractivePopGestureRecognizerUIGestureRecognizer. A gesture recognizer for the left-edge-to-interior "back" gesture.
[read-only]
NavigationBarUINavigationBar. The UINavigationBar for the UINavigationController.
NavigationBarHiddenBoolean. Allows the navigation bar to be hidden.
[read-only]
ToolbarUIToolbar. Retruns the toolbar for the navigation controller.
ToolbarHiddenBoolean. Controls visibility of the toolbar
[read-only]
TopViewControllerUIViewController. The view controller currently at the top of the navigation controller's stack.
ViewControllersUIViewController[]. The view controllers currently on the navigation controller's stack.
[read-only]
VisibleViewControllerUIViewController. The view controller whose view is currently on the screen.
WeakDelegateNSObject. An object that can respond to the delegate protocol for this type

Public Methods

PopToRootViewController(Boolean) : UIViewController[]
PopToViewController(UIViewController, Boolean) : UIViewController[]
PopViewControllerAnimated(Boolean) : UIViewController
Pops the controller currrently at the top of the stack
PushViewController(UIViewController, Boolean)
Pushes a view controller onto the UINavigationController's navigation stack.
SetNavigationBarHidden(Boolean, Boolean)
Allows the navigation controller's UINavigationBar to be shown or hidden
SetToolbarHidden(Boolean, Boolean)
Allows the navigation controller's UIToolbar to be shown or hidden
SetViewControllers(UIViewController[], Boolean)
Replaces the controllers in the navigation controller's navigation stack.
ShowViewController(UIViewController, NSObject)
Shows the UIViewController based on the current size-class of the environment.

Protected Methods

override
Dispose(Boolean)
Releases the resources used by the UINavigationController object.