You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.6 KiB
53 lines
1.6 KiB
//
|
|
// AttachmentViewController.swift
|
|
// elpha-ios
|
|
//
|
|
// Created by Dwayne Harris on 11/1/18.
|
|
// Copyright © 2018 Elpha. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
class AttachmentViewController: UIViewController {
|
|
@IBOutlet var attachmentScrollView: UIScrollView!
|
|
@IBOutlet var attachmentImageView: UIImageView!
|
|
@IBOutlet var statusTextView: UITextView!
|
|
|
|
var attachment: AttachmentMO? = nil
|
|
|
|
@IBAction func closeTapped(_ sender: Any) {
|
|
if let controller = self.parent as? AttachmentPageViewController {
|
|
controller.dismissController()
|
|
}
|
|
}
|
|
|
|
@IBAction func shareTapped(_ sender: Any) {
|
|
if let image = attachmentImageView.image {
|
|
let controller = UIActivityViewController(activityItems: [image], applicationActivities: nil)
|
|
present(controller, animated: true)
|
|
}
|
|
}
|
|
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
|
|
if let attachment = attachment {
|
|
attachmentScrollView.delegate = self
|
|
attachmentImageView.af_setImage(withURL: attachment.url!)
|
|
|
|
if let content = attachment.status?.content {
|
|
statusTextView.attributedText = content.htmlAttributed(size: 14, centered: true, color: UIColor.white)
|
|
}
|
|
}
|
|
}
|
|
|
|
override var preferredStatusBarStyle: UIStatusBarStyle {
|
|
return .lightContent
|
|
}
|
|
}
|
|
|
|
extension AttachmentViewController: UIScrollViewDelegate {
|
|
func viewForZooming(in scrollView: UIScrollView) -> UIView? {
|
|
return attachmentImageView
|
|
}
|
|
}
|