Commit da6b7ae2 authored by lujunye's avatar lujunye

sadfsafdsafsadfsdfafd

parent b5bd873f
...@@ -206,7 +206,9 @@ class NewCKVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,CKNo ...@@ -206,7 +206,9 @@ class NewCKVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,CKNo
print("页面加载完成...") print("页面加载完成...")
webView.takeScreenshotOfFullContent { (img) in webView.takeScreenshotOfFullContent { (img) in
let imgV = UIImageView(frame: CGRect(x: 0, y: 0, width: 230, height: 230*0.75))
self.view.addSubview(imgV)
imgV.image = img
let command = TscCommand() let command = TscCommand()
command.addSize(40, 30) command.addSize(40, 30)
...@@ -223,14 +225,15 @@ class NewCKVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,CKNo ...@@ -223,14 +225,15 @@ class NewCKVc: BaseViewController,UITableViewDelegate,UITableViewDataSource,CKNo
} }
} }
@IBAction func ck_action(_ sender: UIButton) { @IBAction func ck_action(_ sender: UIButton) {
let urlStr = "https://c.gelifood.com/market/src/views/Order/codeDetail.html?order_id=12767" let urlStr = "http://z.gelifood.com/static/url/label.html?goods_name=破军碎星锤魔女斗篷反甲&spec_str=住宅就拉萨京东破军碎星锤魔女斗篷反甲方开始了大舅父&batch_sn=12312312313123&batch_id=444"
// let urlStr = "https://www.baidu.com"
let urlString = urlStr.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)! let urlString = urlStr.addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)!
let url = URL(string: urlString) let url = URL(string: urlString)
let request = URLRequest.init(url: url!, cachePolicy: .reloadRevalidatingCacheData, timeoutInterval: 10) let request = URLRequest.init(url: url!, cachePolicy: .reloadRevalidatingCacheData, timeoutInterval: 10)
wkWebView.navigationDelegate = self wkWebView.navigationDelegate = self
wkWebView.load(request) wkWebView.load(request)
wkWebView.bounds = CGRect(x: 0, y: 0, width: 230, height: 230*0.75)
return return
if isGm { if isGm {
...@@ -756,7 +759,7 @@ extension WKWebView { ...@@ -756,7 +759,7 @@ extension WKWebView {
public func takeScreenshotOfFullContent(_ completion: @escaping ((UIImage?) -> Void)) { public func takeScreenshotOfFullContent(_ completion: @escaping ((UIImage?) -> Void)) {
self.scrollView.setContentOffset(CGPoint(x: 0, y: 0), animated: false) self.scrollView.setContentOffset(CGPoint(x: 0, y: 0), animated: false)
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.3) { DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 0.3) {
let renderer = WebViewPrintPageRenderer.init(formatter: self.viewPrintFormatter(), contentSize: self.scrollView.contentSize) let renderer = WebViewPrintPageRenderer.init(formatter: self.viewPrintFormatter(), contentSize: CGSize(width: 230, height: 230*0.75))
let image = renderer.printContentToImage() let image = renderer.printContentToImage()
completion(image) completion(image)
} }
......
...@@ -118,25 +118,25 @@ ...@@ -118,25 +118,25 @@
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{ {
[Manager stopScan];
[Manager closePeripheral: _selectArray.firstObject]; [Manager closePeripheral: _selectArray.firstObject];
[self.selectArray removeAllObjects]; [self.selectArray removeAllObjects];
if (indexPath.section == 1) { if (indexPath.section == 1) {
CBPeripheral *peripheral = [self.dicts objectForKey:[self.dicts allKeys][indexPath.row]]; CBPeripheral *peripheral = [self.dicts objectForKey:[self.dicts allKeys][indexPath.row]];
[self connectDevice:peripheral]; [self connectDevice:peripheral];
}else{ }else{
[SVProgressHUD showErrorWithStatus:@"断开连接"]; [SVProgressHUD showErrorWithStatus:@"断开连接"];
[self startScane];
} }
[_tableView reloadData]; [_tableView reloadData];
} }
-(void)connectDevice:(CBPeripheral *)peripheral { -(void)connectDevice:(CBPeripheral *)peripheral {
[Manager connectPeripheral:peripheral options:nil timeout:2 connectBlack:^(ConnectState state) { [Manager connectPeripheral:peripheral options:nil timeout:2 connectBlack:^(ConnectState state) {
if (state == 3) { if (state == 3) {
if ([_selectArray count] == 0) { if ([_selectArray count] == 0) {
[self.selectArray addObject:peripheral]; [self.selectArray addObject:peripheral];
[_tableView reloadData]; [_tableView reloadData];
} }
[SVProgressHUD showSuccessWithStatus:@"连接成功"]; [SVProgressHUD showSuccessWithStatus:@"连接成功"];
...@@ -145,6 +145,7 @@ ...@@ -145,6 +145,7 @@
[SVProgressHUD showErrorWithStatus:@"连接失败"]; [SVProgressHUD showErrorWithStatus:@"连接失败"];
} }
[self startScane];
}]; }];
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment