我遵循一个教程,我不知道如何转换此代码,以使其免费运行,没有启用ARC的错误.
- (void)setHourHandImage:(CGImageRef)image
{
if (image == NULL) {
hourHand.backgroundColor = [UIColor blackColor].CGColor;
hourHand.cornerRadius = 3;
}else{
hourHand.backgroundColor = [UIColor clearColor].CGColor;
hourHand.cornerRadius = 0.0;
}
hourHand.contents = (id)image;
Run Code Online (Sandbox Code Playgroud)
给我一个错误的唯一部分是(id)图像;
也
w = CGImageGetWidth((CGImageRef)hourHand.contents);
Run Code Online (Sandbox Code Playgroud)
(CGImageRef)minHand.contents); 给了我一个错误
谢谢
例如,我想使用时间或日期时间在每次经过 1 分钟时打印“1 分钟”。我无法使用 time.sleep(60) 因为我有更多代码需要在每次更新时在 whileloop 中运行。我需要一种方法来检查 datetime.now() 是否大于 1 分钟前。谢谢!
import time
import datetime as dt
t = dt.datetime.now()
while True:
if 60 seconds has passed:
print("1 Min")
Run Code Online (Sandbox Code Playgroud)