add
This commit is contained in:
@@ -10,6 +10,9 @@
|
||||
#import "MaskResultMinViewCell.h"
|
||||
#import "MaskResultPercentCell.h"
|
||||
#import "MaskResultShareViewCell.h"
|
||||
#import "SHareTestImageVC.h"
|
||||
#import "GiGaFileNanager.h"
|
||||
|
||||
|
||||
@interface MaskTestResultVC ()
|
||||
|
||||
@@ -30,7 +33,8 @@
|
||||
self.tableView.sectionFooterHeight = 0;
|
||||
self.tableView.estimatedSectionFooterHeight= 0;
|
||||
self.tableView.estimatedSectionHeaderHeight = 0;
|
||||
self.tableView.frame = CGRectMake(0,0, KMainW, self.view.bounds.size.height - SAFE_NAV_HEIGHT);
|
||||
//self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectMake(0, 0,self.view.frame.size.width, 30)];
|
||||
self.tableView.frame = CGRectMake(0,0,KMainW, self.view.frame.size.height);
|
||||
[self.tableView registerClass:[MaskResultPercentCell class] forCellReuseIdentifier:@"MaskResultPercentCell"];
|
||||
[self.tableView registerClass:[MaskResultMinViewCell class] forCellReuseIdentifier:@"MaskResultMinViewCell"];
|
||||
[self.tableView registerClass:[MaskResultShareViewCell class] forCellReuseIdentifier:@"MaskResultShareViewCell"];
|
||||
@@ -71,7 +75,7 @@
|
||||
if (!cell) {
|
||||
cell = [[MaskResultShareViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellID];;
|
||||
}
|
||||
|
||||
[cell.shareBtn addTarget:self action:@selector(shareBtnAciton) forControlEvents:UIControlEventTouchUpInside];
|
||||
[cell kidTitle:self.model.mask];
|
||||
|
||||
return cell;
|
||||
@@ -96,6 +100,42 @@
|
||||
|
||||
}
|
||||
|
||||
-(void)shareBtnAciton{
|
||||
|
||||
UIImage *image = [self saveLongImage:self.tableView];
|
||||
// SHareTestImageVC *imagevc = [[SHareTestImageVC alloc] init];
|
||||
// imagevc.image = image;
|
||||
//[self.navigationController pushViewController:imagevc animated:YES];
|
||||
|
||||
}
|
||||
|
||||
- (UIImage *)saveLongImage:(UITableView *)table {
|
||||
|
||||
UIImage* image = nil;
|
||||
// 下面方法,第一个参数表示区域大小。第二个参数表示是否是非透明的。如果需要显示半透明效果,需要传NO,否则传YES。第三个参数就是屏幕密度了,调整清晰度。
|
||||
|
||||
UIGraphicsBeginImageContextWithOptions(table.contentSize, YES, [UIScreen mainScreen].scale);
|
||||
|
||||
CGPoint savedContentOffset = table.contentOffset;
|
||||
CGRect savedFrame = table.frame;
|
||||
table.contentOffset = CGPointZero;
|
||||
table.frame = CGRectMake(0, 0, table.contentSize.width, table.contentSize.height);
|
||||
|
||||
[table.layer renderInContext: UIGraphicsGetCurrentContext()];
|
||||
|
||||
image = UIGraphicsGetImageFromCurrentImageContext();
|
||||
|
||||
table.contentOffset = savedContentOffset;
|
||||
|
||||
table.frame = savedFrame;
|
||||
|
||||
UIGraphicsEndImageContext();
|
||||
[[GiGaFileNanager shareInstance] saveImaeToAlBum:image];
|
||||
|
||||
return image;
|
||||
|
||||
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
[super didReceiveMemoryWarning];
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// SHareTestImageVC.h
|
||||
// GIGA
|
||||
//
|
||||
// Created by lianxiang on 2018/9/21.
|
||||
// Copyright © 2018年 com.giga.ios. All rights reserved.
|
||||
//
|
||||
|
||||
#import "GiGaBaseViewController.h"
|
||||
|
||||
@interface SHareTestImageVC : GiGaBaseViewController
|
||||
@property (nonatomic,strong) UIImage *image ;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// SHareTestImageVC.m
|
||||
// GIGA
|
||||
//
|
||||
// Created by lianxiang on 2018/9/21.
|
||||
// Copyright © 2018年 com.giga.ios. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SHareTestImageVC.h"
|
||||
|
||||
@interface SHareTestImageVC ()
|
||||
|
||||
@end
|
||||
|
||||
@implementation SHareTestImageVC
|
||||
|
||||
- (void)viewDidLoad {
|
||||
[super viewDidLoad];
|
||||
// Do any additional setup after loading the view from its nib.
|
||||
UIImageView *ima = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width,self.view.frame.size.height)];
|
||||
ima.contentMode = UIViewContentModeScaleAspectFit;
|
||||
|
||||
ima.image = self.image;
|
||||
[self.view addSubview:ima];
|
||||
|
||||
}
|
||||
|
||||
- (void)didReceiveMemoryWarning {
|
||||
[super didReceiveMemoryWarning];
|
||||
// Dispose of any resources that can be recreated.
|
||||
}
|
||||
|
||||
/*
|
||||
#pragma mark - Navigation
|
||||
|
||||
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
||||
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
|
||||
// Get the new view controller using [segue destinationViewController].
|
||||
// Pass the selected object to the new view controller.
|
||||
}
|
||||
*/
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="13142" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES">
|
||||
<dependencies>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="12042"/>
|
||||
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
|
||||
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="SHareTestImageVC">
|
||||
<connections>
|
||||
<outlet property="view" destination="i5M-Pr-FkT" id="sfx-zR-JGt"/>
|
||||
</connections>
|
||||
</placeholder>
|
||||
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
|
||||
<view clearsContextBeforeDrawing="NO" contentMode="scaleToFill" id="i5M-Pr-FkT">
|
||||
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<color key="backgroundColor" red="1" green="1" blue="1" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
|
||||
<viewLayoutGuide key="safeArea" id="Q5M-cg-NOt"/>
|
||||
</view>
|
||||
</objects>
|
||||
</document>
|
||||
Reference in New Issue
Block a user