對於部分在我的UITableView數量的正確數量,我使用以下功能:numberOfRowsInSection沒有返回行
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return _matchCenterArray.count;
}
這正常工作,並顯示在表中部分的正確的號碼。它指的是看起來像這樣的_matchCenterArray
:
(
{
"Top 3" = (
{
"Image URL" = "http://thumbs4.ebaystatic.com/m/mu05CM1bactFTAWZjesohNg/140.jpg";
"Item URL" = "http://www.ebay.com/itm/Nexus-7-Latest-Model-16GB-Wi-Fi-7in-Black-2nd-Generation-2013-/281443895415?pt=US_Tablets";
Price = "170.0";
Title = "Nexus 7 (Latest Model) 16GB, Wi-Fi, 7in - Black (2nd) Generation 2013";
},
{
"Image URL" = "http://thumbs4.ebaystatic.com/m/mjkaCfDBdTQ6S-VTD0kFimA/140.jpg";
"Item URL" = "http://www.ebay.com/itm/Asus-Google-Nexus-7-2nd-Generation-Tablet-7-16GB-Android-4-3-/351173222631?pt=US_Tablets";
Price = "165.59";
Title = "Asus Google Nexus 7 2nd Generation Tablet 7\" 16GB Android 4.3 ";
},
{
"Image URL" = "http://thumbs4.ebaystatic.com/m/mjIENDWxrHTfcrO_Tmu4-zw/140.jpg";
"Item URL" = "http://www.ebay.com/itm/Google-Nexus-7-16GB-HD-K008-NEXUS7-ASUS-2B16-2nd-Gen-Tablet-Priority-Ship-/301315740555?pt=US_Tablets";
Price = "164.99";
Title = "Google Nexus 7 16GB HD K008 NEXUS7 ASUS-2B16 2nd Gen Tablet Priority Ship";
},
{
"Search Term" = "nexus 7 16gb";
}
);
},
{
"Top 3" = (
{
"Image URL" = "http://thumbs3.ebaystatic.com/m/mbSjXw608gtlLhYC5GbrbOg/140.jpg";
"Item URL" = "http://www.ebay.com/itm/rolex-datejust-/301318985642?pt=Wristwatches";
Price = "400.0";
Title = "rolex datejust";
},
{
"Image URL" = "http://thumbs3.ebaystatic.com/m/mx2eBCLXBEY30DXIIMrm_MQ/140.jpg";
"Item URL" = "http://www.ebay.com/itm/VINTAGE-LADIES-ROLEX-STANDARD-17J-GOLD-FILLED-WATCH-WORKING-NICE-/111466728842?pt=Wristwatches";
Price = "349.99";
Title = "VINTAGE LADIES ROLEX STANDARD 17J GOLD FILLED WATCH WORKING NICE ";
},
{
"Image URL" = "http://thumbs2.ebaystatic.com/m/mj7-GblU-4Al2X5q0sRvkfw/140.jpg";
"Item URL" = "http://www.ebay.com/itm/Rolex-17000-Quartz-Datejust-BLACK-DIAL-5035-/271610085029?pt=Wristwatches";
Price = "400.0";
Title = "Rolex 17000 Quartz Datejust BLACK DIAL 5035";
},
{
"Search Term" = rolex;
}
);
}
)
據我所看到的,它是前3數組的數組。在這種情況下,有兩個排名前3陣列,這導致了兩個部分。就每節的行數而言,我希望它是Top 3數組中的字典對象的數量。
在這種情況下,如果我沒有弄錯,它們在這個數組中似乎都有4個字典。我試過用下面的函數做這個,但是它只顯示每個部分一行:
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
NSArray *currentSectionArray = _matchCenterArray[section];
return currentSectionArray.count;
return 3;
}
你試過調試它嗎?在numberOfRowsInSection函數中放置一個斷點,看看currentSectionArray是什麼? – sha 2014-09-29 17:37:32