我正在尝试为我的tableview单元格添加一个副标题,但它们不会显示.哪里出错了?
该行是
[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle]
最新的,还是iOS 7?
最好的祝福
坦率
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
if (!cell)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
cell.textLabel.text = @"TestA";
cell.detailTextLabel.text = @"TestB";
return cell;
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用AFNetworking第2版的第一步.
由于新版本的现有在线教程,如Ray Wenderlich的afnetworking-crash-course不再适用.
从AFNetworking 2迁移指南我得到了以下代码:
https://github.com/AFNetworking/AFNetwor ...迁移 - 指南
NSURL *URL = [NSURL URLWithString:@"http://example.com/foo.json"];
NSURLRequest *request = [NSURLRequest requestWithURL:URL];
AFHTTPRequestOperation *operation = [[AFHTTPRequestOperation alloc]
initWithRequest:request];
operation.responseSerializer = [AFJSONSerializer serializer];
[operation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
NSLog(@"%@", responseObject);
} failure:nil];
[operation start];
Run Code Online (Sandbox Code Playgroud)
这时我已经添加了导入
#import "AFNetworking.h"
Run Code Online (Sandbox Code Playgroud)
到.pch文件.
问题:我总是收到错误消息,AFJSONSerializer是未声明的.
我忘记了什么步骤?
最好的祝福
坦率