I have an UITableView
its loading number ofsongs from the back end (actually those are song's urls). Those are getting in JSON
format. Now my problem is when number of songs are increases the table getting stuck. It hard to scroll. So how I can avoid this?
I'm loading views top of a main view. In main view viewDidLoad
arrSongList=[[NSMutableArray alloc]init];
arrSongList=[ws GetSongs];`
Then there is a menu to select song option. When I click on that menu cell it loads the songs view. for loading song view
-(void)getAllSongsAndReloadTable :(id)sender//1
{
[viewDisplayArea addSubview:viewSongs];
[self flipView : viewDisplayArea: viewDisplayArea : UIViewAnimationTransitionFlipFromLeft];
[progressAlert dismissWithClickedButtonIndex:0 animated:YES];
}
ViewSongs
view has the song table. It loads in this way
This is for numberOfRowsInSection
else if (tableView.tag==4)
{
return [arrSongList count];
}
This is for cellForRowAtIndexPath
else if (tableView.tag==4)//All Songs
{
cell4 =nil;
if (cell4 == nil) {
NSArray *nib =[[NSBundle mainBundle]loadNibNamed:@"SongCell" owner:self options:nil];
cell4=[nib objectAtIndex:0];
}
[cell4 setSelectionStyle:UITableViewCellSelectionStyleNone];
cell4.lblSong.text=[[arrSongList objectAtIndex:indexPath.row] valueForKey:@"SONGTITLE"];
cell4.lblArtist.text=[[arrSongList objectAtIndex:indexPath.row] valueForKey:@"ARTISTNAME"];
NSString *imgUrl=[[arrSongList objectAtIndex:indexPath.row]valueForKey:@"SONGIMG"];
NSData *data=[NSData dataWithContentsOfURL:[NSURL URLWithString: imgUrl]];
UIImage *img = [[UIImage alloc] initWithData:data];
cell4.imgSong.image=img;
NSString *imgUrlLarge=[[arrSongList objectAtIndex:indexPath.row]valueForKey:@"SONGIMGLARGE"];
NSData *dataLarge=[NSData dataWithContentsOfURL:[NSURL URLWithString: imgUrl]];
UIImage *imgLarge = [[UIImage alloc] initWithData:dataLarge];
cell4.imgSongLarge=[[UIImageView alloc]init];
cell4.imgSongLarge.image=imgLarge;
[cell4.btnTick addTarget:self action:@selector(tickButtonTapped:) forControlEvents:UIControlEventTouchUpInside] ;
[cell4.btnAddtoMyList addTarget:self action:@selector(topLeft:) forControlEvents:UIControlEventTouchUpInside];
return cell4;
}