This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class ViewController: UIViewController, UIScrollViewDelegate { | |
@IBOutlet var scrollView: UIScrollView! | |
let imageView = UIImageView() | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IBAction func showImg1(_ sender: Any) { | |
let image0 = UIImage(named: "Image") | |
// ここで初期化しておかないとZoomがおかしくなる | |
scrollView.zoomScale = 1 | |
imageView.image = image0 | |
imageView.frame.size = image0!.size | |
scrollView.contentSize = image0!.size | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func adjustImageFitInScrollView(){ | |
guard let img = self.imageView.image else {return} | |
let w_scale = scrollView.frame.width / img.size.width | |
let h_scale = scrollView.frame.height / img.size.height | |
let scale = min(w_scale, h_scale) | |
scrollView.minimumZoomScale = scale | |
scrollView.setZoomScale(scale, animated: true) | |
} | |
@IBAction func showImg1(_ sender: Any) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIImageOrientation srcOrientation = sourceImage.imageOrientation; | |
// 〜なんらかの作業で UIImageのresultが帰ってくる〜 | |
result = [result initWithCGImage:result.CGImage scale:1.0 orientation: srcOrientation]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension String { | |
func convertAttributedString() -> NSAttributedString?{ | |
let html = self._removePT() | |
let encoded = html.data(using: String.Encoding.utf8)! | |
let attributedOptions : [NSAttributedString.DocumentReadingOptionKey : Any] = [ | |
.documentType : NSAttributedString.DocumentType.html, | |
.characterEncoding : String.Encoding.utf8.rawValue | |
] | |
do { | |
let attributedTxt = try NSAttributedString(data: encoded, options: attributedOptions, documentAttributes: nil) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class EventBeginning{ | |
private ListenerInterface listener = null; | |
public void eventListener() { | |
if (listener != null) { | |
listener.buttonAction(); | |
} | |
} | |
public void addListener(ListenerInterface listener) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// BalloonView.swift | |
// balloonTest | |
// | |
// Created by Daiki Ito on 2017/05/27. | |
// Copyright © 2017年 EAssistant. All rights reserved. | |
// Swift3.1 Xcode 8.3.2 | |
import UIKit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// BalloonView.swift | |
// balloonTest | |
// | |
// Created by Daiki Ito on 2017/05/27. | |
// Copyright © 2017年 EAssistant. All rights reserved. | |
// | |
import UIKit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
import WebKit | |
class ViewController: UIViewController, CustomWKWebDelegate, WKNavigationDelegate, URLSessionDownloadDelegate { | |
var testWeb: CustomWKWebView! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view, typically from a nib. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CustomWKWebView.swift | |
// WebPageTest | |
// | |
// Created by Daiki Ito on 2017/04/08. | |
// Copyright © 2017年 EAssistant. All rights reserved. | |
// | |
import UIKit | |
import WebKit |