uitableview - iPhone Development - UITableViewCellStyleValue2 -
Note: I am using the iPhone SDK 3.0 final version for Leopard.
I need to prepare a table list similar to the table used by the photo album application of iPhone. There are two new styles for i UITableViewCell:
-
UITableViewCellStyleValue1
-
UITableViewCellStyleValue2
I thought I could use these instead of creating a custom cell class I do, but it seems that they do not work properly. I am facing the following issues with UITableViewCellStyleValue2
:
- I am unable to show an image.
- If I do not align the value to
text labels
anddetailTextLabel
Here is the sample code:/ / Customize the appearance of table view cells - (UITableViewCell *) Table View: (UITableView *) Table View CellForOutPand : (NSIndexPath *) Index path {static NSString * CellIdentifier = @ "cell"; UITableViewCell * cell = [tableview] dequeueReusableCellWithIdentifier: CellIdentifier]; If (cell == blue) {cell = [[[UTTEWews alloc] initWithStyle: UITableViewCellStyleValue2 again: user: cell identifier] AutoExecution]; } // Configure the cell Cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; Cell.imageView.image = [UIImage imageNamed: @ "Pointy.gif"]; Cell.textLabel.text = @ "Labels"; Cell.textLabel.textColor = [UIColor redColor]; Cell.textLabel.font = [UIFont systemFontOfSize: 21]; Cell.detailTextLabel.text = @ "(10)"; Cell.detailTextLabel.textColor = [UIColor gray color]; Cell.detailTextLabel.font = [UIFont systemFontOfSize: 17]; Return cell; }
This piece of code works to show pictures with
UITableViewCellStyleDefault
andUITableViewCellStyleSubtitle
. IsUITableViewCellStyleValue2
support cell image property? I see an empty space in place of the image area (left corner of the cell) is there something wrong with me?If this does not work, how can I create a custom cell class similar to
UITableViewCellStyleValue2
style to medetailTextLabel
textLabel .
Thank you in anticipation.
Newly created style styles layout that is similar to a number of system layouts (such as cells in the address book) The set of fields with are
Your exact specific form:
- There is no image in UITableViewCellStyleValue2
- Built-in style layout logic assumes that the font metrics are those Are set. If you change them then the line will not be above
You can get a detailed description of the available options among the built-in styles created in each of these. If you do not need the UITableViewCell sub-category if any of your needs are set, add your own subviews, and take them out in the layout. How many examples are there in the apple
Comments
Post a Comment