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

After updating Xamarin.ios business Edition to 7.0.6.168,All UIPickerViews component frame breaks.

$
0
0

I have update Xamarin.ios business Edition to 7.0.6.168.After this up-gradation UIPickerView component frame is breaking.If number of components in UIPickerView is one then it is displaying fine but if number of components in picker are more than one then frame is overlapping.I tried by setting Custom frame for label of Picker component but it is not taking that frame.In third screenshot I have attached there I have setted mm/dd/yyyy format but it is looking dd/yyy/mm,I think this is also because of frame issue.In Xamarin.ios 7.0.4.168 it is working fine.

Below is the needed code for displaying view of picker from UIPickerDelegate

public class DateTimePickerDelegate : UIPickerViewDelegate {
    public override UIView GetView (UIPickerView pickerView, int row, int component, UIView view)
    {
        pickerView.BackgroundColor = StyleHelper.Colors.OffWhite;
        UILabel label = null;
        switch (component) {
        case 0:
            label = new UILabel (new RectangleF (0, 0, 110, 20));
            label.TextAlignment = UITextAlignment.Right;
            if (IsDayMonthOptional)
                label.Text = months [row];
            else
                label.Text = months [row + 1];
            break;
        case 1:
            label = new UILabel (new RectangleF (0, 0, 50, 20));
            label.TextAlignment = UITextAlignment.Right;
            if (IsDayMonthOptional) {
                if (row == 0)
                    label.Text = "N/A";
                else
                    label.Text = (row).ToString ();
            } else
                label.Text = (row + 1).ToString ();
            break;
        case 2:
            label = new UILabel (new RectangleF (0, 0, 70, 20));
            label.TextAlignment = UITextAlignment.Right;
            label.Text = ((DateTimePickerView)pickerView).BaseDate.AddYears (row + 1).ToString ("yyyy");
            break;
        }
        if (label == null) {
            throw new ArgumentException (string.Format ("Invalid index for component: {0}", component));
        }

        SetLabelStyle (label);
        return label;
    }

    public override float GetComponentWidth (UIPickerView pickerView, int component)
    {
        switch (component) {
        case 0:
            return 120;
        case 1:
            return 60;
        case 2:
            return 80;
        }
        throw new ArgumentException (string.Format ("Invalid index for component: {0}", component));
    }
}

Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>