WCF サービスから取得したコンテンツの XML 解析を行いました。をNSMutableArray
使用してデータをロードしました。NSXMLParser
今度は、そのデータを のテーブルビューにロードしますUIView
。しかし、空のテーブルビューがロードされていることがわかりますが、データはロードされていません。どこが間違っているのか理解できませんでした。私NSMutableArray
はこのようなものです:
(
{
UserName="Roy";
Password="126";
},
{
UserName="Joy";
Password="123";
},
{
UserName="Rony";
Password="5983";
}
-------------
-------------
)
UItableView のコードは次のとおりです。
@interface RootViewController : UIViewController<NSXMLParserDelegate,UITableViewDataSource,UITableViewDelegate>
{
NSMutableArray *arr;
UITableView *tableView;
}
- (void)viewDidLoad
{
UITableView* tableView = [[UITableView alloc] initWithFrame:self.view.bounds];
[self.view addSubview:tableView];
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [arr count];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier=@"Cell";
UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(cell==nil)
{
cell=[[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier]autorelease];
}
NSString *tempstring=[arr objectAtIndex:indexPath.row];
cell.textLabel.text= tempstring;
return cell;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 3;
}
空の行がいくつかある空のテーブルビューを取得しています。どうすればこれを修正できますか?