前幾天PM 提出一個需求,需求是A頁面點擊 Button A 會跳轉到 B 頁面, 而 B頁面有一個 Button B 點擊後會重新推出一個新的 A頁面。 所以依照這需求邏輯,當用戶不停的反覆 butoon A -> button B ,ViewController 會無限疊上去。 雖然最後了解這問題是故意設計的,不用處理,但是我還是稍微測試一下。
####測試
方案一、
{ | |
"timeZone": "Asia/Hong_Kong", | |
"dependencies": { | |
}, | |
"webapp": { | |
"access": "ANYONE_ANONYMOUS", | |
"executeAs": "USER_DEPLOYING" | |
}, | |
"exceptionLogging": "STACKDRIVER", | |
"oauthScopes": ["https://www.googleapis.com/auth/script.send_mail", "https://www.googleapis.com/auth/script.external_request", "https://www.googleapis.com/auth/script.scriptapp", "https://www.googleapis.com/auth/spreadsheets", "https://www.googleapis.com/auth/userinfo.email"], |
override func draw(_ rect: CGRect) { | |
borderColor.setStroke() | |
borderColor.withAlphaComponent(backgroundOpacity).setFill() | |
let backgroundPath = UIBezierPath(roundedRect: bounds, cornerRadius: borderCornerRadius) | |
backgroundPath.fill() | |
let borderPath: UIBezierPath | |
let borderRect = bounds.insetBy(dx: borderWidth / 2, dy: borderWidth / 2) | |
if borderCornerSize == 0 { | |
borderPath = UIBezierPath(roundedRect: borderRect, cornerRadius: borderCornerRadius) | |
} else { |
func deviceExifOrientationForBackCamera(_ deviceOrientation: UIDeviceOrientation = UIDevice.current.orientation) -> CGImagePropertyOrientation{ | |
switch deviceOrientation { | |
case .portrait: | |
return .right | |
case .landscapeLeft: | |
return .up | |
case .landscapeRight: | |
return .down | |
default: | |
return .right |
// | |
// ViewController.swift | |
// Created by Woody on 2021/1/28. | |
/* | |
a simple example for removing the superimposed ViewController behind | |
*/ | |
import UIKit |
import Foundation | |
let input = """ | |
3 | |
4 | |
4 2 1 3 | |
2 | |
1 2 | |
7 |
import Foundation | |
//let input = """ | |
//4 | |
//2 3 CJ?CC? | |
//4 2 CJCJ | |
//1 3 C?J | |
//2 5 ??J??? |
//: [Previous](@previous) | |
import Foundation | |
let input = """ | |
7 | |
4 6 | |
2 1 | |
7 12 | |
7 2 |
import Foundation | |
let input = """ | |
3 | |
4 | |
4 2 1 3 | |
2 | |
1 2 | |
7 | |
7 6 5 4 3 2 1 |