有一个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-塞维罗) –