小编Was*_*sim的帖子

在While循环中使用NSDate

我想在While循环中使用[NSDate date]获取当前日期.我通过这样做来实现这一点:

while (interval > 0.0) {

    NSDate *currentDate = [[NSDate alloc] init];  
    currentDate =  [NSDate date];  
    interval = (float) [newDate timeIntervalSinceDate: currentDate] / 60;  
    [currentDate release];
}
Run Code Online (Sandbox Code Playgroud)

我不知道为什么Memory泄漏表明存在大量内存泄漏.请指导我完成任务的正确方法.

cocoa-touch objective-c ios4 ios

4
推荐指数
1
解决办法
984
查看次数

UIImageView动画从左到右

我想把我UIImageView从左到右移动,反之亦然.我使用以下代码完成了一半:

[UIView setAnimationDuration:1.0];
[UIView setAnimationRepeatCount:10];
[UIView setAnimationRepeatAutoreverses:YES];

CGPoint pos = mover.center;
pos.x = 100.0f;
mover.center = pos;

[UIView commitAnimations];
Run Code Online (Sandbox Code Playgroud)

哪里moverUIImageView.我面临的问题是我无法完全从左向右移动它.上面的代码只是从右到中移动它.我想从中心向左走.有人可以指导我吗?

cocoa-touch core-animation objective-c uiimageview ios

1
推荐指数
1
解决办法
4763
查看次数