Re: UIDatePicker in landscape - displaying items moving into position weirdness
Re: UIDatePicker in landscape - displaying items moving into position weirdness
- Subject: Re: UIDatePicker in landscape - displaying items moving into position weirdness
- From: "Eric E. Dolecki" <email@hidden>
- Date: Fri, 11 Dec 2009 16:53:14 -0500
That works great. I have another view that does some animation, and I forgot
to close the animation block with a commitAnimations, and the view with the
picker in it animates in too - seems like an unclosed animation block
anywhere in such a case can screw up a view with a picker in landscape in
it.
On Fri, Dec 11, 2009 at 4:10 PM, Eric E. Dolecki <email@hidden> wrote:
> That's brilliant - thank you very much. Works great!
>
>
> On Fri, Dec 11, 2009 at 4:01 PM, Alex Kac <email@hidden> wrote:
>
>> Well, we simply create the control via code on loadView and then when
>> orientation changes, we release it and recreate it. This way its always
>> initialized properly for that orientation.
>>
>> - (void)createRelativeTriggerTimeSpanPicker
>> {
>> timeSpanPicker = [[UITimeSpanPicker alloc] initWithFrame: CGRectZero];
>> timeSpanPicker.timeSpanDuration = relativeTrigger;
>> [timeSpanPicker addTarget: self action: @selector(_updateRelativeTime)
>> forControlEvents: UIControlEventValueChanged];
>> [self.view addSubview: timeSpanPicker];
>> }
>>
>> - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
>> duration:(NSTimeInterval)duration
>> {
>> if (timeSpanPicker)
>> {
>> //remove it
>> [timeSpanPicker removeFromSuperview];
>> [timeSpanPicker release];
>>
>>
>> //now add it again
>> [self createRelativeTriggerTimeSpanPicker];
>> }
>> }
>>
>>
>> On Dec 11, 2009, at 2:55 PM, Eric E. Dolecki wrote:
>>
>> What do you mean initialized when in landscape mode? (I'm still green
>> here). How can I make sure that happens?
>>
>> On Fri, Dec 11, 2009 at 3:41 PM, Alex Kac <email@hidden> wrote:
>>
>>> I found that this control works fine in Iphone OS 3.0 and higher in
>>> landscape - but only if its initialized when in landscape mode (i.e. status
>>> bar and all). If you rotate it or its rotated, it won’t work.
>>>
>>> On Dec 11, 2009, at 2:38 PM, Eric E. Dolecki wrote:
>>>
>>> > I take it back - it does not work in the Simulator either.
>>> >
>>> > I am calling up the view from the AppDelegate like this:
>>> >
>>> > EditAlarmViewController *myEditView = [[EditAlarmViewController alloc]
>>> > initWithNibName:@"EditAlarmViewController" bundle:[NSBundle
>>> mainBundle]];
>>> > //TODO: get these to come out of the corners
>>> > [myEditView.view setCenter:CGPointMake(160, 240)];
>>> > myEditView.view.bounds = CGRectMake(0, 0, 480, 320);
>>> > [myEditView whichAlarmAmI:whichAlarm];
>>> > [window addSubview:myEditView.view];
>>> > myEditView.view.alpha = 0.0;
>>> > CGAffineTransform transformA = CGAffineTransformMakeScale(0.5, 0.5);
>>> > CGAffineTransform transformB =
>>> > CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(90));
>>> > myEditView.view.transform = CGAffineTransformConcat(transformA,
>>> > transformB);
>>> > [UIView beginAnimations:nil context:nil];
>>> > [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
>>> > [UIView setAnimationDuration:0.5f];
>>> > myEditView.view.alpha = 1.0;
>>> > CGAffineTransform transformNorm = CGAffineTransformMakeScale(1.0, 1.0);
>>> > CGAffineTransform transformC =
>>> > CGAffineTransformMakeRotation(DEGREES_TO_RADIANS(90));
>>> > myEditView.view.transform = CGAffineTransformConcat(transformNorm,
>>> > transformC);
>>> > [UIView commitAnimations];
>>> >
>>> > On Fri, Dec 11, 2009 at 3:32 PM, Eric E. Dolecki <email@hidden>
>>> wrote:
>>> >
>>> >> I am using a UIDatePicker in landscape - and I have noticed on the
>>> device
>>> >> (in Simulator it works fine) that the animation of the numerals into
>>> >> position can be seen floating and delayed into position.
>>> >>
>>> >> What I mean is that if I scroll a column down, I see a number fly up
>>> from
>>> >> the bottom to it's position up top out of view, ready to be displayed
>>> if
>>> >> needed. This numeral should be hidden while being placed. If I scroll
>>> >> quickly, I'll see an empty column and then the numbers fly up into
>>> place.
>>> >>
>>> >> In my viewDidLoad:
>>> >>
>>> >> picker.frame = CGRectMake(135,37,205,162);
>>> >> for(UIView *subview in picker.subviews){
>>> >> subview.frame = picker.bounds;
>>> >> }
>>> >>
>>> >> Is there a mask or something else that I would need to set the frame
>>> for as
>>> >> well so that the animations look correct? It seems like this control
>>> really
>>> >> doesn't enjoy being used in landscape.
>>> >>
>>> >> - Eric
>>> >>
>>> >
>>> >
>>> >
>>> > --
>>> > http://ericd.net
>>> > Interactive design and development
>>> > _______________________________________________
>>> >
>>> > Cocoa-dev mailing list (email@hidden)
>>> >
>>> > Please do not post admin requests or moderator comments to the list.
>>> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>> >
>>> > Help/Unsubscribe/Update your Subscription:
>>> >
>>> > This email sent to email@hidden
>>>
>>> Alex Kac - President and Founder
>>> Web Information Solutions, Inc.
>>>
>>> "The optimist proclaims that we live in the best of all possible worlds;
>>> and the pessimist fears this is true."
>>> -- James Clabell
>>>
>>>
>>>
>>>
>>>
>>
>>
>> --
>> http://ericd.net
>> Interactive design and development
>>
>>
>> *Alex Kac - **President and Founder*
>> *Web Information Solutions, Inc.*
>>
>> "Patience is the companion of wisdom."
>>
>> --Anonymous
>>
>>
>>
>>
>>
>
>
> --
> http://ericd.net
> Interactive design and development
>
--
http://ericd.net
Interactive design and development
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden