1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- //
- // AddDPXXViewController.swift
- // am
- // 需要配置 加载已有图片 上传图片 保存图片功能
- // Created by Virgil on 2016/11/14.
- // Copyright © 2016年 Virgil. All rights reserved.
- //
- import UIKit
- class AddImagesViewController: BaseViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
- var imgCount: Int = 0
- //var imgArray = NSMutableArray()
- var imgAddress = NSMutableArray()
- @IBOutlet weak var btnSave: UIButton!
- @IBOutlet weak var btnImage: UIButton!
- @IBOutlet weak var scrollView: UIScrollView!
- var shopOpen: ShopOpenEntity!
- /// 0:店铺照片 1:商户合影照
- var type = 0
- var viewTemp: Virgil_SelectedImageView!
- override func viewDidLoad() {
- super.viewDidLoad()
- initNavLeftBackButton()
- if type == 0 {
- self.title = "上传店铺照片"
- } else {
- self.title = "上传商户合影照"
- }
- }
- func initView() {
- viewTemp = Bundle.main.loadNibNamed("Virgil_SelectedImageView", owner: self, options: nil)?.last as? UIView as! Virgil_SelectedImageView
- viewTemp.frame = CGRect(x: 20, y: 35, width: self.view.frame.width - 40, height: 70)
- var images = ""
- if type == 0 {
- images = shopOpen.dpImages
- } else {
- images = shopOpen.shhyzImages
- }
- if images != "" {
- viewTemp.initView(maxCount: 9, arrDefaultImageUrs: images.split(s: ","), vc: self)
- } else {
- viewTemp.initView(maxCount: 9, arrDefaultImageUrs: nil, vc: self)
- }
- self.view.addSubview(viewTemp)
- }
- @IBAction func btnAddImageClick(_ sender: Any) {
- }
- @IBAction func btnSaveClick(_ sender: Any) {
- if viewTemp.arrImageUrls.count < 1 {
- SVProgressHUD.showError(withStatus: "请先上传照片")
- return
- }
- if type == 0 {
- shopOpen.dpImages = viewTemp.arrImageUrls.joined(separator: ",")
- } else {
- shopOpen.shhyzImages = viewTemp.arrImageUrls.joined(separator: ",")
- }
- handleBack()
- }
- override func didReceiveMemoryWarning() {
- super.didReceiveMemoryWarning()
- // Dispose of any resources that can be recreated.
- }
- override func viewWillAppear(_ animated: Bool) {
- super.viewWillAppear(animated)
- setNavBackgroud(isWhite: true)
- appDelegate.setNavigationBarHidden(isHidden: false)
- }
- override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
- super.init(nibName: "AddImagesViewController", bundle: nil)
- }
- required init?(coder aDecoder: NSCoder) {
- fatalError("init(coder:) has not been implemented")
- }
- /*
- // MARK: - Navigation
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
- // Get the new view controller using segue.destinationViewController.
- // Pass the selected object to the new view controller.
- }
- */
- }
|