FontAwesome icons in Xamarin.IOS not showing up - ios

I have looked at and tried the first Ten examples of how to accomplish this on google and none of them work. I was able to only get one FontAwesome icon to work and that was the glyph five icon and it still wont work. Has anyone here been able to get this to work recently and if not, are there any alternatives to FontAwesome? I dont realy want to use images because the scale doesnt look right when going from an iPhone 5 to an ipad pro.

I was struggling with this issue. Fortunately, I got the right result at last. Please follow the checklist below:
Make sure your icon exists in the font files. Some icons are only available in Solid font. Check it on the FontAwesome web site. Also, you can try to set the FontAttribute of the Label as "Bold".
Place the font files in the Resources folder, such as Resources\Font Awesome 5 Free-Solid-900.otf. Then add the section below into the info.plist:
<key>UIAppFonts</key>
<array>
<string>Font Awesome 5 Brands-Regular-400.otf</string>
<string>Font Awesome 5 Free-Regular-400.otf</string>
<string>Font Awesome 5 Free-Solid-900.otf</string>
</array>
Make sure you select the right font name, not the file name. You can define a style as shown below:
<OnPlatform x:Key="FontAwesomeString" x:TypeArguments="x:String">
<On Platform="iOS" Value="Font Awesome 5 Free" />
<On Platform="Android" Value="Font Awesome 5 Free-Solid-900.otf#Font Awesome 5 Free Solid" />
<On Platform="UWP" Value="Assets/fonts/Font Awesome 5 Free-Solid-900.otf#Font Awesome 5 Free" />
So you can use the style like this:
<Label Text="{Binding Icon}" FontAttributes="Bold"
Style="{StaticResource FontAwesome}" />
If you use it in XAML, use it like: Text="" Use &#x before the font code.
If you use it in C# code, use it like: Text="\uf015"; Use \uf before the font code.
No need to "Copy to Output Directory". Just set the BuildAction as BundleResource.
Hope it would be helpful.

Related

display html formatted data xamarin forms

I am using webview to display html formatted data that is coming from database. i have tried implementing the HtmlWebViewSource to display the data but it is not displaying. Here is what i have implemented.
<WebView VerticalOptions="Fill" BackgroundColor="Red">
<WebView.Source>
<HtmlWebViewSource x:Name="surveyInstruction"/>
</WebView.Source>
</WebView>
.cs
surveyInstruction.Html = result[1][i].vchar_Instruction;
This is what i am getting from database
Question<font size="4"><b> Instruction</b></font>
i referred this post as well
Xamarin Forms control where I can show HTML formated text
What version of Xamarin.Forms are you using? I remember there were some issues like this one.
I'm using the WebView as follows (with binding) and that works fine for me.
<WebView
HorizontalOptions="FillAndExpand"
VerticalOptions="FillAndExpand">
<WebView.Source>
<HtmlWebViewSource Html="{Binding PrivacyPolicyAsHtml}" />
</WebView.Source>
</WebView>
The PrivacyPolicyAsHtml property exists in the View Model and is assigned there.
Change VerticalOptions from "Fill" to "FillAndExpand", you should able to see the WebView or set the height for the WebView based on the requirements.

SVG links on iPhone

I'm a graphic designer and I work with vector graphic (.svg).
I have a problem with my website and SVG links. Everything work just fine in Chrome (Desktop) and on Android and Windows mobile OS. The problem is just in iOS (Safari, Chrome,...), where I can see the SVG shape but not able to click on it.
<g class="Facebook">
<a href="http://www.facebook.com/Muhedinovic14" target="_blank">
<circle fill="#FFFFFF" cx="576.691" cy="646.241" r="46.112"/>
<path fill="#1B1B1B" d="M576.689,600.129c-25.467,0-46.111,20.646-46.111,46.114c0,25.467,20.645,46.11,46.111,46.11
s46.115-20.644,46.115-46.11C622.805,620.774,602.156,600.129,576.689,600.129z M576.689,690.432
c-24.404,0-44.189-19.786-44.189-44.188c0-24.406,19.785-44.192,44.189-44.192c24.406,0,44.191,19.786,44.191,44.192
C620.881,670.646,601.096,690.432,576.689,690.432z"/>
<path fill="#1B1B1B" d="M576.689,604.386c-23.117,0-41.857,18.74-41.857,41.857c0,23.118,18.74,41.858,41.857,41.858
c0.695,0,1.375-0.072,2.061-0.105v-0.01v-8.912v-21.22h-10.455v-12.109h10.455v-8.93c0-10.362,6.334-16.008,15.582-16.008
c4.424,0,8.23,0.331,9.338,0.478v10.83l-6.408,0.005c-5.029,0-6.008,2.388-6.008,5.895v7.73h11.994l-1.563,12.109h-10.432v21.22
v6.356v0.015c15.926-5.926,27.293-21.214,27.293-39.202C618.547,623.126,599.807,604.386,576.689,604.386z"/>
CSS:
.Facebook:hover path {
fill: #485A96;
Please visit www.vector.ba to see details.
Any kind of help would be great. Thanks!
Safari does not yet support href for links. You need to change the attribute to xlink:href instead.

x:Bind Design Time issues

I am trying to build my UWP app and currently am stuck with designer exceptions when trying to use DataTemplate with x:Bind in a Resource Dictionary.
I have created a Resource Dictionary "ItemTemplates.xaml" with a respective code-behind (to ensure x:Bind initialization). The file contains just one template:
<DataTemplate x:Key="HomeViewCategoryListItemTemplate" x:DataType="models:Category">
<Button Background="#88333333" Height="110" VerticalContentAlignment="Top" Padding="10" HorizontalAlignment="Stretch">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<TextBlock FontWeight="Light" HorizontalAlignment="Center" Text="{x:Bind Name}" FontSize="{ThemeResource TextStyleExtraLargeFontSize}" />
<TextBlock Foreground="{ThemeResource ToolTipForegroundThemeBrush}" HorizontalAlignment="Center" Margin="0,10,0,0" Text="{x:Bind Description}" Grid.Row="1" TextAlignment="Center" TextWrapping="Wrap" />
</Grid>
</Button>
</DataTemplate>
Then I added this resource dictionary to App.xaml like this:
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///Resources/Core.xaml" />
<resources:ItemTemplates />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Now the project is unusable, because designer throws weird exceptions, but when I Clean and Rebuild the project and navigate to the HomeView.xaml page, the designer shows just the default "ToString()" items (basically the list view contains just three times the text "Models.Categories") in the ListView and the ItemTemplate property of my ListView is underlined and shows the following error:
The resource "HomeViewCategoryListItemTemplate" could not be resolved.
When I navigate back to App.xaml, I see yet another underline there (of the <resources:ItemTemplates /> line) which says:
The property 'DataType' was not found in type 'DataTemplate'.
Both errors are non-sensical, because when I actually run the app, there are no issues and everything works perfectly. The only workaround I have found so far is to include the ResourceDictionary two times in both the classic way and the "compiled" way:
<ResourceDictionary Source="ItemTemplates.xaml" />
<resoures:ItemTemplates />
This solution works and then everything works both in design time and in run-time, but I really think it is quite messy and there has to be a better, safer approach or I am missing something trivial.
I am running Visual Studio 2015 Update 1 and have the newest UWP SDK installed. The project targets build 10240.
Edit:
Another exception that the designer very often throws and crashes completely:
Unable to cast object of type 'System.String' to type 'Models.Data.Categories.Category'.
According to the StackTrace output this happens inside the ItemTemplates.xaml.cs code - specifically the generated method ProcessBindings. Again, the project still compiles and runs normally, but the designer does not even bother trying to show the output.
For this current version, prefer Binding over x:Bind
an answer from a Microsoft engineers
I've got the same problems as you did, plus a ton of bugs when using x:Bind in Design time. Quickest way to fix: use Binding as old time. And when you release, if performance is under consideration, change the Binding to x:Bind

Flash app for iPad; need to add high-res icons, but how?

Am publishing an app for iPad with Flash cc, air 4.0.
Problem: I need to include 2 high-res icons, 76x76 and 152x152.
But, nowhere on the Flash publish settings (under the icons tab) do I see a way to add those files. Still, Apple is giving me hassle about them.
Does anyone know how to add those extra icons, what to name them, where to put them so that when they are bundled in the IPA, they are included?
Thanks!!
This is my descriptor file ("cannot be parsed" error): Maybe I'm putting the two new icons in the wrong place in my code?? This is the whole descriptor file:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<application xmlns="http://ns.adobe.com/air/application/4.0">
<id>com.theapptrain.tpvision</id>
<versionNumber>1.0</versionNumber>
<filename>Hospitality TV</filename>
<description></description>
<!-- To localize the description, use the following format for the description element.
<description>
<text xml:lang="en">English App description goes here</text>
<text xml:lang="fr">French App description goes here</text>
<text xml:lang="ja">Japanese App description goes here</text>
</description>
-->
<name>Hospitality TV</name>
<!-- To localize the name, use the following format for the name element.
<name>
<text xml:lang="en">English App name goes here</text>
<text xml:lang="fr">French App name goes here</text>
<text xml:lang="ja">Japanese App name goes here</text>
</name>
-->
<copyright></copyright>
<initialWindow>
<content>TPVisionApp.swf</content>
<systemChrome>standard</systemChrome>
<transparent>false</transparent>
<visible>true</visible>
<fullScreen>true</fullScreen>
<autoOrients>false</autoOrients>
<aspectRatio>landscape</aspectRatio>
<renderMode>auto</renderMode>
</initialWindow>
<customUpdateUI>false</customUpdateUI>
<allowBrowserInvocation>false</allowBrowserInvocation>
<icon>
<image29x29>icons/tpvision29x29.png</image29x29>
<image57x57>icons/tpvision57x57.png</image57x57>
<image114x114>icons/tpvision114x114.png</image114x114>
<image512x512>icons/tpvision512x512.png</image512x512>
<image48x48>icons/tpvision48x48.png</image48x48>
<image72x72>icons/tpvision72x72.png</image72x72>
<image76x76>icons/tpvision76x76.png</image76x76>
<image50x50>icons/tpvision50x50.png</image50x50>
<image58x58>icons/tpvision58x58.png</image58x58>
<image100x100>icons/tpvision100x100.png</image100x100>
<image144x144>icons/tpvision144x144.png</image144x144>
<image152x152>icons/tpvision152x152.png</image152x152>
<image1024x1024>icons/tpvision1024x1024.png</image1024x1024>
</icon>
<supportedLanguages>en</supportedLanguages>
<iPhone>
<requestedDisplayResolution>high</requestedDisplayResolution>
<InfoAdditions><![CDATA[
<key>UIDeviceFamily</key>
<array><string>2</string></array>
]]></InfoAdditions>
</iPhone>
<version>1.0</version>
</application>
You might want to take a look here: http://help.adobe.com/en_US/air/build/WS901d38e593cd1bac1e63e3d129907d2886-8000.htmlI used to build my apps via flash too and I always entered the icons in the application description file as described on the linked site.

Firefox Extension Development: Adding Tabs to the Preference Pane?

I'm adding this:
<prefwindow id="BrowserPreferences">
<!-- Create a new pane (tab) -->
<prefpane id="whateverPrefs" label="yes!"
onpaneload="alert('hey')"
image="chrome://helloworld/content/images/man.png">
<!-- Intermediary between GUI and preferences system -->
<preferences>
<!-- see the next section for more information -->
</preferences>
<!-- GUI Elements... -->
</prefpane>
</prefwindow>
to my overlay.xul. It doesn't work whatsoever, though it is suggested here. I do have wonderful success with this code, though:
<menupopup id="menu_ToolsPopup">
<menuitem id="helloworld-hello2" label="frigger!"
oncommand="HelloWorld.onMenuItemCommand(event);"/>
</menupopup>
Is this a version problem (e.g., Firefox 3.x will not do it)? I am unable to find the string BrowserPreferences in browser.xul, which seems to be part of the problem. How can I add tabs to the preference pane in Firefox?
[Sorry if this question is really simple, but searching for help on Firefox Extensions is like searching for help on the word "is."]
I don't think your code is wrong, but it should be overlaying preferences.xul not browser.xul - I'm guessing your overlay is registering with browser.xul and that's why your menu item works fine.
Check the section 'Register an Overlay' about half way down the MDC article Building an Extension

Resources