I'm getting my richmapfield from a factory like so:
map = MapFactory.getInstance().generateRichMapField();
My question is how do I detect clicks/swipes etc on a RichMapField?
As far as I understand it is not possible, because RichMapField is final class and cannot be extended. And its methods cannot be overriden.
Related
I'm a little confused as to wheather to use getManager() inside every function or should i make it as a class property like so manager = getManager() and access it like so this.manager. Is it the same or is there something i should be aware of when using one of the methods above. Thanks ahead.
If I have a helper class defined in a library that I don't want utilized outside of the library, is the correct hiding mechanism to place an underscore in front of the class name?
part of foo;
class Bar { } // made available to users of the foo library
class _BarHelp { } // hidden from users of the foo library
Or is there an alternate way of hiding BarHelp ?
Yes, the underscore works for class names the same as functions, methods, and fields, it makes them library-private.
Yes. this is correct way and there is no better way to do this in Google Dart language.
It is also the only possible way to use the privacy (does not provided other levels of privacy).
I just started messing around with Xamarin and I'm confused on two things. How to use it and if I'm searching the right keywords for help.
If I want to look up something can I look up the native iOS controls as an equivalent? I feel if I search "how to get value from ios picker" the answers are specific to objc-c. Even trying to look at the same properties I have no luck. The Xamarin Tutorials/ documentation I feel are disorganized and lacking. PickView isn't in the list of UI controls that have documentation.
I don't see any events for this PickViewer either in Xamarin Studio. I even try debug mode in Xamarin iOs but almost every property I try and check that seems it might be the answer gives me an "unknown member".
In this example, I have a Xamarin iOs pickviewer and can't figure out how to retrieve the value or even alert on a row selected which doesn't seem to work. I assume I can apply this to a list table as well?
Setting up the PickView list
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
pvBankRollAmounts.Model = new UIPickViewBetAmountOptions ();
}
So how can I get the value of what was selected in the UI? and what's the best way to find these answers on my own? Better Documentation somewhere?
Xamarin iOS sticks pretty closely to the Apple iOS model of doing things. It is actually beneficial to be able to read Obj-C (or Swift) so you can look at Apple's documentation and samples.
Xamarin has a PickerView sample as part of their sample app.
To get the Selected item, you need to override the Selected method in the Model class. This seems strange from a C# perspective, but it is a fairly common pattern in iOS, which commonly uses a Delegate pattern. You could create a custom event and raise it to be handled in your parent class.
public override void Selected (UIPickerView picker, int row, int component)
{
// row is the selected row
}
I'm trying to create a Plugin in MvvmCross that uses the UIActionSheet. But to use it I need to have the top View in iOS. I found in Android the IMvxAndroidCurrentTopActivity but i could not find a similar in iOS. Is there anything that i can use like this in iOS?
var activity = Mvx.Resolve<IMvxAndroidCurrentTopActivity>().Activity;
if (activity == null)
{
throw new Exception("Cannot get current top activity");
}
I don't think there is an exact equivalent.
Plugins like PictureChooser work around this by using IModalHost from the presenter - e.g. see https://github.com/MvvmCross/MvvmCross/blob/v3.1/Plugins/Cirrious/PictureChooser/Cirrious.MvvmCross.Plugins.PictureChooser.Touch/MvxImagePickerTask.cs
Other plugins rely on statics or globals - e.g. see https://github.com/brianchance/MvvmCross-UserInteraction/blob/master/Chance.MvvmCross.Plugins.UserInteraction.Touch/UserInteraction.cs
For your plugin, you could require that users provide a custom interface in their app (e.g. in the presenter) or you could add something to IModalHost as a pull request.
I an confused about how to pass values of variables from 1 gamecomponent to another.
I am using xna 4.0.
I created two gamecomponents, the drawstring and the inputmanager.
I want to read the keyboard input of the user and pass it onto drawstring where it will update the position.
I cant add components on drawstring(drawablegamecomponent).
I can do it on class but not on gamecomponent.
Can you guys post some examples here. For beginners.
Use GameComponent for something that you would want to have Update called on every frame, and use DrawableGameComponent for something that you would want to have Draw called on every frame and LoadContent called when appropriate (at the start of the program, as well as whenever the device is lost, like when the user pressed Ctrl-Alt-Del on Windows).
For InputManager you might want an Update method, so that you can keep user input updated, so InputManager could be a GameComponent. DrawString doesn't sound like it needs to be. Both classes sound like they could be services. In the constructor or Initialize method of your game class, do something like the following:
Components.Add(mInputManager = new InputManager(this));
Services.AddService(typeof(InputManager), mInputManager);
Services.AddService(typeof(DrawString), mDrawString = new DrawString(this))
(DrawString and any other class that you want to get game services from will need a reference to the Game object.)
(Note that GameComponents do not necessarily need to be services, and services do not need necessarily need to be GameComponents. To get Update and/or Draw to be called, you must call Components.Add(...); separately, to get an object to be retrievable as a service, you must call Services.AddService(...)).
Then, when you would like to use the InputManager or DrawString service in some other game component (or any class that you have passed a reference to your game object), you can do this:
InputManager input = (InputManager)Game.Services.GetService(typeof(InputManager));
Personally, I write an extension method to make that more concise:
using XNAGame = Microsoft.XNA.Framework.Game;
...
public static T GetService<T>(this XNAGame pXNAGame)
{
return (T)pXNAGame.Services.GetService(typeof(T));
}
The line to get the input service then becomes:
InputManager input = Game.GetService<InputManager>();