我想获取并显示电影列表。我使用这个名为OMDb API 的 API。但似乎我需要为此创建一个 API 密钥。在他们的网站上,他们解释说:
将所有数据请求发送至:
http://www.omdbapi.com/?
Run Code Online (Sandbox Code Playgroud)
海报 API 请求:
http://img.omdbapi.com/?apikey=[yourkey]&
Run Code Online (Sandbox Code Playgroud)
在这方面我有点困惑,因为我是 iOS 新手。我应该使用上述哪一种方法来获取所有数据并显示它们?如果我需要创建一个 API 密钥,我可以从他们的页面哪里获得它?
我有一个视图控制器,我在该视图控制器中保留了一个完整的图像视图.我有一些图像名称,如1.png,2.png,3.png,像6个图像.我需要的是我需要显示为每隔2秒滑动一次.一张图像应该在图像视图中.我在Objective-C中完成了它.但我是Swift的初学者,所以无法做到.这该怎么做?
@implementation ViewController {
UIImageView* imgView; // your UIImageView
}
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[[self navigationController] setNavigationBarHidden:YES animated:YES];
UIImage* img1 = [UIImage imageNamed:@"11.jpg"];
UIImage* img2 = [UIImage imageNamed:@"s2.jpg"];
imgView = [[UIImageView alloc] initWithFrame:self.view.frame]; // create a UIImageView with the same size as the view.
imgView.animationImages = @[img1, img2]; // use a nice NSArray literal to pass in your images.
imgView.animationDuration = 2.0*2.0; // 2 seconds for …Run Code Online (Sandbox Code Playgroud)