加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

objective-c – 如何从url中获取网页预览目标c

发布时间:2020-12-16 07:15:56 所属栏目:百科 来源:网络整理
导读:我需要设置一个这样的URL: 并显示这样的事情: 有可能得到这个吗? 解决方法 使用这个库:“URLEmbeddedView” 你可以在这里找到代码:https://github.com/szk-atmosphere/URLEmbeddedView 这个库用swift编写,但你可以在objective-c中使用. objective-c简单
我需要设置一个这样的URL:

enter image description here

并显示这样的事情:

enter image description here

有可能得到这个吗?

解决方法

使用这个库:“URLEmbeddedView”

你可以在这里找到代码:https://github.com/szk-atmosphere/URLEmbeddedView

这个库用swift编写,但你可以在objective-c中使用.

objective-c简单代码在类“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
    ]];
}

按钮来获取网址

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读