Roei Nadam
Roei Nadam

Reputation: 1780

How to get web page preview from url Objective c

I need to set a url like this :

enter image description here

and show somethings like this :

enter image description here

is it possible to get this ?

Upvotes: 4

Views: 2418

Answers (1)

Mohamad Chami
Mohamad Chami

Reputation: 1234

use this library: "URLEmbeddedView"

you can find the code here: https://github.com/szk-atmosphere/URLEmbeddedView

this library written in swift but you can use in objective-c.

objective-c simple code is in the class "OGObjcSampleViewController"

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    self.textView.text = @"https://github.com/";

    [OGDataProvider sharedInstance].updateInterval = [NSNumber days:10];

    self.embeddedView = [[URLEmbeddedView alloc] initWithUrl:@""];
    [self.containerView addLayoutSubview:self.embeddedView andConstraints:@[
        self.embeddedView.Top,
        self.embeddedView.Right,
        self.embeddedView.Left,
        self.embeddedView.Bottom
    ]];
}

button to fetch url

- (IBAction)didTapFetchButton:(id)sender {
    [self.embeddedView loadURL:self.textView.text completion:nil];
}

Upvotes: 2

Related Questions