-3

私は新しい iPhone 開発者で、Objective-C 言語の呼び出し機能について練習しています。誰かが私を助けることができますか?私のプログラムの詳細があります。ありがとうございました!

#import <UIKit/UIKit.h>

@interface TestingProgramViewController : UIViewController{
    NSTimer *aTimer;
    id getPic;
}
@end

#import "TestingProgramViewController.h"

@interface TestingProgramViewController ()
@property (weak, nonatomic) IBOutlet UIImageView *testingPic;
@end

@implementation TestingProgramViewController

- (void) obtainPic:(NSString *)picName{
    NSString *urlLink = [[NSString alloc] initWithFormat:@"http://tdcctv.data.one.gov.hk/, %@!", picName];
    NSURL *url = [NSURL URLWithString:urlLink];
    UIImage *image = [UIImage imageWithData: [NSData dataWithContentsOfURL:url]];
    self.testingPic.image = image;
}

- (void)viewDidLoad
{
    [super viewDidLoad];

    [getPic obtainPic:@"H422F2.JPG"];
}
4

1 に答える 1