Skip to content

Commit

Permalink
Merge pull request #1 from dupengw3/master
Browse files Browse the repository at this point in the history
合并源项目
  • Loading branch information
AonoCandal authored Aug 3, 2020
2 parents cb20047 + 4438bb8 commit e98406e
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions ios/Classes/BarcodeScannerViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class BarcodeScannerViewController: UIViewController {
"flash_on" : "Flash on",
"flash_off" : "Flash off",
"hand_input" : "Hand input",

"type" : "0",
]
$0.useCamera = -1 // Default camera
$0.autoEnableFlash = false
Expand Down Expand Up @@ -81,6 +81,9 @@ class BarcodeScannerViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()

let type = (config.strings["type"] == "0" ? 0 : 1)


self.navigationController!.navigationBar.isTranslucent = true
self.navigationController!.navigationBar.setBackgroundImage(UIImage(), for: .default)
self.navigationController!.navigationBar.clipsToBounds = true
Expand All @@ -105,20 +108,20 @@ class BarcodeScannerViewController: UIViewController {
)
}

let btn = UIButton.init(frame: CGRect.init(x: 0, y: 0, width: 150, height: 44))
btn.setTitle("添加/查询母开关", for: .normal)
let btn = UIButton.init(frame: CGRect.init(x: 0, y: 0, width:type == 0 ? 150 : 90, height: 44))
btn.setTitle(type == 0 ?"添加/查询母开关" : "扫一扫", for: .normal)
btn.titleLabel?.textColor = .white
btn.setImage(UIImage.init(named: "backArrow") ?? UIImage(), for: .normal)
btn.addTarget(self, action: #selector(cancel), for: .touchUpInside)
navigationItem.leftBarButtonItem = UIBarButtonItem.init(customView: btn)//UIBarButtonItem(title: config.strings["cancel"],
// style: .plain,
// target: self,
// action: #selector(cancel)
// )

view.addSubview(handInputBtn)
navigationItem.leftBarButtonItem = UIBarButtonItem.init(customView: btn)
view.addSubview(torchBtn)

if type == 0{
view.addSubview(handInputBtn)
}else{
torchBtn.frame = CGRect.init(x: 0, y: UIScreen.main.bounds.height - 80 - safeAreaEdgeInset().bottom, width: UIScreen.main.bounds.width, height: 80);
}

updateToggleFlashButton()
}

Expand Down

0 comments on commit e98406e

Please sign in to comment.