Note that there are some explanatory texts on larger screens.

plurals
  1. POmanaging exclusive list in UITableView
    primarykey
    data
    text
    <p>I have a simple UITableView. and i want to add a checkmark whenever i select a row. I have only one section in my table. could somebody plz help me with this.</p> <p>SampleTable.h</p> <pre><code>@interface SampleTable : UITableView &lt;UITableViewDelegate , UITableViewDataSource&gt; { NSMutableArray *itemArray; NSString *itemValue; } @property (nonatomic,retain) NSMutableArray *itemArray; @property (nonatomic,retain) NSString *itemValue; -(NSMutableArray *) displayItemArray; @end </code></pre> <p>SampleTable.m</p> <pre><code>#import "SampleTable.h" @implementation DropTableView @synthesize itemArray,itemValue; -(id)initWithFrame:(CGRect)frm { if(self=[super initWithFrame:frm]) { [self displayItemArray]; self.delegate=self; self.dataSource=self; self.separatorStyle=UITableViewCellSeparatorStyleNone; } return self; } -(NSMutableArray *) displayItemArray { if(itemArray==nil) { itemArray=[[NSMutableArray alloc] initWithObjects:@"1",@"2",@"3",@"4",@"5",@"6",@"7",nil]; } return itemArray; } #pragma mark Table view methods - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return [self.itemArray count]; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell= [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell==nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier]; [cell autorelease]; } [self flashScrollIndicators]; self.scrollEnabled=YES; [self showsVerticalScrollIndicator]; cell.textLabel.text = [self.itemArray objectAtIndex:indexPath.row]; return cell; } - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { //stuff } -(void) dealloc { [itemValue release]; [itemArray release]; [super dealloc]; } @end </code></pre>
    singulars
    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