I'm quite new to this site and iOS development. I have an app that I'm working on, in it, I'm working on a view where when the users taps one button named "zones" the view calls a table view with a list of zones. I'm currently able to make a selection. But what I want is to return back to the previous view when user makes a selection on that table and I want to copy that text in the selection to a variable. Tried so many things. Nothing came close :(
- (void)viewDidLoad
{
[super viewDidLoad];
zones=[NSArray arrayWithObjects:@"392A", @"382F", @"388A", @"373A", @"372A", @"373B", @"366A", @"367A", @"368B", @"362A", @"364A", @"356A",@"357A", @"364B", @"354A",@"353A", @"342A", nil];
NSLog(@"Apple");
// Do any additional setup after loading the view.
}
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
cell.backgroundColor = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"Home.png"]];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [zones count];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *tableIdentifier = @"zonesTable";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:tableIdentifier];
if (cell==nil)
{
cell=[[UITableViewCell alloc]initWithStyle:(UITableViewCellStyleDefault) reuseIdentifier:tableIdentifier];
}
cell.textLabel.text = [zones objectAtIndex:indexPath.row];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cellValue = [tableView cellForRowAtIndexPath:indexPath];
NSLog(@"%@", cellValue); //Not Even getting the NSLog output in Xcode ;(
}