Suddenly, the problem was solved.
What I did was simple, I just changed the function name as follows:
onReturn() -> toReverse()
I don't know the cause, but since the previous reply said the following, I tried the simplest thing to do, which is to change the name, and the problem was solved. Thank you.
"Try rewriting that code a little bit to achieve the same goal"
Post
Replies
Boosts
Views
Activity
Program including onReturn() is below.
class PhotosViewer: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
// ダウン対策
if newImageDT.count <= page || page < 0 {
page = newImageDT.count - 1
}
initImageView(image1: newImageDT[page])
if newImageDT.count - 1 > page {
let rightButton = UIBarButtonItem(title: "button_next".localized, style: UIBarButtonItem.Style.plain, target: self, action: #selector(onNext))
self.navigationItem.rightBarButtonItem = rightButton
} else {
let rightButton = UIBarButtonItem(title: "".localized, style: UIBarButtonItem.Style.plain, target: self, action: #selector(onNext))
self.navigationItem.rightBarButtonItem = rightButton
}
let leftButton = UIBarButtonItem(title: "menu_Return".localized, style: UIBarButtonItem.Style.plain, target: self, action: #selector(onReturn))
self.navigationItem.leftBarButtonItem = leftButton
self.navigationItem.title = shotDates[page]
let cDateTime = cm.datestring(targetDate: Date(), format: "yyyy-MM-dd HH:mm:ss")
let parm = "checkAt=cast(\"" + cDateTime + "\" as datetime), checkBy=\"" + accountantName + "\" WHERE id = \"" + contract.contID + "\" AND file_name = \"" + fileNames[page] + "\" AND checkBy = \"\""
// 画像確認記録を登録
let currentPage = page
db.updateImage(fileName: fileNames[currentPage], parm: parm) { [self] completion in
if completion == 0 {
dm.updateImagerecord(fileName: fileNames[currentPage], checkAt: cDateTime, checkBy: accountantName) // 内部データも更新
}
}
let pinchGesture = UIPinchGestureRecognizer()
pinchGesture.addTarget(self, action: #selector(pinchAction(_:) ) )
view.addGestureRecognizer(pinchGesture)
let rotateGesture = UIRotationGestureRecognizer()
rotateGesture.addTarget(self, action: #selector(rotateAction(_:) ) )
view.addGestureRecognizer(rotateGesture)
let panOrSwipe = UIPanGestureRecognizer(target: self, action: #selector(didPan(_:)))
view.addGestureRecognizer(panOrSwipe)
let tapGesture = UITapGestureRecognizer()
tapGesture.addTarget(self, action: #selector(tapAction(_:)))
view.addGestureRecognizer(tapGesture)
let longPressGesture = UILongPressGestureRecognizer()
longPressGesture.addTarget(self, action: #selector(longPressAction(_:)))
view.addGestureRecognizer(longPressGesture)
}
〜 〜 〜
@objc func onReturn() {
page -= 1
if page > 0 {
self.loadView()
self.viewDidLoad()
return
} else {
self.navigationController?.popViewController(animated: true)
return
}
}
〜 〜 〜
}
onReturn() is in Line 173.
This file displays images. onReturn() returns the image to the previous one, or returns to the screen it was called from if all images have been returned.
I do not know what is the FB number.