在动态tableview上使用sudzc



这是我第一次在Cocoa-Touch Framework上工作的Web服务,我成功地从控制台上的Web服务中获取数据,但是当我尝试使用Array上的tableview将其传递时,什么都不做。我认为问题是

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath; 

该方法不会传递编译器进行编译。即使它可以正常工作,它也将带有标签到表文本的所有数据,因为使用: cell.textLabel.text = [myDataCell objectAtIndex:indexPath.row];

如何在Dynamic Cell.Text上使用指定字段?任何帮助都会感谢。

#import "ViewController.h"
#import "REQService.h"
@interface ViewController ()
@end
@implementation ViewController
@synthesize sorguTextField,sorguButton,sorguLabelOutput,name;
- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (IBAction)getOutput:(id)sender {
    REQService* service = [REQService service];
    service.logging = YES;
    [service NumaradanIsimALL:self action:@selector(NumaradanIsimALLHandler:) msisdn:sorguTextField.text username: @"xxx" password:@"xxxxxxxxx"];

    myDataCell = [[NSMutableArray alloc ] initWithObjects:myData, nil];
}
#pragma notes - View Tables
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = nil;
    cell = [tableView dequeueReusableCellWithIdentifier:@"myCell"];
    if(cell == nil)
    {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"myCell"];
    }
    cell.textLabel.text = [myDataCell objectAtIndex:indexPath.row];
}
@end

看起来您尚未在视图控制器类中实现Web服务响应处理程序NumaradanIsimALLHandler方法。在您的代码中实现此方法,一旦您在此方法中得到响应后,将其分配给mydatacell对象,然后重新加载表视图(例如[tableView reloadData]);

在这种情况下,您将在按钮的点击点击时进行异步的Web服务呼叫,并且随着表视图代表的加载,将立即致电,因此您需要在NumaradanisimallHandler Handler方法中重新加载表视图。

最新更新