I have a tableView that shows a list of songs from a user's iPod library. Each cell calls too many methods which is probably why scrolling is so sluggish (I think 'calling methods' is the right terminology, I'm fairly new to programming), like so:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
// Configure the cell...
cell.textLabel.text= [self titleForRow:indexPath]; //getting song title
cell.detailTextLabel.text = [self subtitleForRow:indexPath]; //get song artist
cell.imageView.image = [self artworkForRow:indexPath]; //get song image
return cell;
}
These are the methods:
- GET SONG TITLE
-(NSString *)titleForRow:(NSIndexPath *)indexpath{
NSMutableArray* rowArray=[[NSMutableArray alloc]initWithCapacity:0];
rowArray=[self getArrayOfRowsForSection:indexpath.section];
NSString *titleToBeDisplayed=[rowArray objectAtIndex:indexpath.row];
return titleToBeDisplayed;
}
-(NSMutableArray *)getArrayOfRowsForSection:(NSInteger)section
{
NSString *rowTitle;
NSString *sectionTitle;
NSMutableArray *rowContainer=[[NSMutableArray alloc]initWithCapacity:0];
for (int i=0; i<self.alphabetArray.count; i++)
{
if (section==i) // check for right section
{
sectionTitle= [self.alphabetArray objectAtIndex:i]; //getting section title
for (MPMediaItem *song in songs)
{
NSString *title = [song valueForProperty:MPMediaItemPropertyTitle];
rowTitle= [title substringToIndex:1]; //modifying the statement to its first alphabet
if ([rowTitle isEqualToString:sectionTitle]) //checking if modified statement is same as section title
{
[rowContainer addObject:title]; //adding the row contents of a particular section in array
}
}
}
}
return rowContainer;
}
- GET ARTIST
-(NSString *)subtitleForRow:(NSIndexPath *)indexpath{
NSMutableArray* subtitleRowArray=[[NSMutableArray alloc]initWithCapacity:0];
subtitleRowArray=[self getSubtitle:indexpath.section];
NSString *subtitleToBeDisplayed=[subtitleRowArray objectAtIndex:indexpath.row];
return subtitleToBeDisplayed;
}
-(NSMutableArray *)getSubtitle:(NSInteger)section
{
NSString *rowTitle;
NSString *sectionTitle;
NSMutableArray *rowContainer=[[NSMutableArray alloc]initWithCapacity:0];
for (int i=0; i<self.alphabetArray.count; i++)
{
if (section==i) // check for right section
{
sectionTitle= [self.alphabetArray objectAtIndex:i]; //getting section title
for (MPMediaItem *song in songs)
{
NSString *title = [song valueForProperty:MPMediaItemPropertyTitle];
NSString *subtitle = [song valueForProperty:MPMediaItemPropertyArtist];
rowTitle= [title substringToIndex:1]; //modifying the statement to its first alphabet
if ([rowTitle isEqualToString:sectionTitle]) //checking if modified statement is same as section title
{
if (subtitle){
[rowContainer addObject:subtitle]; //adding the row contents of a particular section in array
}
else {
[rowContainer addObject:#"Unknown Artist"];
}
}
}
}
}
return rowContainer;
}
- GET IMAGE
-(UIImage *)artworkForRow:(NSIndexPath *)indexpath{
NSMutableArray* artworkRowArray=[[NSMutableArray alloc]initWithCapacity:0];
artworkRowArray=[self getArtwork:indexpath.section];
UIImage *artworkToBeDisplayed=[artworkRowArray objectAtIndex:indexpath.row];
return artworkToBeDisplayed;
}
-(NSMutableArray *)getArtwork:(NSInteger)section
{
NSString *rowTitle;
NSString *sectionTitle;
NSMutableArray *rowContainer=[[NSMutableArray alloc]initWithCapacity:0];
for (int i=0; i<self.alphabetArray.count; i++)
{
if (section==i) // check for right section
{
sectionTitle= [self.alphabetArray objectAtIndex:i]; //getting section title
for (MPMediaItem *song in songs)
{
NSString *title = [song valueForProperty:MPMediaItemPropertyTitle];
MPMediaItemArtwork *artwork = [song valueForProperty:MPMediaItemPropertyArtwork];
UIImage *artworkImage = [artwork imageWithSize: CGSizeMake (50, 50)];
rowTitle= [title substringToIndex:1]; //modifying the statement to its first alphabet
if ([rowTitle isEqualToString:sectionTitle]) //checking if modified statement is same as section title
{
if (artworkImage){
[rowContainer addObject:artworkImage]; //adding the row contents of a particular section in array
}
else {
[rowContainer addObject:[UIImage imageNamed:#"noArtworkSongsCell"]];
}
}
}
}
}
return rowContainer;
}
Is there any way to smoothen scrolling here? Each of those methods are important.
Any help would be much appreciated, thanks!
The methods you're using shouldn't be called in cellForRowAtIndexPath -- you shouldn't be creating those arrays every time you need to populate a label in your cell. The arrays should be created once, outside of cellForRowAtIndexPath, and then queried inside that method to get the correct item out of the arrays.
Always prepare your data BEFORE drawing the table itself. In methods such as cellForRow, heightForCellAtIndexPath etc. you should just access your data, not modify it and/or manipulate it. In your example you not only iterate over array for every cell, you even call extremely slow methods such as string comparisons. You could put a breakpoint in cellForRowAtIndex path and see how many times it's called during scrolling, and then just imagine how much work you want to be done.
Related
I have an SQLite database implemented in my xcode project. i want to view all name from database into tableview but getting an error as
NSRangeException', reason: '*** -[__NSArrayM objectAtIndex:]: index
9223372036854775807 beyond bounds [0 .. 13]'
#interface DisplayViewController ()
#property (nonatomic, strong) DBManager *dbManager;
#property (nonatomic, strong) NSArray *arrPeopleInfo;
#end
#implementation DisplayViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.mytableview.delegate = self;
self.mytableview.dataSource = self;
NSString *docsDir;
NSArray *dirPaths;
//Get the directory
dirPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
docsDir = dirPaths[0];
self.dbManager = [[DBManager alloc] initWithDatabaseFilename:#"IApp.db"]; //Build the path to keep the database
// _databasePath = [[NSString alloc] initWithString:[docsDir stringByAppendingPathComponent:#"IApp.db"]];
// [self getcount];
[self loadData];
// [self getcount];
// Do any additional setup after loading the view.
}
- (void)loadData {
// Form the query.
NSString *query = #"select * from iApp";
if (self.arrPeopleInfo != nil) {
self.arrPeopleInfo = nil;
}
self.arrPeopleInfo = [[NSArray alloc] initWithArray:[self.dbManager loadDataFromDB:query]];
[self.mytableview reloadData];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
//#warning Potentially incomplete method implementation.
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return self.arrPeopleInfo.count;
// return [arri count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:#"idCellRecord" forIndexPath:indexPath];
NSInteger indexOfname = [self.dbManager.arrColumnNames indexOfObject:#"firstname"];
NSInteger indexOffname = [self.dbManager.arrColumnNames indexOfObject:#"lastname"];
cell.textLabel.text = [NSString stringWithFormat:#"%# %#", [[self.arrPeopleInfo objectAtIndex:indexPath.row] objectAtIndex:indexOfname], [[self.arrPeopleInfo objectAtIndex:indexPath.row] objectAtIndex:indexOffname]];
return cell;
}
When you search for an item in something, Cocoa returns NSNotFound for the index, if the method cannot find the item. This applies for -indexOfObject:, too. NSNotFound is a big integral number (INT_MAX) as you can see in the title of your Q.
Therefore
NSInteger indexOfname = [self.dbManager.arrColumnNames indexOfObject:#"firstname"];
will be NSNotFound, if #"firstName" is not found in the receiver. Please check, whether you have such a key. Typo? Camel case? firstNams?
If you do not know the keys at compile time you have to check for it, as #Inder told you:
if(indexOfname==NSNotFound)
// The object is not present
BTW: You should really recheck your naming. It does not follow the Cocoa naming conventions.
You can prevent this by using a very simple checking.
if(indexOfname < [self.dbManager.arrColumnNames count] && indexOffname < [self.dbManager.arrColumnNames count]) {
cell.textLabel.text = [NSString stringWithFormat:#"%# %#", [[self.arrPeopleInfo objectAtIndex:indexPath.row] objectAtIndex:indexOfname], [[self.arrPeopleInfo objectAtIndex:indexPath.row] objectAtIndex:indexOffname]];
}
else {
cell.textLabel.text = #""; // or what ever you want to do
}
Please check whether indexOfname or indexOffname is equal to NSNotFound
NSInteger indexOfname = [self.dbManager.arrColumnNames indexOfObject:#"firstname"];
NSInteger indexOffname = [self.dbManager.arrColumnNames indexOfObject:#"lastname"];
if (indexOfname == NSNotFound) {
//Then don't use this index
}
if (indexOffname == NSNotFound) {
//Then don't use this index
}
Actually you have successfully fetched all record from Database. so left part is how to shown in UITableViewCell. modified cellForRowAtIndexPath as per below code.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:#"idCellRecord" forIndexPath:indexPath];
cell.textLabel.text = [NSString stringWithFormat:#"%# %#", [[self.arrPeopleInfo objectAtIndex:indexPath.row] valeuForKey:#"firstname"], [[self.arrPeopleInfo objectAtIndex:indexPath.row] valueForKey:#"lastname"]];
return cell;
}
I have created a UITableView with custom cell & stored name,no,pincode in to these cell.
Here is my Code for array:-
for (int i =0; i<[tempArr count]; i++)
{
NSString *rawData = [tempArr objectAtIndex:i];
if (rawData !=nil)
{
Persons *newPerson = [[Persons alloc]init];
NSArray *data = [rawData componentsSeparatedByString:#"\t"];
newPerson.name = [NSString stringWithFormat:#"%#",[data objectAtIndex:0]];
newPerson.no = [[data objectAtIndex:1] integerValue];
newPerson.pincode = [[data objectAtIndex:2] integerValue];
[allPersons addObject:newPerson];
}
}
Here is my Customcell.h
#interface Customcell : UITableViewCell
#property(weak) Persons* person;
#end
UITableView Datasrouce method:-
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
Customcell *cell = [tblStations dequeueReusableCellWithIdentifier:#"personCell"];
if (tableView == self.searchDisplayController.searchResultsTableView)
{
cell.person = filteredContentList[indexPath.row];
[cell.textLabel setText:cell.person.name];
}
else
{
cell.person = allPersons[indexPath.row];
[cell.textLabel setText:cell.person.name];
}
return cell;
}
How do i create Section & index list for all names from A to Z & give title by cell.textLabel.text?
I am following This Tutorial but it has static keys & names added to NSDictionary,NSArray.
In my example i do not know how many names starting with same letter can come in the array. i am also using UISearchDisplayController for search person name.
I want to add number of sections & title for those sections by names that is in the array or cell.textLabel.text dynamically.
i do not know about UISearchDisplayController that these sections & index list will be displaying in UISearchDisplayController so i do not want these sections & index list while searching.
You need to spend a little more time trying to make your questions more clear.
Include a custom implementation of the necessary UITableView data source and delegate methods...
NOTE my assumption that your variable allPersons is an NSMutableArray.
NOTE these do not include for your search results data sets!
Return an NSInteger for the number of sections in your UITableView...
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
NSSet *setData = nil;
NSInteger integerData = 0;
setData = [NSSet setWithArray:allPersons];
integerData = [setData count];
return integerData;
}
UPDATE
Return an NSString for section header titles...
- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section {
NSOrderedSet *setData = nil;
NSString *stringData = nil;
setData = [NSOrderedSet orderedSetWithArray:allPersons];
stringData = [[setData allObjects] componentsJoinedByString:#" "];
return stringData;
}
...plus others if I have the time...
I have 2 tables view . One is with category and the other with videos .I added the favorite song into an array . But how can i reload my table with only the favorite videos when favorite category is selected ?
This is what i was trying but my table view is empty.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if (tableView.tag==0) {
TableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:#"cell"];
if (!cell) {
cell=[[TableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:#"cell"];
}
int storyIndex = [indexPath indexAtPosition: [indexPath length] - 1];
cell.title.text=[[stories objectAtIndex: indexPath.row] objectForKey: #"title"];
NSString * aux=[[stories objectAtIndex: indexPath.row] objectForKey: #"url"];
NSString * videoHTML =[NSString stringWithFormat: #"<iframe type=\"text/html\" width=\"100\" height=\"80\" src=\"%#\" frameborder=\"0\"></iframe>",aux] ;
NSString *imagine=[[stories objectAtIndex:indexPath.row]objectForKey:#"thumbnail"];
cell.imageSong.image=[UIImage imageNamed:imagine];
NSData *imageData = [NSData dataWithContentsOfURL:[NSURL URLWithString:imagine]];
cell.imageSong.image = [UIImage imageWithData:imageData];
cell.imageSong.contentMode=UIViewContentModeScaleAspectFit;
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if (!tableView.tag==0) {
int row =indexPath.row;
if (row==0) {
self.title1.text=#"ALL SONGS";
[stories removeAllObjects];
[self parse];
i=0;
[self showMenu:nil];
}
else if (row==1) {
self.title1.text=#"FAVORITE";
b=[favoriteArray count];
if (b==0) {
NSLog(#"NSArray empty");
[[[UIAlertView alloc]initWithTitle:#"Attention !" message:#"No videos !" delegate:nil cancelButtonTitle:#"Ok" otherButtonTitles:nil]show];
}
else{
[stories removeAllObjects];
[self.tableView reloadData];
i=0;
[self showMenu:nil];
}
}
else
{
self.title1.text=[categoryArray objectAtIndex:indexPath.row-1];
[stories removeAllObjects];
NSString * path =[feeds objectAtIndex:indexPath.row-1];
[self parseXMLFileAtURL:path];
i=0;
[self showMenu:nil];}
self.karaokeBTn.hidden=YES;
self.menu.hidden=NO;
self.title1.hidden=NO;
}
-(void)parse{
if ([stories count] == 0) {
for (int i=0; i<[feeds count]; i++) {
NSString * path =[feeds objectAtIndex:i];
[self parseXMLFileAtURL:path];
}
}
}
In favorite array i already have the url for video, title and image . i dont need to parse the feed again.
Maybe you want to reload your table after parsing:
-(void)parse{
if ([stories count] == 0) {
for (int i=0; i<[feeds count]; i++) {
NSString * path =[feeds objectAtIndex:i];
[self parseXMLFileAtURL:path];
}
[self.tableView reloadData];
}
I'm not exactly sure if I understood your issue. But since you said your tableView is empty heres a possible solution.
How do you set stories array? If it's a asynchronous data fetch from web, you have a empty stories array when those delegate methods get called.
You have to reload table view once data fetching is done. On the completion block of your data fetching method.
[self.tableView reloadData];
I have an indexed tableView that displays a list of songs from the user's iPod library. But the sections start with 1, 2, etc., because I have songs that start with numbers. How do I group all songs that start with a number into a section '#' in my index?
Right now this is my app (left) compared to what I'd like it to be (right, Music.app). I've highlighted where the # should go (at the end of my index):
This is my code so far in my viewDidLoad:
songsQuery = [MPMediaQuery songsQuery];
songs = [songsQuery items];
NSMutableDictionary *songsInitials;
songsInitials = [[NSMutableDictionary alloc]init];
self.alphabetArray = [[NSMutableArray alloc] init];
for (int i=0; i< songs.count; i++)
{
NSString *firstletter=[[[songs objectAtIndex:i] valueForProperty:MPMediaItemPropertyTitle] substringToIndex:1];
if (songsInitials[firstletter] == nil) {
songsInitials[firstletter] = [[NSMutableArray alloc] init];
[self.alphabetArray addObject:firstletter];
}
[songsInitials[firstletter] addObject:songs[i]];
}
[self.alphabetArray sortUsingSelector:#selector(localizedCaseInsensitiveCompare:)]; //sorting array in ascending array
self.songsInitials = songsInitials;
....and my tableView data source:
#pragma mark - Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return _alphabetArray.count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [_songsInitials[_alphabetArray[section]] count];
}
-(NSString *)titleForRow:(NSIndexPath *)indexpath{
NSString *firstLetter = _alphabetArray[indexpath.section];
MPMediaItem *myItem = [_songsInitials[firstLetter] objectAtIndex:indexpath.row];
return [myItem valueForProperty:MPMediaItemPropertyTitle];
}
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView{
return self.alphabetArray;
}
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index{
NSIndexPath *indexpath;
for (int i=0; i < self.alphabetArray.count; i++)
{
NSString *titleToSearch=[self.alphabetArray objectAtIndex:i]; //getting sectiontitle from array
if ([title isEqualToString:titleToSearch]) // checking if title from tableview and sectiontitle are same
{
indexpath=[NSIndexPath indexPathForRow:0 inSection:i];
// scrolling the tableview to required section
[self.songsTable scrollToRowAtIndexPath:indexpath atScrollPosition:UITableViewScrollPositionTop animated:YES];
break;
}
}
return indexpath.section;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
cell.textLabel.text= [self titleForRow:indexPath]; //getting cell content
return cell;
}
This is what I've tried so far, adjusting the for loop in viewDidLoad:
for (int i=0; i< songs.count; i++)
{
NSString *firstletter=[[[songs objectAtIndex:i] valueForProperty:MPMediaItemPropertyTitle] substringToIndex:1];
if (songsInitials[firstletter] == nil) {
NSString *songsInitialsFirstLetter = songsInitials[firstletter];
if ([self stringIsNumeric:songsInitialsFirstLetter]){
songsInitials[firstletter] = [[NSMutableArray alloc] init];
[self.alphabetArray addObject:[NSString stringWithFormat:#"#"]];
NSLog(#"There are numbers!");
}
else if (![self stringIsNumeric:songsInitialsFirstLetter]){
songsInitials[firstletter] = [[NSMutableArray alloc] init];
[self.alphabetArray addObject:firstletter];
}
}
[songsInitials[firstletter] addObject:songs[i]];
}
-(BOOL) stringIsNumeric:(NSString *) str {
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
NSNumber *number = [formatter numberFromString:str];
return !!number; // If the string is not numeric, number will be nil
}
...but it didn't work. I've searched around but I can't find any other questions that ask this, am I missing something obvious here? Any help would be much appreciated! :)
Did not test but changing first letter before looking in the arrays would give better result.
After the sort, not sure where the symbol (#) will end tough, you may have to manual push it to the end.
for (int i=0; i< songs.count; i++)
{
NSString *firstletter=[[[songs objectAtIndex:i] valueForProperty:MPMediaItemPropertyTitle] substringToIndex:1];
NSScanner *ns = [NSScanner scannerWithString:firstletter];
if ( [ns scanInt:NULL] )
{
firstLetter = #"#";
}
if (songsInitials[firstletter] == nil) {
songsInitials[firstletter] = [[NSMutableArray alloc] init];
[self.alphabetArray addObject:firstletter];
}
[songsInitials[firstletter] addObject:songs[i]];
}
I am creating such table view which has not specified the number of sections (that means number of sections should be specified dynamically in its respected delegate i.e. - -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView) or not specified the rows in each sections (That means the number of rows in each sections also should be specified by dynamically in its respected delegates i.e.- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section) as below image in which the section of table specifies the month with year and each section can have any number of rows. The image is -
as above image january 2014 section has 4 rows and december 2013 has 2 rows. I would like to create such type of table view. Is it possible ? if it is possible than please provide proper way or any example or any link through which I can achieve it. Thanks in advanced.
Please Use below Code. Hope It will be useful to u.
in .h file defile
int i
in viewdidload method of .m file
arrData = [NSMutableArray array];
int temp = 1;
for (i = 0; i < 5; i++) {
NSMutableArray * arrIndexData = [NSMutableArray array];
for (int j = 0; j<=i; j++,temp++) {
[arrIndexData addObject:[NSString stringWithFormat:#"%d",temp]];
}
[arrData addObject:arrIndexData];
}
Now in numberOfSectionsInTableView
return i;
in numberOfRowsInSection
return [arrData count];
in cellForRowAtIndexPath
static NSString *CellIdentifier = #"Cell";
CustomCell * cell = (CustomCell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[CustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
}
[cell reloadTableWithArrData:[arrData objectAtIndex:indexPath.row]];
return cell;
I hope, this ll help u..
#Jekil , Just set Your DateFormatter to MMMM yyyy ,
Check my updated Answer
As all suggests use Array of Dictionary in Dictionary put two object one for Title (Nsstring) and second is NSArray ( dict for cell detail),
I have implemented One method for that in my app,
NOTE: Use Your Key Values for your data.
Use Following code for Arranging Array,
-(NSMutableArray*)arrangeSection:(NSMutableArray *)source
{
NSDateFormatter *_formatter=[[NSDateFormatter alloc]init];
[_formatter setLocale:[NSLocale currentLocale]];
[_formatter setDateFormat:#"MMMM yyyy"];
NSMutableArray *arrayMain=[NSMutableArray array];
for (int i=0; i<source.count; i++){
NSDictionary *dict=source[i];
NSDate *date = [NSDate dateWithTimeIntervalSince1970:[[dict objectForKey:#"StartDate"]doubleValue]];
NSString *mm=[_formatter stringFromDate:date];
NSMutableDictionary *secDict=[NSMutableDictionary dictionary];
NSMutableArray *secArray=[NSMutableArray array];
if (i==0){
[secDict setObject:mm forKey:#"Month"];
[secArray addObject:dict];
[secDict setObject:secArray forKey:#"Data"];
[arrayMain addObject:secDict];
}
else{
BOOL flg=NO;
for (NSDictionary *dict2 in arrayMain){
if([[dict2 objectForKey:#"Month"]isEqualToString:mm]){
flg=YES;
[[dict2 objectForKey:#"Data"]addObject:dict];
break;
}
}
if (!flg){
[secDict setObject:mm forKey:#"Month"];
[secArray addObject:dict];
[secDict setObject:secArray forKey:#"Data"];
[arrayMain addObject:secDict];
}
}
}
return arrayMain;
}
Now in tableview Methods use as,
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return arrayEvents.count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [[arrayEvents[section]objectForKey:#"Data"]count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
...
NSDictionary *aDict = [arrayEvents objectAtIndex:indexPath.section];
NSDictionary *maindict=[[aDict objectForKey:#"Data"]objectAtIndex:indexPath.row];
...
}