Forum Xamarin.iOS

How can i do absolute layout functionality in IOS

AswathiPSAswathiPS USMember ✭✭

I want to add scaling property in Images , so am using interface for calling from xamarin forms to xamrin IOS controller .
and scalling property is work.

here is my code on ViewDidLoad():

public override void ViewDidLoad()
{
base.ViewDidLoad();

        this.View.BackgroundColor = UIColor.Black;

        _scrollView = new UIScrollView(new CGRect(0, 0, View.Frame.Width, View.Frame.Height - NavigationController.NavigationBar.Frame.Height));
        View.AddSubview(_scrollView);

        string _selectedAds = PassingData.value;

        if (!string.IsNullOrEmpty(_selectedAds))
        {
            var _url = new NSUrl(_selectedAds);
            var _data = NSData.FromUrl(_url);
            _imageView = new UIImageView(UIImage.LoadFromData(_data));
        }
        else
        {
            _imageView = new UIImageView(UIImage.FromFile("zoom.jpg"));
        }

        _imageView.Frame = new CGRect(0, View.Frame.Width / 2 - 200, View.Frame.Width, View.Frame.Height / 2);

        _scrollView.ContentSize = _imageView.Image.Size;
        _scrollView.AddSubview(_imageView);

        _scrollView.MaximumZoomScale = 5f;
        _scrollView.MinimumZoomScale = 1f;
        _scrollView.ViewForZoomingInScrollView += (UIScrollView sv) => { return _imageView; };
    }

then , I want to add a close image over the Loaded image, then click on that close image , return back to the same xamarin forms page , how to achieve this ?

Please help ,

Thanks.

my expected screen is below :

Sign In or Register to comment.