동적 프로토 타입 셀이있는 tableviewcontroller를 만들었습니다. 이보기 내에서 사용자는 버튼 누르기로 위치 리뷰를 입력 할 수 있으며 UI 슬라이더로 위치를 1에서 10까지 평가할 수 있습니다. 리뷰는 tableviewcontroller 내에서 UIAlertController로 수행되지만 UISlider는 셀 자체 내에 있습니다. 두 tableviewcontroller 내의 핵심 데이터를 저장하려고합니다. 그러나 UISlider 등급 값은 tableviewcontroller에서 사용할 수 없습니다. 셀에서 tableview로 참조하는 방법이 있습니까? 아니면 두 개의 별도 저장 함수가 있어야합니까? 여기까지는 내 코드 중 일부가 있습니다 - Tableview 컨트롤러 내에서 프로토 타입 셀의 UISLider 값에 할당 된 변수를 인식하지 못합니다. 어떤 도움을 주셔서 미리 감사드립니다! 내 tableviewcell에서CoreData를 UITableViewController에 저장하지만 UISlider 데이터는 Prototype 셀에만 있습니다. CoreData에 저장하려면 어떻게해야합니까?
: 저장 내 tableviewcontroller에서
class WineryInfoTableViewCell: UITableViewCell {
@IBOutlet weak var ratingLabel: UILabel!
@IBOutlet weak var sliderbutton: UISlider!
@IBAction func sliderValueChanged(sender: UISlider) {
var ratingValue = Float(sender.value)
var roundedRatingValue = roundf(ratingValue/0.5)*0.5
ratingLabel.text = "\(roundedRatingValue)"
}
@IBAction의 FUNC() {
if let managedObjectContext = (UIApplication.sharedApplication().delegate as AppDelegate).managedObjectContext {
myRatingData = NSEntityDescription.insertNewObjectForEntityForName("WineryReview", inManagedObjectContext: managedObjectContext) as wineryReview
myRatingData.wineryName = wineryNames
//myRatingData.rating = ratingLabel.text how do I call this for saving?
myRatingData.review = myRatingEntry
var e:NSError?
if managedObjectContext.save(&e) != true {
println("insert error: \(e!.localizedDescription)")
return
}
}
// If all fields are correctly filled in, extract the field value
println("Winery: " + myRatingData.wineryName)
println("Review: " + myRatingData.review)
//println("Rating: " + ratingLabel.text!) how do I call this for saving?
}