0
我已經使用xcode創建了主 - 細節視圖應用程序,並讓xcode生成它應該做的所有事情。我添加幾個按鈕到的TableView最後掛接應答方法到這些按鈕:看起來像這樣(未粘貼所有代碼):如何將reloadData添加到Xcode默認的主 - 細節Tableview應用程序
-(IBAction)orderBy:(UIBarButtonItem *)sender
{
int lv_temp = sender.tag;
choice = lv_temp;
switch (lv_temp) {
case 0:
break;
case 1:
{
//This gives us all the different sections available.
typeSections = [Items valueForKeyPath:@"@distinctUnionOfObjects.type"];
//Do some more stuff and create the Dictionary so we hold an array with a key for each section
[ItemsByType2 setObject:ItemsTemp forKey:[NSString stringWithFormat:@"%@", id]];
[ItemsTemp removeAllObjects];
}
最終的結果是,我終於有一個包含數組a的NSDictionary對象其中部分ID是關鍵。我想重新加載這些部分,所以我們有一種排序。
問題是,如何以及在哪裏調用生成的tableView的reloadData?看起來像tableView本身無法在Sender方法中訪問(這聽起來對我來說是合乎邏輯的),但我不知道如何調用該方法,以便tableView將其稱爲方法numberOfSections,RowsPerSection等(僞代碼btw)。
任何想法?
乾杯! Laurens
我自己也發現了這個:-(我怎麼能錯過這個?!?!謝謝復古! – user3164818