-
-
Save jon-davis-xamarin/ba9523272432dc79caff to your computer and use it in GitHub Desktop.
NSString localizedStringWithFormat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class NSStringExtensions | |
{ | |
[DllImport(Constants.ObjectiveCLibrary, EntryPoint="objc_msgSend")] | |
private extern static IntPtr IntPtr_objc_msgSend_IntPtr (IntPtr receiver, IntPtr selector, IntPtr arg1); | |
public static NSString LocalizedStringWithFormat (this NSString @string) | |
{ | |
var nsHandle = IntPtr_objc_msgSend_IntPtr (Class.GetHandle (typeof(NSString)), Selector.GetHandle ("localizedStringWithFormat:"), @string.Handle); | |
var nsstring = Runtime.GetNSObject<NSString> (nsHandle); | |
return nsstring; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This isn't yet working for me. My stringsdict is set up as the iOS documentation describes for English plurals. Is there something special I'm supposed to do with the returned NSString to get it's text value?