Skip to content

Commit

Permalink
relamをcachesにpdfをtmpに
Browse files Browse the repository at this point in the history
  • Loading branch information
Toshiki Ikda committed Aug 9, 2016
1 parent e33b0ab commit 6d18c45
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 10 deletions.
4 changes: 2 additions & 2 deletions DB/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
</navigationItem>
</items>
</navigationBar>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="3D3B0033-980F-4325-AEC7-BD8E6FFBC506" translatesAutoresizingMaskIntoConstraints="NO" id="ltv-RK-fmw">
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" image="1480E8D1-5EA3-4ED4-9F66-76C13089E9C7" translatesAutoresizingMaskIntoConstraints="NO" id="ltv-RK-fmw">
<rect key="frame" x="317" y="491" width="25" height="36"/>
</imageView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="zOo-rN-wYP">
Expand Down Expand Up @@ -1828,7 +1828,7 @@ Copyright(c) Future University Hakodate. All Rights Reserved.
</scene>
</scenes>
<resources>
<image name="3D3B0033-980F-4325-AEC7-BD8E6FFBC506" width="25" height="25">
<image name="1480E8D1-5EA3-4ED4-9F66-76C13089E9C7" width="25" height="25">
<mutableData key="keyedArchiveRepresentation">
YnBsaXN0MDDUAQIDBAUGOjtYJHZlcnNpb25YJG9iamVjdHNZJGFyY2hpdmVyVCR0b3ASAAGGoK0HCBEW
GxwgISgrLjQ3VSRudWxs1AkKCwwNDg8QViRjbGFzc1xOU0ltYWdlRmxhZ3NWTlNSZXBzV05TQ29sb3KA
Expand Down
1 change: 1 addition & 0 deletions DB/DB.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class DB {

func getRealmPath() -> String {
let documentPath = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.CachesDirectory , NSSearchPathDomainMask.UserDomainMask, true)[0]
//let documentPath = NSTemporaryDirectory();
return documentPath.stringByAppendingString(DBName)
}

Expand Down
19 changes: 15 additions & 4 deletions DB/PrintPreviewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ class PrintPreviewController: UIViewController {
@IBOutlet weak var navigation: UINavigationBar!
// @IBOutlet weak var scroll: UIScrollView!
let image = UIImage(named: "omote.jpg")
let filename : NSString = "ki-ko"
let arrayPaths = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)
var myData = NSData()
let filename : String = "ki-ko"
//let arrayPaths = NSSearchPathForDirectoriesInDomains(.DocumentDirectory, .UserDomainMask, true)
var arrayPaths = NSObject()

var myData = NSData()
override func viewDidLoad() {
super.viewDidLoad()

Expand Down Expand Up @@ -50,9 +51,13 @@ class PrintPreviewController: UIViewController {
back.image=appDelegate.view_pic
front.image=image

let path = arrayPaths[0] as NSString
//let path = arrayPaths[0] as NSString


let path = NSTemporaryDirectory();
let fullname : NSString = (filename as String) + ".pdf"
let pdfFilename = (path as String) + "/"+(fullname as String)
arrayPaths = pdfFilename

// PDFコンテキストを作成する
UIGraphicsBeginPDFContextToFile(pdfFilename, CGRectZero, nil)
Expand Down Expand Up @@ -106,6 +111,12 @@ class PrintPreviewController: UIViewController {
}

@IBAction func back(sender: AnyObject) {
let manager = NSFileManager()
do {
try manager.removeItemAtPath(arrayPaths as! String)
} catch let error as NSError {
print(error.localizedDescription)
}
self.presentingViewController?.presentingViewController?.dismissViewControllerAnimated(true, completion: nil)
}
}
Binary file modified DB/omote.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions キーコ紀行.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
8F7AC35E1C13386400C51E9F /* PhotoSelectViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8F7AC35D1C13386400C51E9F /* PhotoSelectViewController.swift */; };
8F7AC36E1C17DC0300C51E9F /* noimage.png in Resources */ = {isa = PBXBuildFile; fileRef = 8F7AC36D1C17DC0300C51E9F /* noimage.png */; };
8FA413CF1C0F9441003BAD1B /* CreateViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8FA413CE1C0F9441003BAD1B /* CreateViewController.swift */; };
8FB9DBEC1D5749B400DAC5F0 /* omote.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 8FB9DBEB1D5749B400DAC5F0 /* omote.jpg */; };
8FB33B441D5A061F00911C74 /* omote.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 8FB33B431D5A061F00911C74 /* omote.jpg */; };
9C4D92311C141CF8009A5659 /* photoViewer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9C4D92301C141CF8009A5659 /* photoViewer.swift */; };
9C4D92331C14623A009A5659 /* edit_tips.png in Resources */ = {isa = PBXBuildFile; fileRef = 9C4D92321C14623A009A5659 /* edit_tips.png */; };
9C4D92431C1A4DFC009A5659 /* s_title.png in Resources */ = {isa = PBXBuildFile; fileRef = 9C4D92421C1A4DFC009A5659 /* s_title.png */; };
Expand Down Expand Up @@ -148,7 +148,7 @@
8F7AC35D1C13386400C51E9F /* PhotoSelectViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = PhotoSelectViewController.swift; sourceTree = "<group>"; };
8F7AC36D1C17DC0300C51E9F /* noimage.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = noimage.png; sourceTree = "<group>"; };
8FA413CE1C0F9441003BAD1B /* CreateViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CreateViewController.swift; sourceTree = "<group>"; };
8FB9DBEB1D5749B400DAC5F0 /* omote.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = omote.jpg; sourceTree = "<group>"; };
8FB33B431D5A061F00911C74 /* omote.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = omote.jpg; sourceTree = "<group>"; };
9C4D92301C141CF8009A5659 /* photoViewer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = photoViewer.swift; sourceTree = "<group>"; };
9C4D92321C14623A009A5659 /* edit_tips.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = edit_tips.png; sourceTree = "<group>"; };
9C4D92421C1A4DFC009A5659 /* s_title.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = s_title.png; sourceTree = "<group>"; };
Expand Down Expand Up @@ -267,7 +267,7 @@
DC23C00A1BD7826B000B2465 /* DB */ = {
isa = PBXGroup;
children = (
8FB9DBEB1D5749B400DAC5F0 /* omote.jpg */,
8FB33B431D5A061F00911C74 /* omote.jpg */,
8F7AC36D1C17DC0300C51E9F /* noimage.png */,
DC08FCD91C158D09002252F2 /* fa3.png */,
DC08FCC51C1585C4002252F2 /* tablebackground.png */,
Expand Down Expand Up @@ -441,7 +441,7 @@
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8FB9DBEC1D5749B400DAC5F0 /* omote.jpg in Resources */,
8FB33B441D5A061F00911C74 /* omote.jpg in Resources */,
DC08FCDA1C158D09002252F2 /* fa3.png in Resources */,
DC08FCE81C1A5FE5002252F2 /* cardData.realm in Resources */,
DC08FCC71C1585C4002252F2 /* tablebackground.png in Resources */,
Expand Down

0 comments on commit 6d18c45

Please sign in to comment.