我正嘗試創建帶有雙NSMutableArray
值的單個table view
。現在我保持UISegmentcontrol
第一個按鈕點擊加載第一個NSMutableArray
數據。第二個按鈕點擊加載第二個NSMutableArray
數據值(點擊第二個按鈕後,第一個數據不應該顯示)。如何將tableview數據重新加載到另一個數組?
NSMUtableArray *firstarray = [First values];
NSMUtableArray *secondarray = [second values];
-(void)segmentedControlValueDidChange:(UISegmentedControl *)segment
{
switch (segment.selectedSegmentIndex) {
case 0:{
//action for the first button (Current)
//want to load first array data into table
break;}
case 1:{
//action for the first button (Current)
//want to load second array data into table
break;}
}
}
但第一次 我做的事?在選擇按鈕之前,我需要列出默認的第一陣列數據@ anthu – Anushka
是的,您可以通過在某處指定arrTableData = firstarray來選擇默認值。 – anhtu
當你設置選定的段你也可以設置數組的初始值 – Wain