मैं एक दृश्य में दो तालिकाओं दो अलग सरणियों से आबादी प्रदर्शित करने के लिए निम्नलिखित कोड है:दो टेबल तेज
@IBOutlet var RFTable: UITableView
func tableView(tableView: UITableView!, didSelectRowAtIndexPath indexPath: NSIndexPath!) {
}
override func viewDidLoad() {
super.viewDidLoad()
self.RFTable.registerClass(UITableViewCell.self, forCellReuseIdentifier: "cell")
}
func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int {
return self.RFArray.count;
}
func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! {
var cell:UITableViewCell = self.RFTable.dequeueReusableCellWithIdentifier("cell") as UITableViewCell
cell.textLabel.text = String(self.RFArray[indexPath.row])
return cell
}
@IBOutlet var IMProdTable: UITableView
func tableView2(IMProdTable: UITableView!, didSelectRowAtIndexPath indexPath: NSIndexPath!) {
}
override func viewDidLoad() {
super.viewDidLoad()
self.IMProdTable.registerClass(UITableViewCell.self, forCellReuseIdentifier: "cell2")
}
func tableView2(IMProdTable: UITableView!, numberOfRowsInSection section: Int) -> Int {
return self.IMProdArray.count;
}
func tableView2(IMProdTable: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! {
var cell2:UITableViewCell = self.IMProdTable.dequeueReusableCellWithIdentifier("cell2") as UITableViewCell
cell2.textLabel.text = String(self.IMProdArray[indexPath.row])
return cell2
}
मैं पहली बार तालिका काम कर रहे है, और उसके बाद की नकल की और पाठ चिपकाया, सरणी नामों और तालिकादृश्य नामों को प्रतिस्थापित करना, और प्रतिनिधि और डेटास्रोत को जोड़ दिया है। हालांकि एक्सकोड दूसरे (चिपकाए गए) कोड पर 'viewdidload का अमान्य पुनर्विक्रय' प्रदर्शित करता है। यदि मैं इसे ऐप बिल्ड को देखने के बजाय 'फंड लोड व्यू() {' में बदल देता हूं। जब मैं इसका परीक्षण करता हूं, हालांकि, दोनों सारणी बिल्कुल उसी डेटा को देखते हैं जो 'RFArray' में डेटा है। मैं कोडिंग के लिए बहुत नया हूं और देख नहीं सकता कि मैंने क्या किया है, कृपया मदद करें।
आपको बहुत धन्यवाद, यह सही समझ में आया, स्पष्टीकरण के लिए धन्यवाद। पहली बार काम किया – samp17