Tuesday, 20 October 2015

How to use Section in Row Using UITableView in Ios/Iphone

@interface MapPin : NSObject<MKAnnotation> {
    CLLocationCoordinate2D coordinate;
    NSString *title;
    NSString *subtitle;
}

@property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
@property (nonatomic, readonly) NSString *title;
@property (nonatomic, readonly) NSString *subtitle;

- (id)initWithCoordinates:(CLLocationCoordinate2D)location

placeName:(NSString *)placeName description:(NSString *)description;



pin = [[MapPin alloc] initWithCoordinates:[track startCoordinates]

placeName:@"Start" description:@""];
[map addAnnotation:pin];




- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:

(NSIndexPath *)indexPath
{

[self.tableView deselectRowAtIndexPath:indexPath animated:NO];

NSArray * nameArray = [self.sectionsArray objectAtIndex:indexPath.section];

PFUser *user = (PFUser*)[nameArray objectAtIndex:indexPath.row];

// PFUser *user = (PFUser*)[self.friends objectAtIndex:indexPath.section];

if (cell.accessoryType == UITableViewCellAccessoryNone)
{
    cell.accessoryType = UITableViewCellAccessoryCheckmark;
    [self.recipients addObject:user.objectId];
NSLog(@"added:%@",user);
}
else {
    cell.accessoryType = UITableViewCellAccessoryNone;
    [self.recipients removeObject:user.objectId];
    NSLog(@"removed:%@",user);
}
// this is enough
}