16 Oct 2015
|
Xamarin.iOS
I am making an app where I don't want to display the shadow underneath the NavigationBar and the top gradient on a TabBar.
For some reason the Apple SDK does not provide a simple boolean Property where you can just disable it. A lot of solutions on StackOverflow requires you to set a background image and a shadow image to remove it entirely.
Digging through solutions a bit I found that these two ways seem to work pretty well.
So for the NavigationBar, what you do is traverse through all subviews to find the UIImageView which is the shadow and simple remove that from showing up. This is done as follows.
For the TabBar it is slightly different. It has a member variable, which is private, so you cannot get hold of it directly. However, using the SetValueForKey() method, which all NSObject's have, you can set that variable to true.
30 Jan 2015
|
Xamarin.Android
Maps
Recently the Map property on the MapFragment was marked obsolete. Instead, we now have to use the GetMapAsync() method. However, that method expects a callback object. Hence, we need slightly more code to not have our code use obsolete stuff.
For the callback we need to implement the IOnMapReadyCallback interface, which simply has a method which gives us the GoogleMap instance.
As you can see I simply implemented that interface, and as all interfaces coming from the Java world which expects a Dispose() and Handle implementation we need to inherit from Java.Lang.Object. I also added an event to that class instead of passing a reference of my Fragment into that class.
Now you might be using the SetupIfNeeded() method which Xamarin also uses in their samples and is called in OnCreate() and OnResume() and where ever you feel like it. For that purpose I have adapted that to use the callback class.