मुझे क्लिक करने पर मेरी तालिका की एक पंक्ति को आकार बदलना होगा। मैं यह कैसे कर सकता हूं? कोई मेरी मदद कर सकता है?क्लिक किए जाने पर एकल सेल की ऊंचाई को कैसे बदला जाए?
मेरा विचार नियंत्रक वर्ग:
class DayViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {
@IBOutlet var daysWorkPointTable: UITableView
override func viewDidLoad() {
super.viewDidLoad()
var nipName = UINib(nibName: "daysWorkPointsCell", bundle: nil)
self.daysWorkPointTable.registerNib(nipName, forCellReuseIdentifier: "daysWorkCell")
}
func tableView(tableView: UITableView!, numberOfRowsInSection section: Int) -> Int {
return 1
}
func tableView(tableView:UITableView!, heightForRowAtIndexPath indexPath:NSIndexPath) -> CGFloat {
return 75
}
func tableView(tableView: UITableView!, cellForRowAtIndexPath indexPath: NSIndexPath!) -> UITableViewCell! {
var cell = tableView.dequeueReusableCellWithIdentifier("daysWorkCell", forIndexPath: indexPath) as daysWorkPointsCell
return cell
}
func tableView(tableView: UITableView!, didSelectRowAtIndexPath indexPath: NSIndexPath!) {
}
}
अरघ, बस पढ़ लें कि आप इसे केवल एक ही सेल पर काम करना चाहते हैं। मेरा कार्यान्वयन थोड़ा अधिक है, क्योंकि यह किसी भी कोशिका के लिए काम करता है। –
अगर मैं घोषित किया गया है तो सत्यापन में चयनित CellIndexPath कारण को मान निर्दिष्ट नहीं कर सकता, इसलिए मैंने इसे var को बदलने की कोशिश की, लेकिन त्रुटि के कारण जारी रखें क्योंकि मैं NSIndexPath को शून्य निर्दिष्ट नहीं कर सकता। क्या आप मेरी मदद कर सकते हैं? मैं क्या गलत कर रहा हूं? –
मैंने असाइनमेंट को स्वयं को स्पष्ट रूप से असाइन करने के लिए बदल दिया। चयन किया गया CellIndexPath। यह अब काम करना चाहिए, उम्मीद है;)। –