Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to apply check marks on a table view cell
    primarykey
    data
    text
    <p>I'm developing an iOS application, using Xcode 4.6 to code in Objective-C. I want to know how to put on a selected table view cell a check mark, and then to access to those cells already marked to reuse them, for example saving them in an array. Here is my table view class code so you can see: </p> <pre><code>#import "TablaMateriasViewController2.h" @interface TablaMateriasViewController2 () @end @implementation TablaMateriasViewController2 @synthesize materias,materiasKeys; NSMutableArray *Materias; - (id)initWithStyle:(UITableViewStyle)style { self = [super initWithStyle:style]; if (self) { // Custom initialization } return self; } - (void)viewDidLoad { [super viewDidLoad]; Materias = [[NSMutableArray alloc]init ]; Materia *mat = [[Materia alloc]init]; [mat setNombre:@"Matematicas I"]; [mat setCodigo:@"FBTMI01"]; [mat setGradoDificultad:3]; [mat setDescripcion:@"..."]; [Materias addObject:mat]; mat = [[Materia alloc]init]; [mat setNombre:@"Matematicas II"]; [mat setCodigo:@"FBTMI02"]; [mat setGradoDificultad:4]; [mat setDescripcion:@"......"]; [Materias addObject:mat]; mat = [[Materia alloc]init]; [mat setNombre:@"Fisica I"]; [mat setCodigo:@"FBTFI01"]; [mat setGradoDificultad:2]; [mat setDescripcion:@".."]; [Materias addObject:mat]; mat = [[Materia alloc]init]; [mat setNombre:@"Fisica II"]; [mat setCodigo:@"FBTFI02"]; [mat setGradoDificultad:4]; [mat setDescripcion:@"!!!!"]; [Materias addObject:mat]; mat = [[Materia alloc]init]; [mat setNombre:@"Fiscia III"]; [mat setCodigo:@"FBTFI03"]; [mat setGradoDificultad:5]; [mat setDescripcion:@"---"]; [Materias addObject:mat]; mat = [[Materia alloc]init]; [mat setNombre:@"Estructura de Datos"]; [mat setCodigo:@"BPTPR12"]; [mat setGradoDificultad:4]; [mat setDescripcion:@"Orientacion a objetos"]; [Materias addObject:mat]; mat = [[Materia alloc]init]; [mat setNombre:@"Algoritmos y Programacion"]; [mat setCodigo:@"BPTPR11"]; [mat setGradoDificultad:3]; [mat setDescripcion:@"estructurada"]; [Materias addObject:mat]; mat = [[Materia alloc]init]; [mat setNombre:@"Matematicas III"]; [mat setCodigo:@"FBTMI03"]; [mat setGradoDificultad:3]; [mat setDescripcion:@"Mate 3"]; [Materias addObject:mat]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } #pragma mark - Table view data source - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return Materias.count; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"MateriaCell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; Materia *current = [Materias objectAtIndex:indexPath.row]; [cell.textLabel setText:current.Nombre]; return cell; } #pragma mark - Table view delegate - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { } @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.
 

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