Replicating the same font used in iOS settings using Xamarin Forms? - xamarin

From what I can see the default font used in iOS is San Francisco.
I am creating a page of settings for my application and I would like to use this font. Can anyone tell me how I can access and be sure that my XF app is using this font With iOS?

You could set custom fonts in Forms .
in iOS
Firstly , download the font file (San Francisco.ttf) and place in your Resources folder. Make sure the build type is BundleResource.
In addition to this, on iOS you have to open up your info.plist, and add in the file names of the fonts you want to use.
<key>UIAppFonts</key>
<array>
<string>xxx.ttf</string>
</array>
###Using Custom Fonts
Now we get to actually using them. Because referencing fonts requires different syntax for each OS. To best accommodate this, in your Application Resources, it is good to define your fonts.
For iOS we take the exact name of the file, without the extension (without .ttf)
In Android , since we don't set the value , it will still display the default font .
<ResourceDictionary>
<OnPlatform x:TypeArguments="x:String" x:Key="NormalFont">
<On Platform="iOS" Value="xxx" /> //xxx is San Francisco.ttf file name without .ttf extension
</OnPlatform>
</ResourceDictionary>
Then to use the font, you just need to reference the key.
<StackLayout>
<Label Text="Welcome to Xamarin Forms! (San Francisco in iOS)" FontFamily="{StaticResource NormalFont}" />
</StackLayout>
###Update
As the default font of UIControl in iOS is Helvetica . San Francisco is available after iOS 9.0 . So it is necessary to download it if your app need to support iOS 8.0 and before . After iOS 9.0 you don't need to set the font any more . San Francisco is the default font in iOS .

Related

React Native Image not working Android both in emulator and in device

<Image /> is shown in iOS simulator but not shown in Android emulator and device.
It's only not working when I use it as custom marker for google maps
<MapView.Marker
coordinate={this.state.spot}
>
<View style={styles.customMarker}>
<Image style={styles.marker}
source={images.customMarker}
resizeMode='stretch'
/>
</View>
</MapView.Marker>
it could be the problem with simulator as well as it happens with weak network
try completely resetting it. (as if it were a new iPhone). "Reset content and settings"
Keep an eye on your image url as well.
Rebuild your project and run . It works for me.

Get Missing Marketing Icon when using Xcode to upload ionic App to iTunes Connect

Since upgrading Xcode to the latest version 9.0 when submitting my ionic app to iTunes Connect I get the error:
Missing Marketing Icon. iOS Apps must include a 1024x1024px Marketing Icon in PNG format
I have added this to the config.xml
<icon height="1024" src="resources/ios/icon/icon-1024.png" width="1024" />
And added the 1024x1024 icon to both
resources/ios/icon/
and to
platforms/ios/myapp/Images.xcassets/AppIcon.appiconset/icon-1024.png

use Gluon plugins deploy an android apk then all of the chinese charactor is not disapear

I creat a gluon project use multi view project(FXML) ,then I just modify the buttons character to chinese . the project run under desktop it's no problem but using android->android to deploy an apk and when install on android phone or andorid simulator and run it all of the chinese charactor is not dispear!
By default Gluon Mobile uses Roboto font, which doesn't include Chinese characters.
One easy way you can solve this issue is by setting any of the Android system fonts that do include them.
Using Font.getFamilies() on my Android device I discovered this one: Noto Sans CJK SC Regular.
So you can easily add this to the view's css file:
.view {
-fx-font-family: "Noto Sans CJK SC Regular";
}
That should work.

Why are my Xamarin UWP Images not showing up on device?

I am developing a Xamarin UWP app using ffimageloading. The images show up just fine on the Windows Phone emulator that I am running through Visual Studio, but when I deploy it to a device through the device portal all of the images are missing.
<ffimageloading:CachedImage Grid.Column="0" Grid.Row="1"
Source="{helpers:ImageResource MyProject.Assets.Images.music-doublenote.png}" />
The issue was the build configuration. By turning off "Compile with .NET Native tool chain" on the Build tab of Properties for the Release configuration of the main UWP app and deploying the app with WinAppDeployCmd.exe
I had the same problem whenever I kept the image file inside any folder (for. eg assests). But later i started keeping the images file in the main project folder; I didn't keep them inside any folders and they started to show up in the application.
To get "Compile with .NET Native tool chain" working you have to use UWP-specific overload of the Forms.Init call which allows to correctly include FFImageLoading assemblies for Xamarin.Forms usage:
// you'll need to add `using System.Reflection;`
List<Assembly> assembliesToInclude = new List<Assembly>();
//Now, add in all the assemblies your app uses
assembliesToInclude.Add(typeof (FFImageLoadingAssembliesHere).GetTypeInfo().Assembly);
//Also do this for all your other 3rd party libraries
Xamarin.Forms.Forms.Init(e, assembliesToInclude);
// replaces Xamarin.Forms.Forms.Init(e);
I also had the issue with images not showing up on my UWP app. The images were showing up on my Android project but not UWP. For me the solution was to add the file extension. For some reason "myimage" works on Android but not on UWP, has to include the file extension like "myimage.png". Just wanna leave this here for anyone else potentially experiencing the same issue.

Displaying an icon on the AIR Application Installation Screen

Is it possible to display an icon on the AIR Application Installation Screen?
I downloaded an AIR application, and I was surprised to see an icon on the second installation screen.
When you purchase SSL certificate and make air application build with that certificate, then this icon is showed during installation.
In your main-app.xml config file look for the <icon> tag and set an image file for the <image128x128> tag relative to your src folder eg.
<icon>
<image16x16>/assets/icons/16x16.png</image16x16>
<image32x32>/assets/icons/32x32.png</image32x32>
<image48x48>/assets/icons/48x48.png</image48x48>
<image128x128>/assets/icons/128x128.png</image128x128>
</icon>
These different sizes cover you for different eventualities such as OSX dock, XP quick launch and also for the installer.

Resources