में 2 विभिन्न प्रकार के कस्टम UITableViewCells मेरे UITableView में मैं एक आरएसएस फ़ीड की पहली खबर के लिए एक कस्टम टेबल व्यूसेल (टाइप ए चलो कहना) और अन्य समाचार के लिए दूसरे, तीसरे आदि के लिए सेट करना चाहता हूं .. एक और कस्टम टेबल व्यूसेल (कोशिश करें बी) समस्या यह है कि पहली तालिका के लिए बनाई गई कस्टम तालिका व्यूसेल (trype ए) का पुन: उपयोग किया जाता है, लेकिन उत्सुकता से कस्टमव्यूसेल (प्रकार ए) के पहले उपयोग के बीच पंक्तियों की संख्या और उसी प्रकार की कस्टम व्यूसेल की दूसरी उपस्थिति है बराबर नहीं ..UITableView
मेरा सेलफॉररोएट इंडेक्सपैथ ऐसा लगता है।
- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
int feedIndex = [indexPath indexAtPosition:[indexPath length] - 1];
Feed *item = [[[[self selectedButton] category] feedsList] objectAtIndex:feedIndex + 1];
static NSString *CellIdentifier = @"Cell";
if(feedIndex == 0){
MainArticleTableViewCell *cell = (MainArticleTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[MainArticleTableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease];
[[[cell subviews] objectAtIndex:0] setTag:111];
}
cell.feed = item;
return cell;
}
else{
NewsTableViewCell *cell = (NewsTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil)
{
cell = [[[NewsTableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier orientation:currentOrientation] autorelease];
[[[cell subviews] objectAtIndex:0] setTag:111];
}
cell.feed = item;
return cell;
}
return nil;
}
दो प्रकार की कोशिकाओं में अलग-अलग ऊंचाई होती है जो सही ढंग से सेट की जाती हैं। क्या कोई मुझे सही दिशा में इंगित कर सकता है कि एक कस्टम सेल को केवल पहली खबर के लिए कैसे दिखाना है (पुन: उपयोग नहीं किया जा रहा है)? धन्यवाद
में के लिए
इसके अलावा, मैं कुछ भी की तरह कभी नहीं देखा है इस प्रश्न का स्विफ्ट संस्करण देखें [यहां] (http://stackoverflow.com/ प्रश्न/30774671/यूटेबलव्यू-एक-से-एक-कस्टम-सेल्स-स्विफ्ट के साथ) – Honey