How to show selected cell value from uitable view as label in other view

Im new to iphone development.I have a tableview controller i want to show selected(multiple) cell(checkmarked) value as a lables in other view,How can i acheive this?this is the code which i usd for check marking the tableview cell

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{

UITableViewCell *thisCell = [tableView cellForRowAtIndexPath:indexPath];
if (thisCell.accessoryType == UITableViewCellAccessoryNone) {
    thisCell.accessoryType = UITableViewCellAccessoryCheckmark;

}else
{
    thisCell.accessoryType = UITableViewCellAccessoryNone;
}
}
- (UITableViewCellAccessoryType)tableView:(UITableView *)tableView accessoryTypeForRowWithIndexPath:(NSIndexPath *)indexPath {
return UITableViewCellAccessoryNone;
}

Answers


Add the Checkmarked Cell's index in an array and Display the value at that index in Label

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *thisCell = [tableView cellForRowAtIndexPath:indexPath];
    if (thisCell.accessoryType == UITableViewCellAccessoryNone) {
        thisCell.accessoryType = UITableViewCellAccessoryCheckmark;
        [myIndexArray addObject:[NSString stringWithFormat:@"%d",indexPath.row]];
    }
    else
    {
        thisCell.accessoryType = UITableViewCellAccessoryNone;
        for(int i=0; i<myIndexArray.count; i++)
        {
            if([[myIndexArray objectAtIndex:i]intValue]== indexPath.row)
            {
                [myIndexArray removeObjectAtIndex:i];
                 break;
            }
        }
    }
}

Need Your Help

Regex tags allow 4 words max 3 commas

php regex

I need to allow a maximum of 4 tags (words) and they should be seperated by a comma. So for example: *This, is, 4, tags* &lt;== should be ok! *now, 3, tags* &lt;== should be ok! *or, 2* &l...

SQL - return rows for values with MAX COUNT

mysql sql

I want to access a weather table and sumamrise it in terms of days and months. I want some of the values to be AVG and some to be SUM.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.