定义:@property(copy, nonatomic) NSMutableArray*prjlist;
@property(nonatomic, strong) UITableView*mytable;
@property(strong, nonatomic) NSArray*tasks;调用:#import "TestViewController.h"
#import "MKNetworkKit.h"@implementation TestViewController- (void)viewDidLoad
{
[superviewDidLoad];
    self.mytable.delegate = self;
    self.mytable.dataSource = self;
self.tasks= @[@"Walk the log", @"URGENT:Buy milk", @"Clean hidden lair"];
MKNetworkEngine*engine = [[MKNetworkEnginealloc] initWithHostName:@"192.168.0.77:8030/Service1.svc"customHeaderFields:nil];
MKNetworkOperation*op = [engine operationWithPath:@"/PrjStr/0/1/15"params:nilhttpMethod:@"GET"ssl:NO];
    [op addCompletionHandler:^(MKNetworkOperation *completedOperation) {
        NSData *data = [completedOperation responseData];
NSDictionary*resdict = [NSJSONSerializationJSONObjectWithData:data options:NSJSONReadingAllowFragmentserror:nil];
        self.prjlist = [resdict objectForKey:@"col"];
        [self.mytable reloadData];
    } errorHandler:^(MKNetworkOperation *completedOperation, NSError *error) {
NSLog(@"MKNetwork request error : %@", [error localizedDescription]);
    }];
    [engine enqueueOperation:op];}- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    NSLog(@"%i", self.prjlist.count);
//return [self.prjlist count];
    return [self.tasks count];
}- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSString *identifier = @"plainCell";
    NSString *task = [self.tasks objectAtIndex:indexPath.row];    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    cell.textLabel.text = task;
    return cell;
}
这段代码 reloadData不执行! 盼指点
用的是Storyboard, 有个TableViewCell -plainCell Identifier是plainCell, 我还有哪里做的不对呢? 

解决方案 »

  1.   

    还是检查下代码逻辑吧,这个应该跟xcode版本没有关系。可以新建一个项目,把tableview的操作折腾一遍。
      

  2.   

    嗯, 问题解决了, 是stroyboard的设置问题, 不是没有刷新, 是没有输出口!
      

  3.   

    请问storyboard没有输出口是什么意思?我也遇到了类似的问题
      

  4.   

    你的tableView没有被实例化。如果使用storyboard来创建的视图,需要将tableView修饰成“插座变量”,并建立与storyboard的关联
    @property (nonatomic,weak) IBOutlet  UITableView*mytable;
    在storyboard中连线"插座变量"mytable 到页面上的UITableView控件。
      

  5.   

    正想说如果是使用storyboard,怎么没有IBOutlet