ตกลง หลังจากพยายามไม่กี่ครั้ง ในที่สุดฉันก็เติมมุมมองตารางแบบคงที่ด้วยความช่วยเหลือจาก @jrturton ( วิธีเติม UITableView แบบคงที่ )
แต่ตอนนี้ฉันมีปัญหาอื่น .. ดูเหมือนว่าในขณะที่มีการเติมฟิลด์ จะมีเพียงฟิลด์ที่มองเห็นเท่านั้นที่จะถูกเติมผ่านวิธีที่ฉันใช้ ช่องอื่นๆ ในขณะที่เติมด้วยโค้ด ยังคงว่างเปล่าเมื่อเลื่อนลง
มีบางอย่างที่ฉันขาดหายไปหรือไม่? ในขณะที่การกรอกตารางไดนามิกผ่านผู้ได้รับมอบหมายจะช่วยแก้ปัญหาที่ฉันเห็นได้อย่างแน่นอน แต่ฉันไม่ต้องการกรอกข้อความคงที่ (ป้ายกำกับ) ทั้งหมดผ่านอาร์เรย์ ฯลฯ และฉันรู้ว่าจะมี 16 แถวในตารางเสมอ
ดังนั้นใครมีข้อเสนอแนะเกี่ยวกับสิ่งที่ผิดพลาด?
นี่คือรหัส:
- (void)setDetailItem:(id)newDetailItem
{
if (_detailItem != newDetailItem) {
_detailItem = newDetailItem;
}
}
-(void)setParam:(id)newparam
{
if (_param != newparam) {
_param = newparam;
// Update the view.
[self configureView];
}
if (self.masterPopoverController != nil) {
[self.masterPopoverController dismissPopoverAnimated:YES];
}
}
- (void)configureView
{
// Update the user interface for the detail item.
if (_detailItem) {
for (int idx=0; idx<16; idx++) {
NSString *value = [NSString stringWithFormat:@"%@",[_param objectAtIndex:idx]];
[self.tableView cellForRowAtIndexPath:[NSIndexPath indexPathForRow:idx inSection:0]].detailTextLabel.text = value;
}
}
}
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
// Do any additional setup after loading the view, typically from a nib.
appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
[self configureView];
}
ฉันแก้ไขบางบรรทัดจากโค้ดก่อนหน้า และใส่โค้ดบางส่วนที่อาจช่วยให้เข้าใจได้ดีขึ้น