Ignore my parallel issue with loading views - they are not affecting this.

I've now made a simple project which exhibits this animation issue.

I create a view based ipad app
Add a toolbar to the top
and add two buttons to the main view: "Animate" and "Nothing"
The button that comes with the toolbar pops up a popover
The popover contains a single button, "Animate", and some space.
Both "Animate" buttons are connected to a method of the main view controller 
(see below).
When I touch the "Animate" in the main view, both the touched Animate button 
and the Nothing button are animated.
When I touch the "Animate" in the popover, only the touched Animate button is 
animated, not the Nothing button.

Question is: Why doesn't the Nothing button animate in all calls to the method?

- (IBAction) animateStuff: (id) sender
{
    UIButton *b = (UIButton*)sender; // either one of the Animate buttons
    
    [ UIView animateWithDuration: 0.25 
                           delay: 0.01
                         options: UIViewAnimationOptionCurveEaseIn
                      animations: ^{
                          // move the "Animate" button
                          CGRect r = b.frame;
                          r.origin.x = r.origin.x + 10;
                          r.origin.y = r.origin.y +  5;
                          b.frame = r;
                          
                          // resize the "Nothing" button
                          r = self.nothingButton.frame;
                          if( r.size.width == 400 )
                          {
                              r.size.width  = 100;
                              r.size.height = 100;
                          }
                          else
                          {
                              r.size.width  = 400;
                              r.size.height = 400;
                          }
                          self.nothingButton.frame = r;
                      }
                      completion: nil
     ];
}

Full project available on request (33Kb zip)

On 04/05/2011, at 01:53 , David Duncan wrote:

> On May 3, 2011, at 3:40 AM, Brian Bruinewoud wrote:
> 
>> Hi All,
>> 
>> self.view.alpha is animated but nothing at all happens to drawingVC.view.
> 
> 
> My guess would be that 'drawingVC.view' isn't actually in a window anywhere.
> 
> Given your current and previous question however, I would posit that you are 
> mis-using UIViewControllers and possibly causing various other issues for 
> yourself (that said, I don't know why you get the results you do in your 
> other question).
> 
> I would highly recommend that you read the View Controller Programming Guide, 
> especially the section on view controller containment (spoiler alert: what 
> you are doing is not supported). If you want to be able to load arbitrary 
> views from nibs to add to a view managed by a view controller, the 
> recommendation is to use an NSObject subclass to own the view and UINib to 
> load the nib.
> --
> David Duncan
> 

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to