With a Xamarin.iOS project, I'm trying to use a Unicode character (gear icon) for the left bar button item in my top menu. I could use a custom icon for this, bit I read on some iOS posts here on SO that you can also use Unicode characters. So I followed an example, translated form Swift and it all works fine, except that my button title is always the literal Unicode string instead of the decoded gear icon.
Also, the code below will not build because that string ("\u{2699}") needs to be escaped. I've used \ and # escaping methods but I always end up with just the literal string in my button. Any ideas what I'm doing wrong?
var ltButton = new UIBarButtonItem();
ltButton.Title = new NSString("\u{2699}", NSStringEncoding.UTF8);
ltButton.Style = UIBarButtonItemStyle.Plain;
var font = UIFont.FromName("Helvetica", 18.0f);
ltButton.SetTitleTextAttributes(new UITextAttributes { Font = font }, UIControlState.Normal);
this.NavigationItem.SetLeftBarButtonItem(ltButton, true);
This is all you need:
ltButton.Title = "\u2699";
ltButton.Title = "\uD83D\uDE03";
Related
I have charts with 15-17 lines and the cursor modifier cuts off the view at 6 on phones. It looks great on tablets, but on phones, as said, only shows six. Is there a way to decrease the text size in the modifier to fit more lines?
As for Android I would suggest to take a look on Custom Cursors example and use it as a base. In this example CustomXySeriesTooltip inherits from TextView which is used to render tooltip's text. So you can set font size for it like on regular TextView ( in ctor or internalUpdate override ):
public CustomXySeriesTooltip(Context context, XySeriesInfo seriesInfo) {
super(context, seriesInfo);
this.setTextSize(TypedValue.COMPLEX_UNIT_SP, 10);
}
And the code for Xamarin.Android should be similar to Java one.
As for iOS - you can use dataStyle property provided by SCICursorModifierStyle which allows to specify font size:
SCITextFormattingStyle * textFormatting = [SCITextFormattingStyle new];
textFormatting.fontSize = 16;
textFormatting.fontName = #"Helvetica";
cursor.style.dataStyle = textFormatting;
Or you can create custom modifier like in this example.
I'm having some problems with bold text in hero cards, currently I build my hero card like so:
var workloadCard = new HeroCard
{
Title = $"Partido #{number+1}",
Subtitle = $"**{matches[number].equipo1} vs {matches[number].equipo2}**",
Text = ($"El {fecha.ToString("dd/MM/yyyy", System.Globalization.CultureInfo.InvariantCulture)} a las: \nMéxico: **{matches[number].hora.Replace(" ", "")}** \nRusia: **{horaRUs}** \nEn {matches[number].sede}"),
Images = new System.Collections.Generic.List<CardImage> { new CardImage($"{url}") },
Buttons = cardButtons,
};
The problem is that the text between ** ** is shown with asterisks instead of being bold:
$"**{matches[number].equipo1} vs {matches[number].equipo2}**
Turns into
**México vs Suecia**
Instead of
México vs Suecia
This happens in any part of the hero card but otherwise works in flat responses, what is the cause of this and how can I fix it?
Hero cards accept html tags inside them so I fixed this problem by doing this:
$"<b>{matches[number].equipo1} vs {matches[number].equipo2}</b>
Instead of this:
$"**{matches[number].equipo1} vs {matches[number].equipo2}**
I want to display text in multiple lines in the pin's label when it is clicked, but when I have a very long text to be displayed in Address it shows me only a part of it and rest of it remains hidden eg: 'Street 12A...'.
How can I make the label to display the whole text on clicking it and if possible then in multiple lines using Xamarin.Forms.Maps.
var pin = new Pin
{
Type = PinType.Place,
Position = position,
Label = "Label Name",
Address = "some text..........."
};
map.Pins.Add(pin);
You would be to create a custom render for map on each platform to replace the standard iOS pin annotations, Android pin markers, etc...
Xamarin has a full guide for creating custom pin annotations/markers and thus you can create the UI elements you need to display your full text.
Ref: https://developer.xamarin.com/guides/xamarin-forms/custom-renderer/map/
I am trying to set a text in UILabel, like this
mylabel.text = #"▶ section1";
but, the right arrow character is translated to audio player icon inside UILabel.
Is there a way to print right arrow character intactly as it is.
Thank you.
Try using unicode:
mylabel.text = #"\u25BA section 1";
I work on a project using Gtk & Ruby. I want when one icon was selected, it shouldn't seem as a rectangle.
http://i.imgur.com/RIEBipq.png
It just seem icon bound was selected. How can supply this?
http://i.imgur.com/LzT4H3C.png
I use iconview like below:
iconview = Gtk::IconView.new
file_store = Gtk::ListStore.new(String, String, TrueClass, Gdk::Pixbuf)
iconview.model = file_store
iconview.text_column = COL_DISPLAY_NAME
iconview.pixbuf_column = COL_PIXBUF
How can I code for this appearance?