Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

CGContextSetFillColor warning

$
0
0

Hi,

I have a picker view attached to a textfield (click on the textfield, the picker appears), however in the application output box is showing this - any ideas on what is causing it or a fix?

<Error>: CGContextSetFillColorWithColor: invalid context 0x0. This is a serious error. This application, or a library it uses, is using an invalid context and is thereby contributing to an overall degradation of system stability and reliability. This notice is a courtesy: please fix this problem. It will become a fatal error in an upcoming update

Useless error message....

code around it to get the picker...

txtImplement.EditingDidBegin += delegate
{
     var impl = new List<string>{"hello","world","today"};
     PickerUI.CreateDropList(View, new UIPickerView(), txtImplement, impl);
};

public static void CreateDropList(UIView view, UIPickerView picker, UITextField txtField, List<string> param)
        {
            var choiceModel = new PickerModel((IList<string>)param);
            string imp = param[0];
            picker = new UIPickerView
            {
                Model = choiceModel,
                BackgroundColor = UIColor.LightGray,
                ShowSelectionIndicator = true,
                Hidden = false,
                AutosizesSubviews = true,
                Frame = new RectangleF(0, 100, AppDelegate.Self.ScreenX, 162),
            };
            var action = new UIActionSheet
            {
                Style = UIActionSheetStyle.BlackTranslucent,
            };
            var toolHigh = new UIToolbar
            {
                BarStyle = UIBarStyle.Black,
                Translucent = true,
            };
            toolHigh.SizeToFit();
            var doneHigh = new UIBarButtonItem(StringUtils.GetString("Common.Done"), UIBarButtonItemStyle.Done,
                               (ss, ea) =>
                {
                    action.DismissWithClickedButtonIndex(0, true);
                    picker.ResignFirstResponder();
                    txtField.Text = imp;
                    txtField.ResignFirstResponder();
                });
            toolHigh.SetItems(new UIBarButtonItem[] { doneHigh }, true);
            action.ShowInView(view);
            action.AddSubview(toolHigh);
            action.AddSubview(picker);
            action.Frame = new RectangleF(0, 100, 320, 500);
            picker.Frame = new RectangleF(action.Frame.X, action.Frame.Y - 25, action.Frame.Width, 216);
            choiceModel.PickerChanged += (object sender, PickerChangedEventArgs ea) =>
            {
                imp = ea.SelectedValue;
            };
        }

Paul


Viewing all articles
Browse latest Browse all 204402

Trending Articles