Navigation bar的注意事项详解

  @objc private func rightButtonClicked(_ sender: AnyObject) {

  navigationController?.navigationBar.isTranslucent = !navigationController!.navigationBar.isTranslucent

  updateLabelContent()

  }

  private func updateLabelContent() {

  title = navigationController!.navigationBar.isTranslucent ? "Translecent" : "Opaque"

  let frameLabelOrigin = frameLabel.frame.origin

  frameLabel.text = "Frame label. x = (frameLabelOrigin.x), y = (frameLabelOrigin.y)"

  let constraintLabelOrigin = constraintLabel.frame.origin

  constraintLabel.text = "Constraint label. x = (constraintLabelOrigin.x), y = (constraintLabelOrigin.y)"

  print("(title)")

  print("Status bar frame:", UIApplication.shared.statusBarFrame) // (0.0, 0.0, 375.0, 20.0)

  print("Navigation bar frame:", navigationController!.navigationBar.frame) // (0.0, 20.0, 375.0, 44.0)

  }

您可能感兴趣的文章:

相关文章