Diese Präsentation wurde erfolgreich gemeldet.
Wir verwenden Ihre LinkedIn Profilangaben und Informationen zu Ihren Aktivitäten, um Anzeigen zu personalisieren und Ihnen relevantere Inhalte anzuzeigen. Sie können Ihre Anzeigeneinstellungen jederzeit ändern.

Get the Most Out of iOS 11 with Visual Studio Tools for Xamarin

727 Aufrufe

Veröffentlicht am

In this webinar deck Craig Dunn shows what’s new in iOS 11 and how to take advantage of the latest updates – from drag-and-drop for iPad to machine learning and more – 100% in .NET and Visual Studio. Whether you’re building new or updating existing Xamarin.iOS apps, you’ll see how to implement new frameworks, APIs, and UI features, walk-through code samples, get expert tips and tricks, so you can start shipping iOS 11-ready apps to your users.

Watch webinar at https://youtu.be/mXAbpXLT1vo

Veröffentlicht in: Software

Get the Most Out of iOS 11 with Visual Studio Tools for Xamarin

  1. 1. aka.ms/xamarin/ios11-todo11
  2. 2.   
  3. 3. // UINavigationController NavigationBar.PrefersLargeTitles = true; // UIViewController (second one in stack) NavigationItem.LargeTitleDisplayMode = UINavigationItemLargeTitleDisplayMode.Never; // AppDelegate UINavigationBar.Appearance.LargeTitleTextAttributes = new UIStringAttributes { ForegroundColor = UIColor.FromRGB(0x5A, 0x86, 0x22), // 5A8622 dark-green };
  4. 4.   new
  5. 5.  SafeAreaLayoutGuide
  6. 6.   MarginLayoutGuide
  7. 7.   
  8. 8.    
  9. 9.  Safe Areavar safeGuide = View.SafeAreaLayoutGuide; NSLayoutConstraint.ActivateConstraints(new NSLayoutConstraint[] { CloseButton.TrailingAnchor.ConstraintEqualTo(safeGuide.TrailingAnchor, -23), CloseButton.BottomAnchor.ConstraintEqualTo(safeGuide.BottomAnchor, -13), CloseButton.WidthAnchor.ConstraintEqualTo(60), CloseButton.HeightAnchor.ConstraintEqualTo(60) }); -23 -13
  10. 10.  var safeGuide = View.SafeAreaLayoutGuide; NSLayoutConstraint.ActivateConstraints(new NSLayoutConstraint[] { CloseButton.TrailingAnchor.ConstraintEqualTo(safeGuide.TrailingAnchor, -23), CloseButton.BottomAnchor.ConstraintEqualTo(safeGuide.BottomAnchor, -13), CloseButton.WidthAnchor.ConstraintEqualTo(60), CloseButton.HeightAnchor.ConstraintEqualTo(60) });
  11. 11.  NSLayoutConstraint.ActivateConstraints(new NSLayoutConstraint[] { CameraButton.TrailingAnchor.ConstraintEqualTo(CloseButton.LeadingAnchor, -23), CameraButton.BottomAnchor.ConstraintEqualTo(safeGuide.BottomAnchor, -13), CameraButton.WidthAnchor.ConstraintEqualTo(60), CameraButton.HeightAnchor.ConstraintEqualTo(60) }); Safe Area -23 -13
  12. 12.  -13 var marginGuide = View.LayoutMarginsGuide; NSLayoutConstraint.ActivateConstraints(new NSLayoutConstraint[] { ClassificationLabel.LeadingAnchor.ConstraintEqualTo(marginGuide.LeadingAnchor), ClassificationLabel.TrailingAnchor.ConstraintEqualTo(marginGuide.TrailingAnchor), ClassificationLabel.BottomAnchor.ConstraintEqualTo(CloseButton.TopAnchor, -13), ClassificationLabel.HeightAnchor.ConstraintEqualTo(120) }); MarginMargin
  13. 13.
  14. 14.  
  15. 15.  var context = new LAContext(); // Face ID or Touch ID context.CanEvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, out var err1) context.BiometryType == LABiometryType.TouchId ? "Touch ID" : "Face ID" // PIN/Password context.CanEvaluatePolicy(LAPolicy.DeviceOwnerAuthentication, out var err2)
  16. 16.  var context = new LAContext(); // Face ID or Touch ID context.CanEvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, out var err1) context.BiometryType == LABiometryType.TouchId ? "Touch ID" : "Face ID" context.EvaluatePolicy(LAPolicy.DeviceOwnerAuthenticationWithBiometrics, localizedReason, replyHandler); // PIN/Password context.CanEvaluatePolicy(LAPolicy.DeviceOwnerAuthentication, out var err2) context.EvaluatePolicy(LAPolicy.DeviceOwnerAuthentication, localizedReason, replyHandler);
  17. 17.  
  18. 18.  public UIDragItem[] GetItemsForBeginningDragSession(UITableView tableView, IUIDragSession session, NSIndexPath indexPath) { var data = NSData.FromString(todoItems[indexPath.Row], NSStringEncoding.UTF8); var itemProvider = new NSItemProvider(); itemProvider.RegisterDataRepresentation(UTType.PlainText, NSItemProviderRepresentationVisibility.All, (completion) => { completion(data, null); return null; }); var dragItem = new UIDragItem(itemProvider); return new UIDragItem[] { dragItem }; }
  19. 19.  public bool CanHandleDropSession(UITableView tableView, IUIDropSession session) { return session.CanLoadObjects(typeof(NSString)); } public UITableViewDropProposal DropSessionDidUpdate(UITableView tableView, IUIDropSession session, NSIndexPath destinationIndexPath) { if (tableView.HasActiveDrag) { // moving in current app } else { return new UITableViewDropProposal(UIDropOperation.Copy, UITableViewDropIntent.InsertAtDestinationIndexPath); } }
  20. 20. public void PerformDrop(UITableView tableView, IUITableViewDropCoordinator coordinator) { // determine path from coordinator.DestinationIndexPath coordinator.Session.LoadObjects<NSString>((items) => { tableView.BeginUpdates(); foreach (var i in items) { // add items to table and data store } tableView.EndUpdates(); }; }
  21. 21.  
  22. 22.  // MKMarkerAnnotationView ClusteringIdentifier = "todo"; // ViewDidLoad MapView.Register(typeof(TodoView),MKMapViewDefault.AnnotationViewReuseIdentifier); MapView.Register(typeof(ClusterView),MKMapViewDefault.ClusterAnnotationViewReuseIdentifier);
  23. 23.  // ClusterView : MKMarkerAnnotationView var renderer = new UIGraphicsImageRenderer(new CGSize(40, 40)); var count = cluster.MemberAnnotations.Length; var notDoneCount = CountByType(cluster.MemberAnnotations, MarkerType.NotDone); Image = renderer.CreateImage((context) => { // Fill full circle with tricycle color TodoView.DoneColor.SetFill(); UIBezierPath.FromOval(new CGRect(0, 0, 40, 40)).Fill(); ... Custom drawing
  24. 24.  // MapView.GetViewForAnnotation if (annotation is TodoAnnotation) { //... } else if (annotation is MKClusterAnnotation) { var cluster = annotation as MKClusterAnnotation; var view = mapView.DequeueReusableAnnotation (MKMapViewDefault.ClusterAnnotationViewReuseIdentifier) as ClusterView; if (view == null) { view = new ClusterView(cluster, MKMapViewDefault.ClusterAnnotationViewReuseIdentifier); } return view; }
  25. 25.    customvision.ai
  26. 26.   developer.apple.com/machine-learning/  
  27. 27. // Load var assetPath = NSBundle.MainBundle.GetUrlForResource("VGG16.mlmodelc"); var model = MLModel.Create(assetPath, out err); // Classify var inputs = new NSDictionary<NSString, NSObject> (new NSString("image"), imageValue); var inputFeatures = new MLDictionaryFeatureProvider (inputs, out error); var outFeatures = model.GetPrediction (inputFeatures, out error2); var predictionsDictionary = outFeatures.GetFeatureValue ("classLabelProbs").DictionaryValue;
  28. 28.  Info.plist developer.apple.com/support/app-store/
  29. 29.   if (UIDevice.CurrentDevice.CheckSystemVersion(11, 0)) { context.LocalizedReason = "Authorize for access to secrets"; }
  30. 30.    if (picker.RespondsToSelector( new Selector("setPredicateForEnablingPerson:"))) { picker.PredicateForEnablingPerson = NSPredicate.FromFormat ("emailAddresses.@count > 0"); }
  31. 31. aka.ms/xamarin/ios11-todo11 aka.ms/xamarin/ios11 aka.ms/xamarin/ios11-samples visualstudio.com/xamarin
  32. 32. Craig Dunn Microsoft Docs

×