2016-04-28 4 views
1

nullにすることはできませんだけフォントを設定するiOSのシミュレータバージョン8.1CATextLayerのSetFont XamarinのiOS値は

Font = UIFont.SystemFontOfSize(16); 
.... 
textLayer = new CATextLayer(); 
textLayer.ForegroundColor = TextColor.CGColor; 
textLayer.SetFont(CGFont.CreateWithFontName(Font.FontDescriptor.Family)); 

上で動作下回る私は、iOSシミュレータバージョン9.2

System.ArgumentNullException: Value cannot be null. 
Parameter name: handle 

上のコードをこのエラーが発生しました言及をトリガエラー。

textLayer.SetFont(CGFont.CreateWithFontName(Font.FontDescriptor.Family)); 

答えて

1
  • IOSの9 =システムフォントがIOSの8 San Fransisco
  • ある=システムフォントが使用UIFont.FontDescriptor.Name代わりにFamilyHelvetica Neue

あります。フルネームは常に機能します。

* D.WriteLine(Font.FontDescriptor.Family);

`.SF UI Text` 

* D.WriteLine(Font.FontDescriptor.Name)。

`.SFUIText-Regular` 

var Font = UIFont.SystemFontOfSize(16); 
var textLayer = new CATextLayer(); 
textLayer.ForegroundColor = UIColor.Red.CGColor; // TextColor.CGColor; 
textLayer.SetFont(CGFont.CreateWithFontName(Font.FontDescriptor.Name)); 
関連する問題