अब तक, मैं अपने सेल को वांछित करने के लिए कस्टम निब्स बनाना चाहता था, लेकिन इस बार, सेल की ऊंचाई एक से दूसरे में बदल जाएगी ताकि मैं कोई नहीं बना सकूं निश्चित आकार के सेल की नीब।कस्टम सेल (प्रोग्रामेटिक रूप से) के साथ तालिका दृश्य
इसलिए मैंने इसे प्रोग्रामेटिक रूप से बनाने का निर्णय लिया ... क्या इसे हासिल करने के अच्छे तरीके से नीचे है?
// Customize the appearance of table view cells.
- (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] autorelease];
UILabel *pseudoAndDate = [[UILabel alloc] initWithFrame:CGRectMake(0.0,0.0,320.0,20.0)];
[pseudoAndDate setTag:1];
[cell addSubview:pseudoAndDate];
[pseudoAndDate release];
}
CommentRecord *thisRecord = [comments objectAtIndex:[indexPath row]];
UILabel *label = (UILabel *)[cell viewWithTag:1];
[label setText:[NSString stringWithFormat:@"%@ | %@",thisRecord.author,thisRecord.date]];
return cell;
}
या .. क्या मुझे यहां कुछ याद आ रही है? अब तक यह काम करने के लिए प्रतीत नहीं होता कारण;)
धन्यवाद,
Gotye।
ध्यान दें कि [केवल-लिंक उत्तर] (http://meta.stackoverflow.com/tags/link-only-answers/info) निराश हैं, SO उत्तर समाधान के लिए खोज का अंत बिंदु होना चाहिए (बनाम। फिर भी संदर्भों का एक और स्टॉपओवर, जो समय के साथ पुराना हो जाता है)। लिंक को संदर्भ के रूप में रखते हुए, यहां स्टैंड-अलोन सारांश जोड़ना पर विचार करें – kleopatra