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

Mahesh.4303Mahesh.4303 USMember
edited January 2014 in Xamarin.iOS

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));
    }
}

Answers

  • VelocityVelocity NZMember ✭✭✭

    Having issues with 7.0.6 myself, was causing some unexpected behaviours in the application. Have reverted to 7.0.5 and everything is fine.

  • maheshmahesh INMember

    Yah,I also did the same thing and it is working fine.But what's the different in New version.

  • gSOLOgSOLO USMember
    edited January 2014

    I'm encountering the same issue. (I have found the necessary download of 7.0.5 under my account/downloads, and reverted to it).

  • I am on Version: 7.0.6.168 (Business Edition) and having a similar issue. See image attached. Any ideas of how to solve this problem?

  • RolfBjarneKvingeRolfBjarneKvinge USXamarin Team Xamurai

    @JulioGarcia: try Xamarin.iOS 7.0.7 from the beta channel.

Sign In or Register to comment.