示例#1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var            cache  = HNKCache.SharedCache;
            HNKCacheFormat format = (HNKCacheFormat)cache.Formats["thumbnail"];

            if (format == null)
            {
                format = new HNKCacheFormat("thumbnail")
                {
                    Size               = new SizeF(320, 240),
                    ScaleMode          = HNKScaleMode.AspectFill,
                    CompressionQuality = 0.5f,
                    DiskCapacity       = 1 * 1024 * 1024,
                    PreloadPolicy      = HNKPreloadPolicy.LastSession
                };
            }

            var fetcher = new HNKNetworkFetcher(new NSUrl("https://media-cdn.tripadvisor.com/media/photo-s/03/9b/30/26/seattle.jpg"));

            fetcher.FetchImage((imag) => { HanekeImageView.Image = imag; }, (err) => { });
            HanekeImageView.SetCacheFormat(format);
            //HanekeImageView.SetImage(new NSUrl("https://www.xamarin.com/content/images/pages/branding/assets/xamagon.png"), UIImage.FromBundle("41015.png") );
            HanekeButton.SetBackgroundImage(new NSUrl("https://www.xamarin.com/content/images/pages/branding/assets/xamagon.png"), UIControlState.Normal, UIImage.FromBundle("41015.png"));
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var            cache  = HNKCache.SharedCache();
            HNKCacheFormat format = (HNKCacheFormat)cache.Formats["thumbnail"];

            if (format == null)
            {
                format = new HNKCacheFormat("thumbnail")
                {
                    Size               = new SizeF(320, 240),
                    ScaleMode          = HNKScaleMode.AspectFill,
                    CompressionQuality = 0.5f,
                    DiskCapacity       = 1 * 1024 * 1024,
                    PreloadPolicy      = HNKPreloadPolicy.LastSession
                };
            }


            HanekeImageView.SetCacheFormat(format);
            HanekeImageView.SetImage(new NSUrl("http://images.kpopstarz.com/data/images/full/190451/katy-perry-sex-bomb.png?w=300"), UIImage.FromBundle("41015.png"));
            HanekeButton.SetBackgroundImage(new NSUrl("http://images.kpopstarz.com/data/images/full/190451/katy-perry-sex-bomb.png?w=300"), UIControlState.Normal, UIImage.FromBundle("41015.png"));
        }