小编Umi*_*imi的帖子

如何在导航栏上使用图像徽标而不是标题

我尝试了几个不同的代码,但无法显示徽标

import UIKit 
class HomeViewController: UIViewController { 

override func viewDidLoad() { 
super.viewDidLoad() 

let logo = UIImage(named: "logo.png") 
let imageView = UIImageView(image: logo) 
self.navigationItem.titleView = imageView
navigationItem.titleView?.sizeToFit() 
 } 
}
Run Code Online (Sandbox Code Playgroud)

我甚至试图在课堂上包括IB本身也不起作用,它似乎没有那样工作

@IBOutlet weak var navBar: UINavigationItem!
Run Code Online (Sandbox Code Playgroud)

PS.我的徽标是200x40px png,其资产名称为logo.png.

我的故事板

http://i68.tinypic.com/b68t8o.png

任何帮助表示赞赏

编辑:我通过在那里放置图像视图而不是整个导航项目故事来解决我的问题.谢谢你的建议.

xcode storyboard ios swift swift3

4
推荐指数
1
解决办法
8490
查看次数

如何使用 Terraform 公开具有公共 IP 地址的 Azure Kubernetes 集群

我无法使用公共 IP 地址公开部署在 AKS 上的 k8s 集群。我正在使用 GitHub Actions 进行部署。以下是我的 .tf 和 deployment.yml 文件;

请参阅下面我面临的错误。

主文件

provider "azurerm" {
  features {}
}

provider "azuread" {
  version = "=0.7.0"
}

terraform {
  backend "azurerm" {
    resource_group_name  = "tstate-rg"
    storage_account_name = "tstateidentity11223"
    container_name       = "tstate"
    access_key           = "/qSJCUo..."
    key                  = "terraform.tfstate"
  }
}

# create resource group
resource "azurerm_resource_group" "aks" {
  name     = "${var.name_prefix}-rg"
  location = var.location
  }
}
Run Code Online (Sandbox Code Playgroud)

aks-cluster.tf

resource "azurerm_kubernetes_cluster" "aks" {
  name                = "${var.name_prefix}-aks"
  location            = var.location
  resource_group_name = …
Run Code Online (Sandbox Code Playgroud)

load-balancing kubernetes terraform-provider-azure azure-aks nginx-ingress

3
推荐指数
1
解决办法
2171
查看次数

在 swift 中将 url 参数添加到每个 url 的末尾

我使用下面的代码在 webview 中显示我的网站,并在 url 末尾添加了 ?app=ios 参数。但现在我想在网站的所有url中添加这个参数。我需要在加载每个页面之前将其附加到某处。请指导我完成这个,因为我是 swift 的新手。谢谢

import UIKit
import WebKit

class ViewController: UIViewController, WKNavigationDelegate, WKUIDelegate {

@IBOutlet var container: UIView!

var webView: WKWebView!

override func viewDidLoad() {
    super.viewDidLoad()

    webView = WKWebView()
    container.addSubview(webView)

    self.webView.navigationDelegate = self
    self.webView.uiDelegate = self
 }

    let urlStr = "https://www.website.com/?app=ios"
    let url = NSURL(string: urlStr)!
    let req = NSURLRequest(url: url as URL)

    webView.load(req as URLRequest)
Run Code Online (Sandbox Code Playgroud)

应用程序代理

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

var window: UIWindow?


func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: …
Run Code Online (Sandbox Code Playgroud)

uiwebview url-parameters ios swift

2
推荐指数
1
解决办法
6936
查看次数