-2

在 Objective CI 中使用此代码将图像缩放到我的背景。我怎样才能在 Swift 中实现这一点。

path = [[NSBundle mainBundle] pathForResource:@"This" ofType:@"png"];
image = [[UIImage alloc] initWithContentsOfFile:path];
4

1 回答 1

2

你可以试试这个:

path = NSBundle.mainBundle().pathForResource("This", ofType: "png")
image = UIImage(contentsOfFile: path)
于 2015-09-25T14:54:19.903 回答