У меня есть несколько NSMutableArray в tableView, которые содержат класс Lesson
@interface Lesson : NSObject <NSCoding>{
NSString *time1;
NSString *time2;
NSString *predmet;
NSString *namPrepod;
NSString *zamet;
}
Я перемещаю строку в tableview ................................................................................................................................
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
{
if(segmentedControl.selectedSegmentIndex==0)
{
if(fromIndexPath.section==0)
{
NSMutableArray *r = [[Singleton sharedInstance].chetNedel.monday objectAtIndex:fromIndexPath.row];
[[Singleton sharedInstance].chetNedel.monday removeObjectAtIndex:fromIndexPath.row];
[[Singleton sharedInstance].chetNedel.monday insertObject:r atIndex:toIndexPath.row];
}
if(fromIndexPath.section==1)
{
NSMutableArray *r = [[Singleton sharedInstance].chetNedel.tuesday objectAtIndex:fromIndexPath.row];
[[Singleton sharedInstance].chetNedel.monday removeObjectAtIndex:fromIndexPath.row];
[[Singleton sharedInstance].chetNedel.monday insertObject:r atIndex:toIndexPath.row];
}
но когда я перемещаю строку в программе, я получаю сообщение об ошибке в этой строке
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
..........
if(segmentedControl.selectedSegmentIndex==0)
{
time1 = [[[UILabel alloc] init] autorelease];
time1.font = [UIFont fontWithName:@"Arial-BoldMT" size:13];
time1.tag = tagtime1;
time1.backgroundColor = [UIColor clearColor];
if(indexPath.section ==0)
time1.text =[(Lesson *) [[Singleton sharedInstance].chetNedel.monday objectAtIndex:indexPath.row] time1];
if(indexPath.section ==1)
time1.text =[(Lesson *) [[Singleton sharedInstance].chetNedel.tuesday objectAtIndex:indexPath.row] time1];
if(indexPath.section ==2)
time1.text =[(Lesson *) [[Singleton sharedInstance].chetNedel.wednesday objectAtIndex:indexPath.row] time1];
if(indexPath.section ==3)
time1.text =[(Lesson *) [[Singleton sharedInstance].chetNedel.thirsday objectAtIndex:indexPath.row] time1];
if(indexPath.section ==4)
time1.text =[(Lesson *) [[Singleton sharedInstance].chetNedel.friday objectAtIndex:indexPath.row] time1];
if(indexPath.section ==5)
time1.text =[(Lesson *) [[Singleton sharedInstance].chetNedel.saturday objectAtIndex:indexPath.row] time1];
time1.frame = CGRectMake(8, 12, 300-124, 11);
...........
[cell.contentView addSubview:time1];
что я делаю неправильно?