Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>ok as i told u better u need to subclass the UITableViewCell in the following example, when selecting the cell it will add custom view to selected cell better u go through this and change it according to your requirement . Hope this helps u :)</p> <p><br /></p> <pre><code> //in subclassed cell "CustomCell.h" file @interface CustomCell : UITableViewCell { UIView *aView; //to hold ur view BOOL addView; //to check wheather to add view or not } @property(nonatomic, retain) UIView *aView; @property(nonatomic, assign) BOOL addView; @end //in "CustomCell.m" file #import "CustomCell.h" @implementation CustomCell @synthesize aView; @synthesize addView; - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { // Initialization code aView = [[UIView alloc]initWithFrame:CGRectZero]; //init the view with zero rect as if u want initially frame is zero aView.backgroundColor = [UIColor greenColor]; //to know weather it is added or not [self addSubview:aView];//added to cell } return self; } - (void)dealloc { [aView release]; [super dealloc]; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; // Configure the view for the selected state } - (void)layoutSubviews { [super layoutSubviews]; if(self.addView) //if the view is added { self.aView.frame = CGRectMake(10, 3, 100,200); } else { self.aView.frame = CGRectZero;//if there is no view } } //in your ViewController.h file @interface ViewController : UIViewController&lt;CountdownTimerDelegate&gt; @property (retain, nonatomic) IBOutlet UITableView *aTableView; @property (nonatomic, retain) NSIndexPath *selectedIndexPath; @end //in ViewController.m file #import"CustomCell" //add this to header file -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; CustomCell *cell = [self.aTableView dequeueReusableCellWithIdentifier:CellIdentifier]; if(cell == nil) { cell =[[CustomCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]; } if(self.selectedIndexPath != nil) { if(self.selectedIndexPath.row == indexPath.row) cell.addView = YES; else cell.addView = NO; } //initially set it no for all cell return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { //in did select row at indexpath self.selectedIndexPath = indexPath; [self.aTableView reloadData]; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { if(self.selectedIndexPath != nil) { if(self.selectedIndexPath.row == indexPath.row) { return 200; } return 45; } else return 45; } </code></pre> <p><br /></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload