xamarin.ios在检测来自webservice

时间:2016-08-04 18:36:50

标签: c# iphone xamarin xamarin.ios

我正在使用xamarin开发一个ios应用程序。 我用这种方式创建了一个按钮:

var myBtn = new UIButton(UIButtonType.System);
        myBtn.Frame = new CGRect(xImg, 1180, 200, 100);
        myBtn.SetTitleColor(UIColor.Yellow, UIControlState.Normal);
        myBtn.AutoresizingMask = UIViewAutoresizing.FlexibleWidth;
        myBtn.TouchUpInside += delegate
        {
            NavController.PushViewController(new WebViewController(), false);
        };

WebViewController包含一个webservice调用,因此花费几秒钟来检测数据。 当我点击按钮时,应用程序首先调用webservice,然后更改UiViewController。这样我就无法实现Loading Overlay class

所以我需要它,当我点击按钮时,首先它显示空的UiViewController(带有LoadingOverlay),然后,当webservice调用完成时,显示剩余的组件。

这是WebViewController:

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

        Title = "MyTitle";

        var logo = new UIImageView(new CGRect(20, 50, sizes.Width - 40, 130));
        logo.Image = UIImage.FromBundle("logo.jpg");
        View.BackgroundColor = UIColor.Black;

            scrollView = new UIScrollView(new CGRect(20, 180, UIScreen.MainScreen.Bounds.Width - 40, UIScreen.MainScreen.Bounds.Height - 180));
            scrollView.BackgroundColor = UIColor.Black;
            .........
            List<UIImage> imagesList = getImagesList(urlG);
            int count = 0;
            List<UIImageView> imageViewList = new List<UIImageView>();
            List<UIButton> btnList = new List<UIButton>();
            nfloat imgS = getImgSizes();
            nfloat imgY = 0;
            ......
            for (int i = 0; i < imageViewList.Count; i++)
            {
                scrollView.AddSubview(imageViewList[i]);
                scrollView.AddSubview(btnList[i]);
            }
            scrollView.ContentSize = new CGSize(UIScreen.MainScreen.Bounds.Width - 40, ((imagesList.Count / 4) * getImgSizes()) + 150);
            View.AddSubview(logo);
            Add(scrollView);
            View.Add(loadPop);
            .....
        }
    }

0 个答案:

没有答案
相关问题