Partial Curl animation in iOS with Modal Segue

When developing a Xamarin.iOS application, I had to navigate from the first view controller to a second view controller. To do this, I have used a Modal Segue.

The problem was the once reached the second view controller, touching the upper part of the view was unwinding the segue.

I could not understand this behaviour, and my colleague Mark Smith has been able to understand it and point me to the right solution.

 

While the problem is already described in Remove tap recogniser for modal UIView/Partial Curl, the solution is not completely correct (because it completely disable any functionality on the second view controller), the correct solution is found at Partial Curl transition for modal seque in iOS 8.

 

Here is the solution code rewritten in Xamarin/C#:

             public override void ViewDidAppear(bool animated)

             {

                    base.ViewDidAppear(animated);

 

                    foreach (var gesture in View.GestureRecognizers)

                    {

                          if (gesture is UITapGestureRecognizer)

                                 View.RemoveGestureRecognizer(gesture);

                    }

             }

Xamarin: adding Android components with problems

Working on a Xamarin project, I have added a component but I had some problem: the component was downloaded, but the dll was not referenced in the project.

I have found the explanations of the guide Walkthrough: Including a Component in your project, but it must be something simple because I add the component inside Visual Studio 2015.

Then I've found the help Quick work around for unresolved Xamarin components in Visual Studio, and I thought that this could be the case, but the files were already on the disc so the issue was not about the path length.

In the end the component was badly downloaded on the first instance, and I had to:

  • remove the components from my project
  • remove the NuGet packages related to the components from my project (founding this took me really a lot of time...)
  • clear the Components folder at the solution level
  • clear the Packages folder at the solution level

Xamarin: how to use OneDrive and TFS or Visual Studio Online on a Mac

For Xamarin projects on a Mac, you can share source files with cloud based file sharing systems like OneDrive, or use source versioning systems like TFS or Visual Studio Online.

If you want to use OneDrive, you need to download it from the Mac AppStore. Here there is the direct link.
Once you setup OneDrive, as usual you can choose what folder to sync. Maybe for a Mac you don't want to sync everything, but only a folder used to share files with the PC for the Xamarin projects.
In case you want to change the synced folders, you can access the OneDrive preferences menu from the top right of your screen.
Important is not to forget in the OneDrive preferences to check "Open at login".
The advantage of this solution is that it is simple and doesn't require any additional software (apart from the OneDrive client itself), but impractical in enterprise scenarios, because you don't keep your TFS folders synced in in OneDrive.

In the second case, using TFS or Visual Studio Online, how do you do it? I recap here the updated steps to use TFS or Visual Studio Online on a Mac:
  • download Eclipse from www.eclipse.org/downloads (I have chosen the version "Eclipse IDE for Java EE Developers"), then after opening the zip file, move it to the Applications folder in Finder;
  • start the application
  • then it will ask for the workspace, accept the default path and check "Use this as the default and do not ask again"
  • go to the Team Explorer Everywhere 2015 plugin and select TFSEclipsePlugin-UpdateSiteArchive-14.0.1.zip; if the download doesn't start automatically, the direct link is here);
  • after the download, right click on the file, Open, to uncompress it;
  • from the Help menu (on Mac, it is on top of the screen...), Install New Software, Add button, Local button, select the folder named "TFSEclicsePlugin..." created at the previous step, then Next, Next, accept the licence terms, Finish
  • in Eclipse, Window | Show View | Other, select Team Foundation Server | Team Explorer
  • now click on "Connect to Team Foundation Server" or "Sign up for Visual Studio Online", based on your case; then provide the connection information, and select the project you want to connect
  • finally create a workspace in the workspace folder created previously (when you have installed Eclipse, anyway it should be in the user documents folder), then get all the files

From Xamarin Studio on Mac, it's now possible to open the solution from the workspace folder whose files have just been retrieved.

For this blog post I've used references from:

VS2015 Android emulator: multiple issues

Visual Studio 2015 introduces the new Android emulator. What is great is that it is based on Hyper-V technology, so hardware virtualization, as described more extensively in Introducing Visual Studio‚Äôs Emulator for Android.

Using it to develop Xamarin application, I've run into some issues, and I think that it would be good to collect them here:

  • first of all, during my first attempt to run it to debug a simple application, I got in the Output windows of Visual Studio this cryptic error:
         In mgmain JNI_OnLoad
         
    Couldn't connect to logcat, GetProcessId returned: 0
    As described in 
    Can't run app on Visual Studio 2015 emulator (DWP Handshake failed), the solution is to go to the Android project settings and in the Android Options tab, disable Fast Deployment
  • the second problem was that because of my naming convention for demo projects, I had a too long project name.
    Doing some attempts, I've verified that the longest project name you can give is 37 characters (more create problems with the deployment);
  • when I've been finally able to run my application, I've noticed that I had multiple graphic issues (even if the application is really basic).
    As described in Visual studio android emulator will not start fully, you have to go to the folder C:\Program Files (x86)\Microsoft XDE\10.0.10240.0\SKUs\Android, edit the file xdesku.xml and delete/comment the line:
         GuestDisplayProvider="VsEmulator.OpenGLGuestDisplay"