gpt4 book ai didi

ios - 如何以编程方式更改按钮的标题

转载 作者:行者123 更新时间:2023-11-28 10:14:16 26 4
gpt4 key购买 nike

<分区>

我有一个 Master-DetailView 项目,我需要通过数组更改按钮的标题,就像我在这里所做的那样:

import UIKit
import AVFoundation
import MapKit

class TemplateTestViewController: UIViewController,MKMapViewDelegate {

@IBOutlet var ProfileMapView: MKMapView!
@IBOutlet var BarOrClubLabel: UILabel!
@IBOutlet var HeaderProfileName: UILabel!
@IBOutlet var HeaderprofileImage: UIImageView!
@IBOutlet var StreetProfileLabel: UILabel!
@IBOutlet var ProfilePhoneNumberLabel: UIButton!
@IBOutlet var WorkTimeLabel: UILabel!
@IBOutlet var AgeLabel: UILabel!

override func viewDidLoad() {
super.viewDidLoad()
//Set Ups the Image Template :
HeaderprofileImage.image = UIImage(named: ProfileImages[MyIndex])
//Sets Up The BIG Name Template :
HeaderProfileName.text = ProfileNames[MyIndex]
//Sets Up The Navigation Bar Name :
navigationItem.title = ProfileNames[MyIndex]
//Sets Up Street Text :
StreetProfileLabel.text = ProfileStreets[MyIndex]
//Sets Up Bar Or Club Text :
BarOrClubLabel.text = ProfileBarOrClub[MyIndex]
//Sets Up Age Text :
AgeLabel.text = AgeText[MyIndex]

我试过了:

ProfilePhoneNumberLabel.setTitle(ProfilePhoneNumbers[MyIndex], for: UIControlState.normal)

它没有改变。

有没有办法做这样的事情?如果可以,有人可以告诉我怎么做吗?先谢谢了

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com