I thought I would write this list as I go through developing a cross-platform retail project I am working on at the moment, so here goes:
Cleaning your project can solve the weirdest of issues
If it isn’t working – and “for the life of it” you cannot work out why, do this.Clean your project, and rebuild it. I had been frustrated in the past with the simplest of features with regards to dismissing the keyboard using the following snippet from the Xamarin iOS developer website (https://developer.xamarin.com/recipes/ios/input/keyboards/dismiss_the_keyboard/):
this.txtDefault.ShouldReturn += (textField) => { textField.ResignFirstResponder(); return true; };
After a while of debugging and trying to work out what was wrong, I remembered my Xamarin University training and that my compiled app might be messed up.
Simple solution = Clean your project.
How to turn a UITextField into a secure password field with masked characters
This one is super easy, when defining your UITextfield just set the property SecureTextEntry to true;
textfield.SecureTextEntry = true;
Components can make your development so much easier
There are a load of different components available for free direct form the Xamarin components website at https://components.xamarin.com/
The most common components I have used in my projects have been Xamarin authored components for GeoLocation and Media / Device Info. Top quality!
Each component has a quick method for installing – direct from within Xamarin Studio, and when added to your application a quick snippet is available to enable you to start integrating straight away.
Here are some of my favourite components to date:
- Overlay Dialog and Progress View – https://components.xamarin.com/view/mbalertview
- Device Info Plugin – https://components.xamarin.com/view/DeviceInfoPlugin
- Discreet Notification – https://components.xamarin.com/view/gcdiscreetnotification
- Media Plugin – https://components.xamarin.com/view/MediaPlugin
- GeoLocator Plugin – https://components.xamarin.com/view/GeolocatorPlugin
There is no control available for a checkbox
Simply put, there is not a control available for a checkbox. The easiest way round this, if your application requires one, is to use a UIImageView and have a checked and unchecked image to display. You can then compare the current shown image to define if the image should be showing a checkbox or not. Simples!