本文整理汇总了C#中UIViewController类的典型用法代码示例。如果您正苦于以下问题:C# UIViewController类的具体用法?C# UIViewController怎么用?C# UIViewController使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UIViewController类属于命名空间,在下文中一共展示了UIViewController类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ViewDidLoad
public override void ViewDidLoad()
{
base.ViewDidLoad ();
// Configure the page view controller and add it as a child view controller.
PageViewController = new UIPageViewController (UIPageViewControllerTransitionStyle.PageCurl, UIPageViewControllerNavigationOrientation.Horizontal, UIPageViewControllerSpineLocation.Min);
PageViewController.WeakDelegate = this;
var startingViewController = ModelController.GetViewController (0, Storyboard);
var viewControllers = new UIViewController[] { startingViewController };
PageViewController.SetViewControllers (viewControllers, UIPageViewControllerNavigationDirection.Forward, false, null);
PageViewController.WeakDataSource = ModelController;
AddChildViewController (PageViewController);
View.AddSubview (PageViewController.View);
// Set the page view controller's bounds using an inset rect so that self's view is visible around the edges of the pages.
var pageViewRect = View.Bounds;
if (UIDevice.CurrentDevice.UserInterfaceIdiom == UIUserInterfaceIdiom.Pad)
pageViewRect = new CGRect (pageViewRect.X + 20, pageViewRect.Y + 20, pageViewRect.Width - 40, pageViewRect.Height - 40);
PageViewController.View.Frame = pageViewRect;
PageViewController.DidMoveToParentViewController (this);
// Add the page view controller's gesture recognizers to the book view controller's view so that the gestures are started more easily.
View.GestureRecognizers = PageViewController.GestureRecognizers;
}
示例2: StartMapViewController
public StartMapViewController (UIViewController msp, IMapLocationRequest maplocationRequest)
: base("StartMapViewController", null)
{
_MaplocationRequest = maplocationRequest;
_MSP = msp;
_list = new List<ImageInfo> ();
}
示例3: DownloadInvoiceAsync
internal async static Task<string> DownloadInvoiceAsync(int employeeId, UIViewController context)
{
var myFiles = await GetDefaultDocumentFiles(context);
var invoiceFile = myFiles.FirstOrDefault(file =>
file.Name.Equals(String.Format("invoice_{0}.pdf", employeeId)));
var actualInvoiceFile = invoiceFile as Microsoft.Office365.SharePoint.File;
if (actualInvoiceFile == null)
{
return null;
}
var invoiceStream = await actualInvoiceFile.DownloadAsync();
var invoicePath = Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.Personal),
invoiceFile.Name);
using (var invoiceFileStream = System.IO.File.Create(invoicePath))
{
await invoiceStream.CopyToAsync(invoiceFileStream);
}
return invoicePath;
}
示例4: Selected
public override void Selected (DialogViewController dvc, UITableView tableView, NSIndexPath path)
{
if (IsReadonly) {
base.Selected (dvc, tableView, path);
return;
}
var controller = new UIViewController ();
UITextView disclaimerView = new UITextView (controller.View.Frame);
// disclaimerView.BackgroundColor = UIColor.FromWhiteAlpha (0, 0);
// disclaimerView.TextColor = UIColor.White;
// disclaimerView.TextAlignment = UITextAlignment.Left;
if (!string.IsNullOrWhiteSpace (Value))
disclaimerView.Text = Value;
else
disclaimerView.Text = string.Empty;
disclaimerView.Font = UIFont.SystemFontOfSize (16f);
disclaimerView.Editable = true;
controller.View.AddSubview (disclaimerView);
controller.NavigationItem.Title = Caption;
controller.NavigationItem.RightBarButtonItem = new UIBarButtonItem (string.IsNullOrEmpty (_saveLabel) ? "Save" : _saveLabel, UIBarButtonItemStyle.Done, (object sender, EventArgs e) => {
if (OnSave != null)
OnSave (this, EventArgs.Empty);
controller.NavigationController.PopViewControllerAnimated (true);
Value = disclaimerView.Text;
});
dvc.ActivateController (controller);
}
示例5: GetAnimationControllerForDismissedController
public override IUIViewControllerAnimatedTransitioning GetAnimationControllerForDismissedController(UIViewController dismissed)
{
var controller = new ModalMenuPickerAnimatedDismissed();
controller.IsPresenting = false;
return controller;
}
示例6: SelectPicture
public static void SelectPicture (UIViewController parent, Action<NSDictionary> callback)
{
Init ();
picker.SourceType = UIImagePickerControllerSourceType.PhotoLibrary;
_callback = callback;
parent.PresentModalViewController (picker, true);
}
示例7: ViewDidLoad
//UINavigationController ;
public override void ViewDidLoad()
{
base.ViewDidLoad ();
qrReader = new QrScannerViewController();
qrReader.Title = "Scan";
attendees = new AttendeeController();
attendees.Title = "Attendees";
history = new HistoryController();
history.Title = "History";
var u = new UIViewController[]
{
attendees,
qrReader,
history
};
SelectedIndex = 0;
ViewControllers = u;
CustomizableViewControllers = new UIViewController[]{};
}
示例8: PresentModalViewController
public override bool PresentModalViewController(UIViewController viewController, bool animated)
{
if (_window.RootViewController == null)
return false;
_window.RootViewController.PresentViewController(viewController, true, null);
return true;
}
示例9: GetViewer
public UIViewController GetViewer (object value, bool createInspector)
{
var vc = value as UIViewController;
if (vc != null)
return vc;
var sv = GetSpecialView (value);
vc = sv as UIViewController;
if (vc != null && vc.ParentViewController == null) {
return vc;
}
var v = sv as UIView;
if (v != null && v.Superview == null) {
vc = new UIViewController ();
vc.View = v;
return vc;
}
if (createInspector) {
vc = new UINavigationController (new ObjectInspector(value));
return vc;
}
return null;
}
示例10: TabBarController
public TabBarController ()
{
tabFirst = new UIViewController();
tabFirst.Title = "Purple";
//tabFirst.TabBarItem = new UITabBarItem (UITabBarSystemItem.Favorites, 0);
tabFirst.View.BackgroundColor = UIColor.Purple;
tabSecond = new UIViewController();
tabSecond.Title = "Black";
//tabSecond.TabBarItem = new UITabBarItem ();
//tabSecond.TabBarItem.Image = UIImage.FromFile ("second.png");
tabSecond.View.BackgroundColor = UIColor.Black;
tabThird = new UIViewController();
tabThird.Title = "Blue";
//tabThird.TabBarItem.BadgeValue = "New";
tabThird.View.BackgroundColor = UIColor.Blue;
var tabs = new UIViewController[] {
tabFirst, tabSecond, tabThird
};
ViewControllers = tabs;
}
示例11: Present
public static void Present(UIViewController controller)
{
UIApplication.SharedApplication.Windows [0].InvokeOnMainThread (delegate {
UINavigationController navcontroller = (UINavigationController)UIApplication.SharedApplication.Windows[0].RootViewController;
navcontroller.PresentViewController(controller,true,null);
});
}
示例12: BigItemMasterView
public BigItemMasterView()
: base()
{
masterView = new BigItemsScreen();
detailview = new BigItemDetailScreen();
masterView.ActivateDetail += (object sender, BigItemDetailClickedEventArgs e) => detailview.ShowDetails (e.lagerobject);
detailview.BigItemSaved += (object sender, BigItemSavedEventArgs e) => masterView.Refresh ();
// detailview.Derezzy += (object sender, DerezLargeObjectEventArgs e) => {
// detailnav.PopViewControllerAnimated(true);
// masterView.Refresh();
// };
detailview.GotPicture += (object sender, GotPictureEventArgs e) => masterView.Refresh ();
masternav = new UINavigationController();
masternav.PushViewController(masterView, false);
detailnav = new UINavigationController();
detailnav.PushViewController(detailview, false);
//always last
ViewControllers = new UIViewController[] {masternav, detailnav};
}
示例13: PickContact
public static void PickContact(UIViewController view, Action<ABPerson> picked)
{
/*
ABAddressBook ab = new ABAddressBook();
ABPerson p = new ABPerson();
p.FirstName = "Brittani";
p.LastName = "Clancey";
ABMutableMultiValue<string> phones = new ABMutableStringMultiValue();
phones.Add("9079470168", ABPersonPhoneLabel.Mobile);
p.SetPhones(phones);
ab.Add(p);
ab.Save();
*/
picker = new ABPeoplePickerNavigationController ();
//picker.DismissModalViewControllerAnimated (true);
//picker.Dispose();
picker.SelectPerson += delegate(object sender, ABPeoplePickerSelectPersonEventArgs e) { picked (e.Person); };
picker.PerformAction += delegate(object sender, ABPeoplePickerPerformActionEventArgs e) { };
picker.Cancelled += delegate {
picker.DismissModalViewControllerAnimated (true);
picked (null);
picker.Dispose ();
};
view.PresentModalViewController (picker, true);
}
示例14: RootTabBarController
public RootTabBarController(){
//- Set Tab Bar Background Color
this.TabBar.BackgroundColor = UIColor.FromRGBA(255,0,0,0);
//this.TabBar.BarTintColor = UIColor.Red;
this.TabBar.ItemPositioning = UITabBarItemPositioning.Fill;
//this.TabBar.Center = new CoreGraphics.CGPoint (0, 10);
//- Settings
_settingsTab = new IdeaBag.Client.iOS.Views.IdeasViewController();
_settingsTab.TabBarItem = new UITabBarItem("",
UIImage.FromBundle("settings-tab").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal),
UIImage.FromBundle("settings-tab").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
);
//- Ideas
_ideasTab = new UIViewController();
_ideasTab.View.BackgroundColor = UIColor.White;
_ideasTab.TabBarItem = new UITabBarItem("",
UIImage.FromBundle("ideas-tab").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal),
UIImage.FromBundle("ideas-tab-selected").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
);
_ideasTab.TabBarItem.ImageInsets = new UIEdgeInsets (4, 0, -4, 0);
//- Notifications
_notificationsTab = new NotificationsViewController();
_notificationsTab.TabBarItem = new UITabBarItem("",
UIImage.FromBundle("notification-tab").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal),
UIImage.FromBundle("notification-tab").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
);
//- Contacts
_contactsTab = new UIViewController();
_contactsTab.TabBarItem = new UITabBarItem("",
UIImage.FromBundle("friends-tab").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal),
UIImage.FromBundle("friends-tab").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
);
_contactsTab.View.BackgroundColor = UIColor.White;
//- Map
_mapTab = new UIViewController();
_mapTab.TabBarItem = new UITabBarItem("",
UIImage.FromBundle("map-tab").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal),
UIImage.FromBundle("map-tab").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal)
);
_mapTab.View.BackgroundColor = UIColor.White;
var tabs = new UIViewController[] {
_settingsTab,
_ideasTab,
_notificationsTab,
_contactsTab,
_mapTab
};
this.ViewControllers = tabs;
}
示例15: SetTitleAndTabBarItem
private void SetTitleAndTabBarItem(UIViewController screen, string title, string imageName)
{
screen.Title = ViewModel.TextSource.GetText(title);
screen.TabBarItem = new UITabBarItem(title, UIImage.FromBundle("Images/Tabs/" + imageName + ".png"),
_createdSoFarCount);
_createdSoFarCount++;
}