本文整理汇总了C#中NSBundle类的典型用法代码示例。如果您正苦于以下问题:C# NSBundle类的具体用法?C# NSBundle怎么用?C# NSBundle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
NSBundle类属于命名空间,在下文中一共展示了NSBundle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
public void Update()
{
// Check if a language is in the preferences that we have
var prefLang = NSUserDefaults.StandardUserDefaults.ArrayForKey("AppleLanguages")[0].ToString();
var settingsLang = Settings.Current.GetValueOrDefault<string>(Settings.LanguageKey, string.Empty);
var lang = string.IsNullOrEmpty(settingsLang) ? prefLang : settingsLang;
// We don't want to have english as default language, because it is the development language
if (!lang.Equals("en") && Array.IndexOf(NSBundle.MainBundle.Localizations, lang) >= 0)
{
langBundle = NSBundle.FromPath(NSBundle.MainBundle.PathForResource(lang, "lproj"));
}
else
{
// We want to use the default language
langBundle = null;
}
// Activate Vernacular Catalog
Catalog.Implementation = new ResourceCatalog
{
GetResourceById = id => {
if (langBundle == null)
return null;
var resource = langBundle.LocalizedString(id, null);
return resource == id ? null : resource;
},
};
}
示例2: SecondViewController
public SecondViewController(string nibName, NSBundle bundle)
: base(nibName, bundle)
{
this.Title = NSBundle.MainBundle.LocalizedString ("Second", "Second");
//this.TabBarItem.Image = UIImage.FromBundle ("Images/second");
this.TabBarItem.Image = UIImage.FromFile("Images/second.png");
}
示例3: EmployeeTableViewController
public EmployeeTableViewController(string nibName, NSBundle bundle)
: base(nibName, bundle)
{
m_arrEmployee = new ObservableCollection<Employee>();
Title = NSBundle.MainBundle.LocalizedString("Employees", "Master");
}
示例4: XIBLessController
public XIBLessController(string nibName, NibManager nibManager, NSBundle mainBundle)
: base()
{
this.Manager = nibManager;
this.LoadFromNib(nibName, mainBundle);
this.ViewDidLoad();
}
示例5: setLanguage
public static void setLanguage(string language)
{
if(!isLanguageSupport(language))
language = "en";
string path = NSBundle.MainBundle.PathForResource(language,"lproj");
bundle = NSBundle.FromPath (path);
}
示例6: PhotoViewController
public PhotoViewController (string nibName, NSBundle bundle) : base (NSObjectFlag.Empty)
{
photoMap = new Dictionary<NSUrl, string> ();
# if USE_FULLSCREEN_LAYOUT
WantsFullScreenLayout = true;
#endif
}
示例7: MainViewController
public MainViewController (string nibName, NSBundle bundle) : base (nibName, bundle)
{
// Custom initialization
info.TipValueChanged += (sender, e) => {
TipValue.Text = info.TipValue.ToString ();
Total.Text = (info.TipValue + info.Total).ToString ();
};
}
示例8: MvxSimpleTableViewSource
public MvxSimpleTableViewSource(UITableView tableView, string nibName, string cellIdentifier = null,
NSBundle bundle = null)
: base(tableView)
{
cellIdentifier = cellIdentifier ?? "CellId" + nibName;
_cellIdentifier = new NSString(cellIdentifier);
tableView.RegisterNibForCellReuse(UINib.FromName(nibName, bundle ?? NSBundle.MainBundle), cellIdentifier);
}
示例9: MvxSimpleTableViewSource
public MvxSimpleTableViewSource(UITableView tableView, string nibName, string cellIdentifier = null,
NSBundle bundle = null)
: base(tableView)
{
// if no cellIdentifier supplied, then use the nibName as cellId
cellIdentifier = cellIdentifier ?? nibName;
this._cellIdentifier = new NSString(cellIdentifier);
tableView.RegisterNibForCellReuse(UINib.FromName(nibName, bundle ?? NSBundle.MainBundle), cellIdentifier);
}
示例10: MasterViewController
public MasterViewController (string nibNameOrNull, NSBundle nibBundleOrNull) : base (nibNameOrNull, nibBundleOrNull)
{
titles [0] = "Faust - Erste Szene";
titles [1] = "Julius Caesar - Antony's speech";
titles [2] = "Midsummer Night's Dream - Exit speech";
titles [3] = "Romeo & Juliet - Queen Mab";
titles [4] = "Troilus and Cressida - Ulysses";
LoadPagesFromResource ("/Pages");
}
示例11: Settings
static Settings()
{
string resourcePath = NSBundle.MainBundle.PathForResource(NSLocale.PreferredLanguages[0], "lproj");
if(string.IsNullOrEmpty(resourcePath))
{
resourcePath = NSBundle.MainBundle.PathForResource("en", "lproj");
}
localeBundle = NSBundle.FromPath(resourcePath);
}
示例12: GetBackgroundModes
static string[] GetBackgroundModes(NSBundle bundle)
{
var backgroundModes = bundle.ObjectForInfoDictionary("UIBackgroundModes");
if (backgroundModes == null)
{
return new string[0];
}
return NSArray.StringArrayFromHandle(backgroundModes.Handle);
}
示例13: MvxTouchControl
public MvxTouchControl(string nibName, NSBundle bundle)
: base(nibName, bundle)
{
//Hack: iOS crashes if you create a MvxUIViewController without DataContext
DataContext = new object ();
if (!Mvx.CanResolve<IMvxControlsContainer>())
new Plugin().Load();
_container = Mvx.Resolve<IMvxControlsContainer>();
_container.Add(this);
}
示例14: RequestAuthorization
public static void RequestAuthorization(this CLLocationManager manager, NSBundle bundle)
{
if (bundle.RequiresBackgroundLocation())
{
bundle.ThrowIfNoBackgroundDescription();
manager.RequestAlwaysAuthorization();
}
else
{
bundle.ThrowIfNoInUseDescription();
manager.RequestWhenInUseAuthorization();
}
}
示例15: ThrowIfNoDescription
static void ThrowIfNoDescription(NSBundle bundle, string key)
{
if (!UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
{
return;
}
var backgroundModes = bundle.ObjectForInfoDictionary(key);
if (backgroundModes == null)
{
throw new InvalidOperationException(string.Format("You must provide a value for {0} in Info.plist to use location services", key));
}
}