Skip to content
This repository has been archived by the owner on Mar 22, 2020. It is now read-only.

Commit

Permalink
加入分享为二维码的功能(生成二维码)
Browse files Browse the repository at this point in the history
  • Loading branch information
kagurazakayashi committed Jun 21, 2015
1 parent ed0b14b commit e4aaa33
Show file tree
Hide file tree
Showing 23 changed files with 4,836 additions and 5 deletions.
85 changes: 85 additions & 0 deletions CloudEmoticon2iOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,19 @@
53E9DF8419C189E600C61121 /* WaitView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53E9DF8319C189E600C61121 /* WaitView.swift */; };
53ED64C519A48A74008CE9BD /* NotificationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53ED64C419A48A74008CE9BD /* NotificationView.swift */; };
53F157211AFFAE6B0027D578 /* SkinManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53F157201AFFAE6B0027D578 /* SkinManager.swift */; };
53F3F8801B36B46500C5C111 /* QRActivity.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53F3F87F1B36B46500C5C111 /* QRActivity.swift */; };
53F3F8961B36C41E00C5C111 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 53F3F8951B36C41E00C5C111 /* CoreGraphics.framework */; };
53F3F8981B36C43100C5C111 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 53F3F8971B36C43100C5C111 /* UIKit.framework */; };
53F3F89A1B36C52F00C5C111 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 53F3F8991B36C52F00C5C111 /* Foundation.framework */; };
53F3F89D1B36C71100C5C111 /* QRCodeGenerator.m in Sources */ = {isa = PBXBuildFile; fileRef = 53F3F89C1B36C71100C5C111 /* QRCodeGenerator.m */; };
53F3F8B61B36CD3900C5C111 /* bitstream.c in Sources */ = {isa = PBXBuildFile; fileRef = 53F3F8A81B36CD3900C5C111 /* bitstream.c */; };
53F3F8B71B36CD3900C5C111 /* mask.c in Sources */ = {isa = PBXBuildFile; fileRef = 53F3F8AA1B36CD3900C5C111 /* mask.c */; };
53F3F8B81B36CD3900C5C111 /* qrencode.c in Sources */ = {isa = PBXBuildFile; fileRef = 53F3F8AC1B36CD3900C5C111 /* qrencode.c */; };
53F3F8B91B36CD3900C5C111 /* qrinput.c in Sources */ = {isa = PBXBuildFile; fileRef = 53F3F8AE1B36CD3900C5C111 /* qrinput.c */; };
53F3F8BA1B36CD3900C5C111 /* qrspec.c in Sources */ = {isa = PBXBuildFile; fileRef = 53F3F8B01B36CD3900C5C111 /* qrspec.c */; };
53F3F8BB1B36CD3900C5C111 /* rscode.c in Sources */ = {isa = PBXBuildFile; fileRef = 53F3F8B21B36CD3900C5C111 /* rscode.c */; };
53F3F8BC1B36CD3900C5C111 /* split.c in Sources */ = {isa = PBXBuildFile; fileRef = 53F3F8B41B36CD3900C5C111 /* split.c */; };
53F3F8BE1B36D0E200C5C111 /* QRView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 53F3F8BD1B36D0E200C5C111 /* QRView.swift */; };
624A111C19BB108D00B4C48E /* SkinTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 624A111B19BB108D00B4C48E /* SkinTableViewController.swift */; };
8B1418091AF49A1000C278B9 /* MD5.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8B1418081AF49A1000C278B9 /* MD5.swift */; };
8B26E81F196E685900355F3B /* idea-vector.png in Resources */ = {isa = PBXBuildFile; fileRef = 8B26E81D196E685900355F3B /* idea-vector.png */; };
Expand Down Expand Up @@ -329,6 +342,27 @@
53E9DF8319C189E600C61121 /* WaitView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WaitView.swift; sourceTree = "<group>"; };
53ED64C419A48A74008CE9BD /* NotificationView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NotificationView.swift; sourceTree = "<group>"; };
53F157201AFFAE6B0027D578 /* SkinManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SkinManager.swift; sourceTree = "<group>"; };
53F3F87F1B36B46500C5C111 /* QRActivity.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = QRActivity.swift; path = CloudEmoticon2iOS/QRActivity.swift; sourceTree = "<group>"; };
53F3F8951B36C41E00C5C111 /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; };
53F3F8971B36C43100C5C111 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; };
53F3F8991B36C52F00C5C111 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
53F3F89B1B36C71100C5C111 /* QRCodeGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QRCodeGenerator.h; path = CloudEmoticon2iOS/QRCodeGenerator.h; sourceTree = "<group>"; };
53F3F89C1B36C71100C5C111 /* QRCodeGenerator.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = QRCodeGenerator.m; path = CloudEmoticon2iOS/QRCodeGenerator.m; sourceTree = "<group>"; };
53F3F8A81B36CD3900C5C111 /* bitstream.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bitstream.c; sourceTree = "<group>"; };
53F3F8A91B36CD3900C5C111 /* bitstream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bitstream.h; sourceTree = "<group>"; };
53F3F8AA1B36CD3900C5C111 /* mask.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = mask.c; sourceTree = "<group>"; };
53F3F8AB1B36CD3900C5C111 /* mask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mask.h; sourceTree = "<group>"; };
53F3F8AC1B36CD3900C5C111 /* qrencode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = qrencode.c; sourceTree = "<group>"; };
53F3F8AD1B36CD3900C5C111 /* qrencode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = qrencode.h; sourceTree = "<group>"; };
53F3F8AE1B36CD3900C5C111 /* qrinput.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = qrinput.c; sourceTree = "<group>"; };
53F3F8AF1B36CD3900C5C111 /* qrinput.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = qrinput.h; sourceTree = "<group>"; };
53F3F8B01B36CD3900C5C111 /* qrspec.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = qrspec.c; sourceTree = "<group>"; };
53F3F8B11B36CD3900C5C111 /* qrspec.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = qrspec.h; sourceTree = "<group>"; };
53F3F8B21B36CD3900C5C111 /* rscode.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rscode.c; sourceTree = "<group>"; };
53F3F8B31B36CD3900C5C111 /* rscode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rscode.h; sourceTree = "<group>"; };
53F3F8B41B36CD3900C5C111 /* split.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = split.c; sourceTree = "<group>"; };
53F3F8B51B36CD3900C5C111 /* split.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = split.h; sourceTree = "<group>"; };
53F3F8BD1B36D0E200C5C111 /* QRView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = QRView.swift; path = CloudEmoticon2iOS/QRView.swift; sourceTree = "<group>"; };
624A111B19BB108D00B4C48E /* SkinTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SkinTableViewController.swift; sourceTree = "<group>"; };
8B1418081AF49A1000C278B9 /* MD5.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MD5.swift; sourceTree = "<group>"; };
8B26E81D196E685900355F3B /* idea-vector.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "idea-vector.png"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -399,6 +433,9 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
53F3F89A1B36C52F00C5C111 /* Foundation.framework in Frameworks */,
53F3F8981B36C43100C5C111 /* UIKit.framework in Frameworks */,
53F3F8961B36C41E00C5C111 /* CoreGraphics.framework in Frameworks */,
8B9F603F1B33E7B8008DA1BD /* Accounts.framework in Frameworks */,
8B9F60401B33E7B8008DA1BD /* AudioToolbox.framework in Frameworks */,
8B9F60411B33E7B8008DA1BD /* CFNetwork.framework in Frameworks */,
Expand Down Expand Up @@ -587,6 +624,19 @@
name = "自定义状态栏";
sourceTree = "<group>";
};
53A1A3D71B36AF770076CDD9 /* 分享和二维码 */ = {
isa = PBXGroup;
children = (
53F3F8A71B36CD2D00C5C111 /* libqrencode */,
53F3F89B1B36C71100C5C111 /* QRCodeGenerator.h */,
53F3F89C1B36C71100C5C111 /* QRCodeGenerator.m */,
53F3F87F1B36B46500C5C111 /* QRActivity.swift */,
53F3F8BD1B36D0E200C5C111 /* QRView.swift */,
);
name = "分享和二维码";
path = ..;
sourceTree = "<group>";
};
53A796EE1AE2784C00755592 /* 不参与编译 */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -692,6 +742,7 @@
5346D9361993389600CEFA4B /* CloudEmoticon2iOS.entitlements */,
53E1EB1B19A4976F002EB6A3 /* 自定表情 */,
53906A991999CAD0000020D1 /* 核心 */,
53A1A3D71B36AF770076CDD9 /* 分享和二维码 */,
53906A981999CA7E000020D1 /* 云颜文字 */,
53C515991B2BF91400FFDD11 /* 用户登录 */,
5357733A199B0864003FF9D3 /* 源管理 */,
Expand Down Expand Up @@ -750,6 +801,27 @@
name = "自定表情";
sourceTree = "<group>";
};
53F3F8A71B36CD2D00C5C111 /* libqrencode */ = {
isa = PBXGroup;
children = (
53F3F8A81B36CD3900C5C111 /* bitstream.c */,
53F3F8A91B36CD3900C5C111 /* bitstream.h */,
53F3F8AA1B36CD3900C5C111 /* mask.c */,
53F3F8AB1B36CD3900C5C111 /* mask.h */,
53F3F8AC1B36CD3900C5C111 /* qrencode.c */,
53F3F8AD1B36CD3900C5C111 /* qrencode.h */,
53F3F8AE1B36CD3900C5C111 /* qrinput.c */,
53F3F8AF1B36CD3900C5C111 /* qrinput.h */,
53F3F8B01B36CD3900C5C111 /* qrspec.c */,
53F3F8B11B36CD3900C5C111 /* qrspec.h */,
53F3F8B21B36CD3900C5C111 /* rscode.c */,
53F3F8B31B36CD3900C5C111 /* rscode.h */,
53F3F8B41B36CD3900C5C111 /* split.c */,
53F3F8B51B36CD3900C5C111 /* split.h */,
);
name = libqrencode;
sourceTree = "<group>";
};
8B98EE9A196D2DC0000D255E /* images */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -807,6 +879,9 @@
8BF8ACF3199335D7001207FC /* Frameworks */ = {
isa = PBXGroup;
children = (
53F3F8991B36C52F00C5C111 /* Foundation.framework */,
53F3F8971B36C43100C5C111 /* UIKit.framework */,
53F3F8951B36C41E00C5C111 /* CoreGraphics.framework */,
8B9F60341B33E7B8008DA1BD /* Accounts.framework */,
8B9F60351B33E7B8008DA1BD /* AudioToolbox.framework */,
8B9F60361B33E7B8008DA1BD /* CFNetwork.framework */,
Expand Down Expand Up @@ -1162,13 +1237,17 @@
53117E601AE3579B0076CC08 /* SkinInstaller.swift in Sources */,
53E0E4B11994854C00C9D9FC /* PubFunc.swift in Sources */,
8BA6684719ACDBC70080C47F /* ExtensionViewController.swift in Sources */,
53F3F8B81B36CD3900C5C111 /* qrencode.c in Sources */,
535E970A1B10587F00266163 /* FileDirectory.swift in Sources */,
53995A571991E8B1008B12E0 /* JSONReader.swift in Sources */,
5389F5951AEB85FF009A1552 /* ResetSetting.swift in Sources */,
53F3F8B61B36CD3900C5C111 /* bitstream.c in Sources */,
535E97131B10587F00266163 /* zip.c in Sources */,
53B6EEEB1AF6338400ACAA6A /* EnterView.swift in Sources */,
53F3F8B71B36CD3900C5C111 /* mask.c in Sources */,
8BA6684919ACDCB40080C47F /* SettingViewController.swift in Sources */,
8BA6684019ACCD390080C47F /* AboutViewController.swift in Sources */,
53F3F8801B36B46500C5C111 /* QRActivity.swift in Sources */,
5355FCBD1990C21C00D70CA4 /* FileManager.swift in Sources */,
8BA6684219ACD3F80080C47F /* AddonTableViewController.swift in Sources */,
8BA6683E19ACCD2B0080C47F /* ColorViewController.swift in Sources */,
Expand All @@ -1181,11 +1260,14 @@
53F157211AFFAE6B0027D578 /* SkinManager.swift in Sources */,
535E97141B10587F00266163 /* SSZipArchive.m in Sources */,
53DF28F3196B9CF40058AA42 /* AppDelegate.swift in Sources */,
53F3F8BE1B36D0E200C5C111 /* QRView.swift in Sources */,
5355FCBB1990C20700D70CA4 /* NetworkDownload.swift in Sources */,
535E970C1B10587F00266163 /* FileList.swift in Sources */,
53F3F8BA1B36CD3900C5C111 /* qrspec.c in Sources */,
53E9DF8419C189E600C61121 /* WaitView.swift in Sources */,
5389C6CF1B19A52A002811DC /* INIReader.swift in Sources */,
53ED64C519A48A74008CE9BD /* NotificationView.swift in Sources */,
53F3F89D1B36C71100C5C111 /* QRCodeGenerator.m in Sources */,
535E971A1B10622600266163 /* YashiZip.swift in Sources */,
5346D9321993186500CEFA4B /* XMLReader.swift in Sources */,
533E537B19B861E700DFD2CB /* Language.swift in Sources */,
Expand All @@ -1200,14 +1282,17 @@
53117E661AE370890076CC08 /* YashiNetworkDownload.swift in Sources */,
539405D419A58F3000CE90F2 /* CETableViewCell.swift in Sources */,
53AB497B1AE239A90090D955 /* ArrayString.swift in Sources */,
53F3F8BC1B36CD3900C5C111 /* split.c in Sources */,
53577339199B085D003FF9D3 /* SourceTableViewController.swift in Sources */,
5346D93519931C9200CEFA4B /* SwitchCoder.swift in Sources */,
535E970F1B10587F00266163 /* FileZip.swift in Sources */,
53F3F8B91B36CD3900C5C111 /* qrinput.c in Sources */,
8B5ED96819B8CCD8004A1800 /* EmokbViewController.swift in Sources */,
53995A4F1991C2A4008B12E0 /* MainTBViewController.swift in Sources */,
53E1EB1A19A49769002EB6A3 /* MyEmoticonViewController.swift in Sources */,
535E970E1B10587F00266163 /* FileSave.swift in Sources */,
535E97121B10587F00266163 /* unzip.c in Sources */,
53F3F8BB1B36CD3900C5C111 /* rscode.c in Sources */,
5346D9301993181C00CEFA4B /* XMLDictionary.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
<key>IDESourceControlProjectIdentifier</key>
<string>270F49D8-2546-471C-BECA-AC0F8289B12A</string>
<key>IDESourceControlProjectName</key>
<string>CloudEmoticon2iOS</string>
<string>project</string>
<key>IDESourceControlProjectOriginsDictionary</key>
<dict>
<key>B286D462F13F08B6F79FE367145C9A00DF281073</key>
<string>https://github.com/cxchope/CloudEmoticon2iOS.git</string>
</dict>
<key>IDESourceControlProjectPath</key>
<string>CloudEmoticon2iOS.xcodeproj</string>
<string>CloudEmoticon2iOS.xcodeproj/project.xcworkspace</string>
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
<dict>
<key>B286D462F13F08B6F79FE367145C9A00DF281073</key>
Expand Down
Binary file not shown.
22 changes: 20 additions & 2 deletions CloudEmoticon2iOS/CEViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import UIKit


class CEViewController: UIViewController, UIGestureRecognizerDelegate, UITableViewDelegate, UIScrollViewDelegate, SourceTableViewControllerDelegate, CETableViewCellDelegate, UITableViewDataSource, UISearchBarDelegate, UISearchDisplayDelegate {
class CEViewController: UIViewController, UIGestureRecognizerDelegate, UITableViewDelegate, UIScrollViewDelegate, SourceTableViewControllerDelegate, CETableViewCellDelegate, UITableViewDataSource, UISearchBarDelegate, UISearchDisplayDelegate, QRViewDelegate {


@IBOutlet weak var sortBtn: UIBarButtonItem!
Expand All @@ -34,6 +34,7 @@ class CEViewController: UIViewController, UIGestureRecognizerDelegate, UITableVi
var 调整搜索栏位置:Bool = true
var 当前源:NSString = NSString()
var 当前源文字框:UILabel = UILabel()
var 二维码缓存:UIImage = UIImage()

// var userimg:UIImageView = UIImageView(image:UIImage(contentsOfFile:NSBundle.mainBundle().pathForResource("nowuserimg", ofType: "jpg")!))

Expand Down Expand Up @@ -1013,11 +1014,28 @@ class CEViewController: UIViewController, UIGestureRecognizerDelegate, UITableVi
}
NSNotificationCenter.defaultCenter().postNotificationName("显示自动关闭的提示框通知", object: 提示文字!)
} else { //分享 颜文字
let 分享视图:UIActivityViewController = UIActivityViewController(activityItems: [颜文字], applicationActivities: nil)
var 二维码分享按钮入:[AnyObject]? = nil
if (颜文字.length <= 64) {
let 二维码分享按钮:QRActivity = QRActivity()
二维码分享按钮.代理 = self
二维码缓存 = QRCodeGenerator.qrImageForString(颜文字 as String, imageSize: 200.0)
二维码分享按钮.设置二维码图片(二维码缓存)
二维码分享按钮入 = [二维码分享按钮]
}
let 分享视图:UIActivityViewController = UIActivityViewController(activityItems: [颜文字], applicationActivities: 二维码分享按钮入)
分享视图.modalTransitionStyle = UIModalTransitionStyle.CoverVertical;
分享视图.excludedActivityTypes = [UIActivityTypeCopyToPasteboard];
self.presentViewController(分享视图, animated: true, completion: nil)
}
}

func 显示二维码() {
//QRViewDelegate
let 二维码视图:QRView = QRView()
二维码视图.显示二维码(二维码缓存)
self.view.addSubview(二维码视图)
}

func 单元格代理:是否可以接收手势() -> Bool
{
if (isCanAutoHideSortView()) {
Expand Down
5 changes: 4 additions & 1 deletion CloudEmoticon2iOS/CloudEmoticon2iOS-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@

#import "XMLDictionary.h"
#import "SSZipArchive.h"
#import <CommonCrypto/CommonDigest.h>
#import <CommonCrypto/CommonDigest.h>
#import "QRCodeGenerator.h"
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
51 changes: 51 additions & 0 deletions CloudEmoticon2iOS/QRActivity.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
//
// QRActivity.swift
//
//
// Created by 神楽坂雅詩 on 15/6/21.
//
//

import UIKit

protocol QRViewDelegate:NSObjectProtocol{
func 显示二维码()
}

class QRActivity: UIActivity {
var 二维码图片:UIImage? = nil
var 代理:QRViewDelegate?

override func activityType() -> String? {
return "ceqrcode"
}
override func activityTitle() -> String? {
return lang.uage("二维码")
}
override func activityImage() -> UIImage? {
return 二维码图片
// return 调整图片大小(二维码图片!,目标尺寸: CGSizeMake(64, 64))
}
override func canPerformWithActivityItems(activityItems: [AnyObject]) -> Bool {
return true
}
override func prepareWithActivityItems(activityItems: [AnyObject]) {

}
override func activityViewController() -> UIViewController? {
return nil
}
override func performActivity() {
代理?.显示二维码()
}
func 调整图片大小(源图片:UIImage,目标尺寸:CGSize) -> UIImage {
UIGraphicsBeginImageContext(CGSizeMake(目标尺寸.width, 目标尺寸.height))
源图片.drawInRect(CGRectMake(0, 0, 目标尺寸.width, 目标尺寸.height))
let 调整后图片:UIImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
return 调整后图片
}
func 设置二维码图片(二维码图:UIImage) {
二维码图片 = 调整图片大小(二维码图,目标尺寸: CGSizeMake(64, 64))
}
}
Loading

0 comments on commit e4aaa33

Please sign in to comment.