【发布时间】:2015-11-22 15:14:44
【问题描述】:
如何将它从 obj-c 转换为 swift 2?
myArray = [[NSMutableArray alloc] init];
UIImage *image;
NSUInteger nimages = 0;
for (; ; nimages++)
{
NSString *nameOfImg_ = entity.attribute;
NSString *imageName = [NSString stringWithFormat:@"name%@number%lu.jpg", nameOfImg_, (unsigned long)(nimages + 1)];
image = [UIImage imageWithContentsOfFile: [[NSBundle mainBundle] pathForResource:imageName ofType:nil]];
if (image == nil) {
break;
}
[myArray addObject:image];
}
【问题讨论】:
-
这不是免费的代码翻译服务。做一次尝试。用您尝试的 Swift 代码更新您的问题。说明您遇到了什么问题。
-
@rmaddy 没有人要求你投稿。如果您不想贡献,请保留给自己。
-
我告诉你这个网站是如何运作的。这是一个有效的贡献。
-
@rmaddy 是“障碍物”。但我们不要为此争论。