gpt4 book ai didi

swift - 标签上的 Apple Watch 文字

转载 作者:行者123 更新时间:2023-11-28 08:42:55 25 4
gpt4 key购买 nike

当诸如“我 20 岁”之类的短语被截断为 “我...”时,我遇到了(标签)问题剩下的句子没有出现。就像那个出现在剩余句子或其他内容下方的行上。

import WatchKit
import Foundation
import WatchConnectivity

class InterfaceController: WKInterfaceController,WCSessionDelegate {

@IBOutlet var Notification: WKInterfaceLabel!
var watchNotification = "ok"
let session = WCSession.defaultSession()
//@IBOutlet var lblNotification: WKInterfaceLabel!

override func awakeWithContext(context: AnyObject?) {
super.awakeWithContext(context)

// Configure interface objects here.
}

override func willActivate() {
// This method is called when watch view controller is about to be visible to user
initSession()
super.willActivate()
}

func session(session: WCSession, didReceiveMessage message: [String : AnyObject])

{

let msg = message["NotificationSentforIphone"] as! String
Notification.setText("notificat :\(msg)")
//lblNotification.setText("Notification:\(msg)")

}
@IBAction func ActionSentNotificationforIphone()
{
let msg = ["NotificationSentforWatch" : watchNotification]

session.sendMessage(msg, replyHandler: {(replay) -> Void in }) { (error) -> Void in



}

}
override func didDeactivate() {
// This method is called when watch view controller is no longer visible
super.didDeactivate()
}

func initSession()

{

session.delegate=self

session.activateSession()



}



}

最佳答案

Lines The maximum number of lines to allow for the label text. Text that does not fit on the specified number of lines is truncated.

你所要做的就是

lblNotification.lines = 2; 

大多数情况下,0 是它需要的数量,但如果此规则适用,则此处未指定。

source

关于swift - 标签上的 Apple Watch 文字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35989160/

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