首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在动态TableView上使用SudzC

在动态TableView上使用SudzC
EN

Stack Overflow用户
提问于 2012-10-30 17:52:49
回答 1查看 146关注 0票数 0

这是我第一次在Cocoa-touch框架上使用web服务,我在控制台上成功地从web服务中获取了数据,但当我尝试通过数组在TableView上传递数据时,它什么也做不到。我觉得问题是,

代码语言:javascript
复制
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath; 

该方法不会传递用于编译的编译器。即使它可以工作,它也会将所有带有标记的数据转换为表格文本,因为使用了:cell.textLabel.text = [myDataCell objectAtIndex:indexPath.row];

如何在具有指定字段的动态cell.text上使用它们?任何帮助都将不胜感激。

代码语言:javascript
复制
#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
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-10-30 18:44:46

看起来您还没有在视图控制器类中实现web服务响应处理程序NumaradanIsimALLHandler方法。在你的代码中实现这个方法,一旦你在这个方法中得到一个响应,将它赋值给myDataCell对象并重新加载表视图(例如[tableView reloadData]);

在本例中,您只需轻触一个按钮即可进行异步web服务调用,由于表视图委托将在视图加载后立即被调用,因此您需要在NumaradanIsimALLHandler处理程序方法中重新加载表视图。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13136436

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档