Important: You must register a class or nib file using the registerNib:forCellReuseIdentifier: or registerClass:forCellReuseIdentifier: method before calling this method.
Thursday, April 4, 2013
dequeueReusableCellWithIdentifier:forIndexPath:
Important: You must register a class or nib file using the registerNib:forCellReuseIdentifier: or registerClass:forCellReuseIdentifier: method before calling this method.
Friday, February 24, 2012
Igy kapjuk meg egy UITableView egyik cellajat
Tuesday, July 12, 2011
nev-ertek megjelenitese UITableViewCell-ben
Az egyik dolog, hogy mivel a detailTextLabel-be esetleg tobb sornyi szoveg is kerulhet amit nem akarok trunc-olni ezert a cella magassagat be kell allitani (nem allitja magatol a device) valahogy igy:
- (CGFloat)tableView:(UITableView *)tableView_ heightForRowAtIndexPath:(NSIndexPath *)indexPath {
CGFloat kMinCellHeight = 44.0;
NSString *text = ZXGetPropertyValueForRow([indexPath row]);
CGSize textSize = CGSizeMake(tableView_.frame.size.width - 120.0, FLT_MAX);
CGSize size = [text sizeWithFont:[UIFont systemFontOfSize:15.0f] constrainedToSize:textSize lineBreakMode:UILineBreakModeWordWrap];
size.height += 25.0f;
return MAX(size.height, kMinCellHeight);
}
Ahhoz persze, hogy tobb soros legyen a detailTextLabel meg be kellett allitani a numberOfLines-t 0-ra.
Egy masik problema volt, hogy a textLabel-be pont nem fert bele amit bele akartam irni. Eloszor azzal probalkoztam, hogy textLabel-en beallitom a betumeretet a setFont-tal ([[cell textLabel] setFont:[UIFont fontWithName:@"Helvetica-Bold" size:12]];), de nem akartam azokat megvaltoztatni amik a default font-tal is elfernenek.
Egy masik megoldas, hogy textLabel-re is beallitjuk a numberOfLines-t mondjuk 0-ra, de mivel a textLabel es a detailTextLabel betumerete nem ugyanakkora ezert ha mindketto 2 soros akkor a masodik soruk el van csuszva egymastol ami eleg benan nez ki.
Vegul azt valasztottam (ami nem tul hosszu szovegeknel mukodik), hogy a numberOfLines-t hagytam a default 1-en (ez fontos!) es beallitottam a minimumFontSize-ot (ami a textLabel-nel kb 12) 10-re. Igy ami elozoleg pont nem fert bele azt meg beleferthet es nem is lesz tul csunya. Ehhez be kell allitani az adjustFontSizeToFitWidth-et is true-ra.
[[cell textLabel] setAdjustsFontSizeToFitWidth:true];
[[cell textLabel] setMinimumFontSize:10.0];
Tuesday, January 25, 2011
Csak az egyik cella ne legyen kijelolve touch-nal
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];Friday, September 10, 2010
Async kep betoltes UITableViewCell-be
Thursday, April 1, 2010
copy + paste > 2 release ugyanazon > EXC_BAD_ACCESS
Monday, January 4, 2010
UITableViewCell mozgatasa
Thursday, October 29, 2009
Cell Styles
UITableViewCellStyleDefaultA simple style for a cell with a text label (black and left-aligned) and an optional image view. Note that this is the default style for cells prior to iPhone OS 3.0.
Available in iPhone OS 3.0 and later.
Declared in
UITableViewCell.h.UITableViewCellStyleValue1A style for a cell with a label on the left side of the cell with left-aligned and black text; on the right side is a label that has smaller blue text and is right-aligned. The Settings application uses cells in this style.
Available in iPhone OS 3.0 and later.
Declared in
UITableViewCell.h.UITableViewCellStyleValue2A style for a cell with a label on the left side of the cell with text that is right-aligned and blue; on the right side of the cell is another label with smaller text that is left-aligned and black. The Phone/Contacts application uses cells in this style.
Available in iPhone OS 3.0 and later.
Declared in
UITableViewCell.h.UITableViewCellStyleSubtitleA style for a cell with a left-aligned label across the top and a left-aligned label below it in smaller gray text. The iPod application uses cells in this style.
Available in iPhone OS 3.0 and later.
Declared in
UITableViewCell.h.
Discussion
In all these cell styles, the larger of the text labels is accessed via the textLabel property and the smaller via the detailTextLabel property.
Thursday, September 3, 2009
UITableViewCell beszurasa UITableView-ba
[self.tableView insertRowsAtIndexPaths:myObject withRowAnimation:UITableViewRowAnimationFade];
[self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0] atScrollPosition:UITableViewScrollPositionTop animated:YES];
Wednesday, August 12, 2009
thumbnail betoltese UITableViewCell-be
IBOutlet UIImageView *image;
...
@property (nonatomic, retain) IBOutlet UIImageView *image;
NSString *filePath = ...;
[[cell image] setImage:[[UIImage alloc] initWithContentsOfFile:filePath]];