当前位置: 首页>>代码示例>>C#>>正文


C# NSBundle类代码示例

本文整理汇总了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;
					},
				};
		}
开发者ID:Surfoo,项目名称:WF.Player,代码行数:30,代码来源:LanguageSetter.cs

示例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");
 }
开发者ID:GSerjo,项目名称:monotouch-samples,代码行数:7,代码来源:SecondViewController.cs

示例3: EmployeeTableViewController

        public EmployeeTableViewController(string nibName, NSBundle bundle)
            : base(nibName, bundle)
        {
            m_arrEmployee = new ObservableCollection<Employee>();

            Title = NSBundle.MainBundle.LocalizedString("Employees", "Master");
        }
开发者ID:vikewoods,项目名称:KMSDirectoryMono,代码行数:7,代码来源:EmployeeTableViewController.cs

示例4: XIBLessController

 public XIBLessController(string nibName, NibManager nibManager, NSBundle mainBundle)
     : base()
 {
     this.Manager = nibManager;
     this.LoadFromNib(nibName, mainBundle);
     this.ViewDidLoad();
 }
开发者ID:dtavlikos,项目名称:JTNibManager,代码行数:7,代码来源:XIBLessController.cs

示例5: setLanguage

		public static void setLanguage(string language)
		{
			if(!isLanguageSupport(language))
				language = "en";
			string path = NSBundle.MainBundle.PathForResource(language,"lproj");
			bundle = NSBundle.FromPath (path);
		}
开发者ID:borain89vn,项目名称:demo2,代码行数:7,代码来源:TCLocalizabled.cs

示例6: PhotoViewController

		public PhotoViewController (string nibName, NSBundle bundle) : base (NSObjectFlag.Empty)
		{
			photoMap = new Dictionary<NSUrl, string> ();
# if USE_FULLSCREEN_LAYOUT
			WantsFullScreenLayout = true;
#endif
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:7,代码来源:PhotoViewController.cs

示例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 ();
			};
		}
开发者ID:Adameg,项目名称:mobile-samples,代码行数:8,代码来源:MainViewController.cs

示例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);
 }
开发者ID:darkice-matt-crombie,项目名称:MvxSpinnerTest,代码行数:8,代码来源:MvxSimpleTableViewSource.cs

示例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);
 }
开发者ID:MvvmCross,项目名称:MvvmCross,代码行数:9,代码来源:MvxSimpleTableViewSource.cs

示例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");
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:10,代码来源:MasterViewController.cs

示例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);
        }
开发者ID:zekiller3,项目名称:SMSParty,代码行数:10,代码来源:Settings.cs

示例12: GetBackgroundModes

        static string[] GetBackgroundModes(NSBundle bundle)
        {
            var backgroundModes = bundle.ObjectForInfoDictionary("UIBackgroundModes");

            if (backgroundModes == null)
            {
                return new string[0];
            }

            return NSArray.StringArrayFromHandle(backgroundModes.Handle);
        }
开发者ID:tomgilder,项目名称:RxPosition,代码行数:11,代码来源:NSBundleExtentions.cs

示例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);
        }
开发者ID:ChristianRuiz,项目名称:MvvmCross-ControlsNavigation,代码行数:12,代码来源:MvxTouchControl.cs

示例14: RequestAuthorization

 public static void RequestAuthorization(this CLLocationManager manager, NSBundle bundle)
 {
     if (bundle.RequiresBackgroundLocation())
     {
         bundle.ThrowIfNoBackgroundDescription();
         manager.RequestAlwaysAuthorization();
     }
     else
     {
         bundle.ThrowIfNoInUseDescription();
         manager.RequestWhenInUseAuthorization();
     }
 }
开发者ID:tomgilder,项目名称:RxPosition,代码行数:13,代码来源:CLLocationManagerAuthorizeExtentions.cs

示例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));
            }
        }
开发者ID:tomgilder,项目名称:RxPosition,代码行数:13,代码来源:NSBundleExtentions.cs


注:本文中的NSBundle类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。