Xcode 我的自定义单元格以前出现在tableview中,现在没有了
这是我的问题。我有一个带有标识符“tweetCell”的自定义单元格,我已将其导入mt tableviewcontroller.h文件。我已将该类链接到故事板中的原型单元。所有UILabel都连接到单元格,但我无法让tableview显示单元格。真的有用吗?然后一夜之间就停止了?!!有人能在这里发现我的错误吗?提前谢谢Xcode 我的自定义单元格以前出现在tableview中,现在没有了,xcode,tableview,custom-cell,Xcode,Tableview,Custom Cell,这是我的问题。我有一个带有标识符“tweetCell”的自定义单元格,我已将其导入mt tableviewcontroller.h文件。我已将该类链接到故事板中的原型单元。所有UILabel都连接到单元格,但我无法让tableview显示单元格。真的有用吗?然后一夜之间就停止了?!!有人能在这里发现我的错误吗?提前谢谢 - (void)fetchTweets { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORIT
- (void)fetchTweets
{
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
NSData* data = [NSData dataWithContentsOfURL:
[NSURL URLWithString: @"http://search.twitter.com/search.json?q=%23mysearchhashtag"]];
NSError* error;
tweets = [NSJSONSerialization JSONObjectWithData:data
options:kNilOptions
error:&error];
dispatch_async(dispatch_get_main_queue(), ^{
[self.tableView reloadData];
});
});
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return tweets.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"tweetCell";
customCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[customCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
NSDictionary *tweet = [tweets objectAtIndex:indexPath.row];
NSString *tweetText = [tweet valueForKey:@"text"];
NSArray *tweetComponents = [tweetText componentsSeparatedByString:@":"];
cell.firstDetail.text = [tweetComponents objectAtIndex:0];
cell.secondDetail.text = [tweetComponents objectAtIndex:1];
cell.thirdDetail.text = [tweetComponents objectAtIndex:2];
return cell;
}
谢谢你,迈克尔。我不理解向上投票的概念-谢谢你提请我注意。我会调查此事,并对所有帮助过我的人采取行动。显然,投票需要15%的声誉,所以它不会让我这么做。我很高兴你没有因为我的建设性评论而生气。在你得到15分之前,如果你问了好问题或给出了好答案,这并不难做到,至少你可以接受,单击你之前问过的问题中最佳答案旁边的复选标记图标。太棒了-谢谢Michael。非常感谢您的帮助我刚刚执行了您的建议,但不幸的是从tableView到CustomCell仍然没有链接。。。