2017-09-27 24 views
7

नए आईओएस 11 अपडेट के बाद से, मेरे पास एक ऐप है जो सिम्युलेटर और डिवाइस पर खाली टेबलव्यू पंक्तियां दिखाएगा। यहां तक ​​कि पंक्ति विभाजक भी ऐसी पंक्तियों के लिए नहीं दिखाए जाएंगे जो वहां होने वाले हैं। यदि मैं सिम्युलेटर को पुराने आईओएस संस्करण में बदलता हूं, तो पंक्तियां ठीक दिखाई देंगी। कोड या स्टोरीबोर्ड में कोई बदलाव नहीं।एक्सकोड 9 - आईओएस 11 यूआईटीबल व्यू पंक्तियां खाली हैं

पंक्तियों में अभी भी डेटा है, जिसका अर्थ है कि मैं रिक्त पंक्तियों में से एक पर टैप कर सकता हूं और यह कोड निष्पादित करेगा और उस जानकारी को शामिल करेगा जिसमें मैं उम्मीद कर रहा था।

ऐसा प्रतीत होता है कि मेरे पास अन्य दृश्य हैं जहां टेबलव्यू दृश्य पर रखा गया है और मैं निर्मित टेक्स्ट लेबल वर्क जुर्माना का उपयोग नहीं करता हूं। बिल्ट इन टेक्स्ट लेबल का उपयोग करके बस इस टेबलव्यू क्लास।

यहाँ tableview वर्ग के लिए मेरी कोड

@interface BunkPickTableViewController() 

@end 

@implementation BunkPickTableViewController 

@synthesize appDelegate, delegate, bunkPassedValue; 

- (void)viewDidLoad { 

    [super viewDidLoad]; 

    UIView *backgroundView = [[UIView alloc] initWithFrame:self.view.bounds]; 

    appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; 

    CAGradientLayer *bgLayer = [BackgroundLayer tanGradient]; 
    bgLayer.frame = self.view.bounds; 
    [self.view.layer insertSublayer:bgLayer atIndex:0]; 

    self.tableView.backgroundView = backgroundView; 

    [self.navigationController.navigationBar setTintColor:[UIColor blackColor]]; 

    self.title = @"Bunk Codes"; 

} 

- (void)viewWillAppear:(BOOL)animated { 

    [super viewWillAppear:animated]; 

    [[self navigationController] setNavigationBarHidden:NO animated:NO]; 

    [self.tableView reloadData]; 

} 

- (void)didReceiveMemoryWarning { 
    [super didReceiveMemoryWarning]; 
} 

#pragma mark - Table view data source 

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 
    return 1; 
} 

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 
    return [appDelegate.bunkArray count]; 
} 

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 

    static NSString *CellIdentifier = @"Cell"; 

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 

    if (cell == nil) { 

     cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; 

     cell.textLabel.textAlignment = NSTextAlignmentCenter; 

     cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; 

     cell.backgroundColor = [UIColor clearColor]; 

    } 

    Bunk *bunkObj = [appDelegate.bunkArray objectAtIndex:indexPath.row]; 

    cell.textLabel.text = bunkObj.bunkId; 

    return cell; 

} 

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 

    [tableView cellForRowAtIndexPath:indexPath].accessoryType = UITableViewCellAccessoryCheckmark; 

    [self.tableView deselectRowAtIndexPath:indexPath animated:YES]; 

    Bunk *bunkObj = [appDelegate.bunkArray objectAtIndex:indexPath.row]; 

    [delegate dismissBunkPop:bunkObj.bunkId]; 

    [self.navigationController popViewControllerAnimated:YES]; 

} 

@end 

TableView Settings Image

+0

जब आप कोड के माध्यम से कदम उठाते हैं, तो 'cell.textLabel.text' सही मान प्राप्त करता है? – Koen

+0

यह करता है, और मैंने तोड़ दिया है और जांच की है कि पंक्तियों की सही संख्या सही जानकारी प्राप्त कर रही है। सब अच्छा लग रहा है। – Kryckter

+1

मुझे ऐसी परियोजना पर एक समान समस्या है जो पूरी तरह से ios10 पर काम करती है (सभी कक्ष अब खाली हैं। केवल समूह शीर्षक सामान्य हैं)। मैं इसे देख रहा हूँ – ZDidier

उत्तर

3

मैं .. आईओएस 11 खाली कोशिकाओं दिखा के साथ भी इस मुद्दे था, लेकिन आईओएस 10 में ठीक किया गया है ...। मेरा मुद्दा यह था कि मैं एक ढाल का उपयोग कर रहा था जो किसी भी कारण से सेल पाठ को दिखाए जाने से रोकता था। ढाल को हटाने से खाली कोशिकाओं को हल किया गया।

+0

यह वास्तव में प्रश्न का उत्तर नहीं देता है। यदि आपके पास कोई अलग प्रश्न है, तो आप [प्रश्न पूछें] (https://stackoverflow.com/questions/ask) पर क्लिक करके पूछ सकते हैं। एक बार आपके पास पर्याप्त [प्रतिष्ठा] (https://stackoverflow.com/help/) हो जाने पर आप इस प्रश्न पर अधिक ध्यान आकर्षित करने के लिए [एक बक्षीस] (https://stackoverflow.com/help/privileges/set-bounties) भी जोड़ सकते हैं। क्या-प्रतिष्ठा)। - [समीक्षा से] (/ समीक्षा/कम गुणवत्ता वाली पोस्ट/17595014) –

3

ऐसा शायद इसलिए है क्योंकि आपका tableViewbgLayer के अंतर्गत आता है।

समस्या self.view.layer insertSublayer:bgLayer atIndex:0 में प्रतीत होती है। मैं इंडेक्स 0 पर insertSubview का उपयोग कर रहा था और मुझे एक ही समस्या थी। यह शायद आईओएस 11 में एक बग है - यदि आपकी तालिका दृश्य स्टोरीबोर्ड में परिभाषित किया गया है, तो यह हमेशा वापस धकेल जाता है।

के अंदर bgLayer डालने का सबसे अच्छा समाधान है।

नोट: आप भी इसे viewDidAppear में bgLayer पर sendSubviewToBack फोन करके हल कर सकते थे, लेकिन unfortunetaly, tableview कोशिकाओं हर tableview reloaddata पर वापस करने के लिए आगे बढ़ रहे हैं, तो यह एक अच्छा समाधान नहीं है।

+0

अच्छी तरह से किया गया। धन्यवाद: मैंने अपनी पृष्ठभूमि हटा दी है [self.tableView insertSubview: पृष्ठभूमि देखें इंडेक्स: 0]; और यह उम्मीद के रूप में काम कर रहा है – ZDidier

0
CAGradientLayer *gradient = [CAGradientLayer layer]; 
gradient.frame = self.tableView.bounds; 
gradient.colors = @[(id)[UIColor blackColor].CGColor, (id)[UIColor 
        grayColor].CGColor, (id)[UIColor 
        lightGrayColor].CGColor]; 

UIView *bgView = [[UIView alloc] 
          initWithFrame:self.tableView.bounds]; 
[self setBackgroundView:bgView]; 
[bgView.layer insertSublayer:gradient atIndex:0]; 

[self.tableView setBackgroundView:bgView]; 

tableview की पृष्ठभूमि दृश्य के लिए ढाल परत की स्थापना मेरे लिए समस्या हल हो। आईओएस 10 तक हम सीधे तालिका दृश्य में sublayer डाल सकते हैं लेकिन आईओएस 11 परत में केवल UITableVIew के पृष्ठभूमि दृश्य में डाला जाना चाहिए।

0

उपर्युक्त टेबलव्यू सबव्यूज़ मैनिपुलेशन के साथ मिलकर, यह समस्या तब भी हो सकती है जब आपकी परियोजना पूर्व एक्सकोड 9 मौजूद थी और फिर आपने अपने स्टोरीबोर्ड पर सुरक्षित क्षेत्र लेआउट मार्गदर्शिका का उपयोग किया। इसे अनचेक करने का प्रयास करें और देखें कि यह काम करता है या नहीं।

संबंधित मुद्दे