有一個UITableView,它的數據源是一個NSMutableArray,它實際上是一個解析的XML文件;在同一視圖中,我有兩個具有相同操作方法的UIButton,我如何能夠切換tableview的數據源?用兩個UIButtons更改tableview數據源
當按下A按鈕來加載dataSource1和B加載dataSource2
- (void)buttonsAction: (id)sender {
BOOL activateSecond = _firstButton.selected;
_firstButton.selected = !activateSecond;
_secondButton.selected = activateSecond;
}
dataSource1 = [[NSMutableArray alloc]init];
nodecontent = [[NSMutableString alloc]init];
NSString *xmlURL = @"http://mydomain.com/file.xml";
NSData *xmlData = [[NSData alloc]initWithContentsOfURL:[NSURL URLWithString:xmlURL]];
xmlParserObject = [[NSXMLParser alloc]initWithData:xmlData];
[xmlParserObject setDelegate:self];
[xmlParserObject parse];
[xmlData release];
任何線索?
謝謝爲您的文章!我的情況更復雜,但我想我會在一天結束時解決問題 –
讓我們[在聊天中繼續討論](http://chat.stackoverflow.com/rooms/4614/discussion-between-糖和-EL-塞維羅) –