में लेबल प्रदर्शित करता है मेरे पास एक टेबल व्यू है और मैंने सभी विषम सेल ऊंचाई = 0 सेट की है, अजीब सेल में मेरे कुछ लेबल थे। जब यह तालिका दृश्य दिखाता है, तो अजीब सेल में लेबल भी सेल में दिखाई देता है। क्या लेबल गायब होने का कोई तरीका है? यह समस्या आईओएस 6 पी/एस: आईओएस 7 में हुई: यह सही काम करता है। मेरे पास पहले से ही विधि थी: [tableView startUpdates]; [tableView endUpdates];heightForRowAtIndexPath = 0 लेकिन यह अभी भी अपनी पंक्ति
धन्यवाद।
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
// show odd row
if (selectedRow == indexPath.row) return 78;
// hide odd row and show even row
if (indexPath.row %2 ==0){
return 88;}
else{
return 0;}
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
if (indexPath.row%2 == 0){
//user click on even row -> display the next row
selectedRow = indexPath.row+1;
[tableView beginUpdates];
[tableView endUpdates];
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
int index = indexPath.row/2;
if (indexPath.row %2 ==0){
static NSString *CellIdentifier = @"PhraseViewCell";
PhraseCellVietnamese *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
NSString *phrase = [[phrases objectAtIndex:index] objectForKey:@"vietnamese"];
NSNumber *checkFavorite = [[phrases objectAtIndex:index] objectForKey:@"favorite"];
NSNumber *phraseId =[[phrases objectAtIndex:index] objectForKey:@"_id"];
[cell SetInfo:phrase :checkFavorite.intValue :phraseId.intValue];
return cell;
}
else{
static NSString *CellIdentifier = @"PinyinViewCell";
PinYinViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
NSString *pinyin = [[phrases objectAtIndex:index] objectForKey:@"pinyin"];
NSString *chinese = [[phrases objectAtIndex:index] objectForKey:@"chinese"];
NSString *voice = [[phrases objectAtIndex:index] objectForKey:@"voice"];
[cell setInfo:pinyin :chinese :voice];
return cell;
}
}
क्या होगा यदि आप सेल की सामग्री के लिए हाँ में क्लिपिंग उप-दृश्य सेट करते हैं? – Zen
इसे कैसे सेट करें? क्षमा करें क्योंकि मैं नौसिखिया – tommy
'[cell.contentView setClipsToBounds: YES];' – Zen