English 中文(简体)
囚犯 更新立即完成
原标题:animateWithDuration completes immediately

I know a ton of people have asked the same question, but none of the proposed solutions seem relevant, so I m asking again: I have the following block of code:

UIImageView *moneyHolder = [[UIImageView alloc] initWithImage:moneyImage];    
if([paymentMethod.viewed intValue] == 0){
            //CGRect targetFrame = CGRectMake(0, cell.frame.size.height/2-3, cell.frame.size.width, targetHeight);
            CGRect targetFrame = moneyHolder.frame;
            targetFrame.origin.y = cell.frame.size.height/2-3;
            NSLog(@"animating");
            [UIView animateWithDuration:2
                                  delay:0
                                options: UIViewAnimationCurveEaseOut
                             animations:^{
                                 moneyHolder.frame = targetFrame;
                             } 
                             completion:^(BOOL finished){
                                 NSLog(@"done");
                             }
            ];
        }

我要说的是,卡纳克人应当把我的钱财 frame结起来。 不幸的是,这种情况似乎立即发生,而不是持续2秒。 我可以用我的原木中的时间表来核实这一点:

2012-05-11 03:41:50.102 AgilePoet[5824:15203] animating
2012-05-11 03:41:50.116 AgilePoet[5824:15203] done

是否有任何人想到为什么会发生这种情况? 关于这一问题的所有其他问题都侧重于财产并非易事的问题,但我知道,图像调查框架是可读的。 我可以认为,这部法典是在我内部撰写的。

-tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath method. 

提前感谢!

最佳回答

引用:

frame The frame rectangle, which describes the view’s location and size in its superview’s coordinate system.

Changes to this property can be animated. However, if the transform property contains a non-identity transform, the value of the frame property is undefined and should not be modified. In that case, you can reposition the view using the center property and adjust the size using the bounds property instead.

If you, or some other code, has changed the transformation matrix for the view, changes to the frame property don t work as expected.

你们应当改变中心财产(改变观点),并约束财产(改变其规模)。 这些财产按预期处置。

问题回答

在我的案件中,用眼光载荷法进行估算。 承诺这样做。 Try on viewWillAppear

造成 immediately灭的另一个事情是, object灭的物体(我的案件中的UIImageView)是无的。





相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签