2

I have a UIDatePicker in count down timer mode . UIDatePicker by default is not supporting auto resizing. So I manually set the frame to resize for the landscape orientation

- (void) resizeDatePicker: (UIInterfaceOrientation)orientation
 {
    if (UIInterfaceOrientationIsPortrait(orientation)) 
      {
    self.timePicker.frame = CGRectMake(0, 44, 320, 216);
      }
    else 
     {
    self.timePicker.frame = CGRectMake(0, 44, 480, 162);
     }
  }

Its works in all other modes except for count down timer. In count down mode it's not appearing clearly.

UIDatePicker in landscape

Community
  • 1
  • 1
Anil Varghese
  • 42,757
  • 9
  • 93
  • 110

1 Answers1

1

Solved my problem.. Iam posting my answer here.. may help others. In count down timer mode you cannot resize the frame directly. So I added the date picker as subview of a view then apply CGAffineTransformMakeScale to the view. Then I set the frame to appropriate position also.

if (UIInterfaceOrientationIsPortrait(orientation)) 
{

    self.pickerView.transform = CGAffineTransformIdentity;
    self.pickerView.frame =CGRectMake(0,40, 320, 216);

}
else 
{

    self.pickerView.transform = CGAffineTransformMakeScale(0.65, 0.65);
    self.pickerView.frame =CGRectMake(0,40, 480, 140);

}

It will reduce the size of the picker by 65%. PickerView is the view contains the picker.
The following question help me to solve this problem

  1. How to change UIPickerView height
  2. Can We resize the UIDatePicker View in iPhone
  3. Is there any way to resize the UIPickerView so that I can see completely it in center of my application?
Community
  • 1
  • 1
Anil Varghese
  • 42,757
  • 9
  • 93
  • 110