我有自定义UIView类,其中已经定义了我的所有插座,我需要从字典中的信息更改文本。请不要这样帮助。
/ *这就是我希望改变UILABEL文本的UIVIEW类。 * /
import UIKit
var alertAnimator : ReferAnimatorAlert = ReferAnimatorAlert()
class ReferAnimatorAlert : UIView
{
var detailArray : Array<NSMutableDictionary>!
@IBOutlet var alertView : UIView!
@IBOutlet var cellView1 : UIView!
@IBOutlet var cellView2 : UIView!
@IBOutlet var itemImage1 : UIImageView!
@IBOutlet var itemImage2 : UIImageView!
@IBOutlet var profileImage1 : UIImageView!
@IBOutlet var profileImage2 : UIImageView!
@IBOutlet weak var usernameLabel1 : UILabel!
@IBOutlet weak var usernameLabel2 : UILabel!
@IBOutlet var descriptionLabel1 : UILabel!
@IBOutlet var descriptionLabel2 : UILabel!
@IBOutlet var separatorView1 : UIView!
@IBOutlet var separatorView2 : UIView!
@IBOutlet var dismissOutlet : UIButton!
//MARK : - IBActions Declaration
@IBAction func dismissAction(sender : UIButton)
{
}
func setDetails()
{
for aDictionary in detailArray
{
if aDictionary["isHas"] as! Bool == true
{
usernameLabel2.text = aDictionary["Name"] as? String
descriptionLabel2.text = aDictionary["description"] as? String
}
else
{
//usernameLabel1.text = aDictionary["Name"] as? String
self.usernameLabel1.text = "This is a test."
//descriptionLabel1.text = aDictionary["description"] as? String
}
}
Animator.animateAlertCells(cellView1, cellView2: cellView2, alertView: alertView, dismissOutlet: dismissOutlet)
}
//这就是我如何从另一个VIEWCONTROLLER传递数据。
var predicate : NSPredicate = NSPredicate(format: "isHighlighted == %@", true)
var resultDictionary = responseArray.filter(){predicate.evaluateWithObject($0)}
println(resultDictionary)
alertAnimator.detailArray = resultDictionary
overlayView.hidden = false
alertAnimator.setDetails()
程序在'usernameX.text =“Blah Blah”'
中断