I have an iPhone app in which I am adding two arrays and displaying it in a single table. The problem is that I was not able to change the position of the detailed text label in the cell. My code snippet `
- (UITableViewCell *) TableView: (UITableView *) tableView cellForRowAtIndexPath: (NSIndexPath *) indexPath {static NSSTING * cell identifier =" cell "; UITableViewCell * cell = [tableview] dequeueReusableCellWithIdentifier: CellIdentifier]; If (cell == blue) {cell = [[[Uaitiblwugel alloc] initWithStyle: UITableViewCellStyleSubtitle reuseIdentifier: Selaidentifayr] autorelease]; UIImageView * img = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @ "cell_with_arrow.png"]]; [Cell setbackground view: img]; [IMG release]; } If (Newsrere == Neil || [Newsrera count] == 0) {} Other {NSDRIZATION * Dictatorial = [NEWJARE ObjectExtends: indexpath.ro]; Head = [dicttable objectForKey: @ "news"]; Head1 = [dicttable objectForKey: @ "name"]; NSString * subfi [[dicttable objectForKey: @ "created"]; NSLog (@ "% @", head); [[Cell ViewErrorTags: 12] Deleted ProspeaveView]; [[Cell ViewErrorTags: 13] Deleted ProspeaveView]; [[Cell ViewExchange Tag: 14] Remove ProspectView]; UIButton * shopLabel = [With Self-buttonwidth: Head and frame: CGRectMake (49, 12, 250,5)]; ShopLabel.tag = 12; //shopLabel.autoresizingMask=UIViewAutoresizingFlexibleRightMargin; [ShopLabel addTarget: Self action: @Selector (Openerstream List) Control Events: UI ControlEventTouchUpInside]; UIButton * shopLabel1 = [Self buttonwidth: Head 1 and frame: CGRactack (49, 12, 250,5)]; ShopLabel1.tag = 14; //shopLabel.autoresizingMask=UIViewAutoresizingFlexibleRightMargin; [ShopLabel1 addTarget: Self-Proceeding: Control Event for: @Selector: OpenControll EventTouchUp Inside]; Cell.detailTextLabel.frame = CGRectMake (49, 30, 150,5); If (indexPath.row & lt; [News counting counts]) {UIImage * cellImage = [UIImage imageNamed: @ "news.png"]; Cell.imageView.image = cellImage; // NSStringEncoding encoding = NSASCIIStringEncoding; Cell.imageView.frame = CGRectMake (0,04848); Cell.imageView.bounds = CGRectMake (0,04848); [Cell.imageView Set Clistsgotound: No]; NSLog (@ "% @", sub); Cell.detailTextLabel.text = Sub; Cell.detailTextLabel.backgroundColor = [UIColor clear collar]; } Else {UIImage * cellImage = [UIImage imageNamed: @ "menu_icon.png"]; Cell.imageView.image = cellImage; // NSStringEncoding encoding = NSASCIIStringEncoding; Cell.imageView.frame = CGRectMake (0,04848); Cell.imageView.bounds = CGRectMake (0,04848); [Cell.imageView Set Clistsgotound: No]; } [Cell ad sbueview: store label]; [Cell ads sbueview: store label 1]; // [cell ad sbueview: store label 2]; } Return cell; } Can anyone help me achieve this?
Create a UITableViewCell subclass, place that cell style as UITableViewCellStyleSubtitle , And override layout SUBviews in that subclass, then you can change the frame of detailTextLabel (just call the super implementation of layoutSubviews in your method Be sure to do).
Comments
Post a Comment