में दो अलग-अलग कस्टम सेल को कॉल करना मैंने एक कस्टम सेल फ़ीचरसेल बनाया है जिसमें पंक्ति में 5 छवियां हैं जिन्हें मुख्य दृश्य में बुलाया जाएगा, लेकिन जब मैं इसे कॉल करता हूं तो मुझे खाली पंक्ति मिलती है। तो कृपया मेरी समस्या कहां हो सकती है?एक UITableView समस्या
मैंने कस्टम सेल के बारे में गुमराह किया है और मैंने जिस तरह से नीचे दिए गए कोड में उपयोग करना है, लेकिन कुछ भी नहीं हुआ है।
यह मेरा FeatureCell.h
@interface FeatureCell : UITableViewCell{
IBOutlet UIImageView *img1;
IBOutlet UIImageView *img2;
}
@property (nonatomic, retain) UIImageView *img1;
@property (nonatomic, retain) UIImageView *img2;
@end
है यह मेरा FeatureCell.m है
@implementation FeatureCell
@synthesize img,img1,img2,img3,img4;
@end
यह मेरा दृश्य-नियंत्रक है .m
- (NSInteger) numberOfSectionsInTableView:(UITableView *)tableView{
return 2;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
if (section == 0) {
return [objectCollection count];
}
else{
return 1;
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString* cellIdentifier1 = @"FeatureCell";
FeatureCell *cell1 = (FeatureCell*)[tableView dequeueReusableCellWithIdentifier:cellIdentifier1];
if (cell1 == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:cellIdentifier1 owner:nil options:nil];
cell1 = (FeatureCell*)[nib objectAtIndex:0];
}
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1
reuseIdentifier:CellIdentifier];
}
if ([indexPath section] == 0) {
containerObject = [objectCollection objectAtIndex:indexPath.row];
[[cell textLabel] setText:containerObject.store];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
}
else{
cell1.img1.image = [UIImage imageNamed:@"shower.png"];
cell1.img2.image = [UIImage imageNamed:@"parking.png"];
}
return cell;
}
आप दुकानों से कनेक्ट किया था? – Wain
यह 2 अलग-अलग सेल प्रकारों से निपटने का सही तरीका नहीं है। मेरा उत्तर यहां देखें: http://stackoverflow.com/questions/17711452/change-uicollectionviewcell-content-and-nib-layout-based-on-data/17711644#17711644। यह संग्रह दृश्यों से संबंधित है, लेकिन यह तालिका दृश्यों के साथ समान है। – rdelmar
@Wain आउटलेट द्वारा आपका क्या मतलब है? –