RSS 피드를 만들었으며 오류가 발생했습니다. 신호 SIGARBT 내가이를 입력하여이 오류를 수정 : (스레드 : 1 신호 SiGARBT) tableView dequeueReusableCellWithIdentifier
이 코드에 입력
>UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
나는 오류 스레드 1를 얻을.
static NSString *CellIdentifier = @"Cell";
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:CellIdentifier];
그러나 더욱 문제를 복잡 때문에 내가 셀을 클릭 할 수 있으며, 작업과 SEGUE을 준비하지 않을 것이다 작동 할 때 그래서 나는 다음보기 컨트롤러하지 않을 셀을 클릭 할 때 . 그게 더 심해 그래서 내가 없애 버려.
static NSString *CellIdentifier = @"Cell";
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:CellIdentifier];
^^^^
이 위의 코드는 내가 라인에 Thread 1: Signal SIGARBT
를 얻을 내가 코드 의 조각을 제거하면
이 내 응용 프로그램을 열 때의 viewDidLoad
에 위치한UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
이 오류가 해결되지 않은 모든 것을 시도해 보았습니다. Signal SIGARBT를 수정하십시오.
이것은 내 전체 코드입니다.
//
// AppMain.m
// fcffv
//
// Created by Ajay Venkat on 6/09/2014.
// Copyright (c) 2014 AJTech. All rights reserved.
//
#import "AppMain.h"
#import "AppDetail.h"
@interface AppMain() {
NSXMLParser *parser;
NSMutableArray *feeds;
NSMutableDictionary *item;
NSMutableString *title;
NSMutableString *link;
NSString *element;
}
@end
@implementation AppMain
- (void)awakeFromNib
{
[super awakeFromNib];
}
- (void)viewDidLoad {
[super viewDidLoad];
static NSString *CellIdentifier = @"Cell";
[self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:CellIdentifier];
feeds = [[NSMutableArray alloc] init];
NSURL *url = [NSURL URLWithString:@"http://bountyboulevardss.eq.edu.au/?cat=3&feed=rss2"];
parser = [[NSXMLParser alloc] initWithContentsOfURL:url];
[parser setDelegate:self];
[parser setShouldResolveExternalEntities:NO];
[parser parse];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
#pragma mark - Table View
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return feeds.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
cell.textLabel.text = [[feeds objectAtIndex:indexPath.row] objectForKey: @"title"];
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
self.tableView.delegate = self;
self.tableView.dataSource = self;
}
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict {
element = elementName;
if ([element isEqualToString:@"item"]) {
item = [[NSMutableDictionary alloc] init];
title = [[NSMutableString alloc] init];
link = [[NSMutableString alloc] init];
}
}
- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName {
if ([elementName isEqualToString:@"item"]) {
[item setObject:title forKey:@"title"];
[item setObject:link forKey:@"link"];
[feeds addObject:[item copy]];
}
}
- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string {
if ([element isEqualToString:@"title"]) {
[title appendString:string];
} else if ([element isEqualToString:@"link"]) {
[link appendString:string];
}
}
- (void)parserDidEndDocument:(NSXMLParser *)parser {
[self.tableView reloadData];
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if ([[segue identifier] isEqualToString:@"showDetail"]) {
NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
NSString *string = [feeds[indexPath.row] objectForKey: @"link"];
[[segue destinationViewController] setUrl:string];
}
}
@end
이미지 :
이
얘들 아 도와주세요
이미지가 ^^^입니다.
static NSString *CellIdentifier = @"Cell";
를 작성했습니다 볼 수 있듯이 당신이 "셀"@으로 스토리 보드에서 셀의 cellIdentifier를 제공해야합니다. 하지만 작은 안내선을 줄 수 있어요. 먼저 테이블 뷰 대리자를 만듭니다. 그런 다음 스토리 보드에서 셀 이름을 정의하십시오. 그리고 여기서 행 인덱스 경로에 대해 셀 안의 셀을 정의합니다. 별도의 클래스 (NSObject with UITablecell)를 사용하십시오. – PuvanarajanIm 무슨 뜻인지 모르겠지만 12 세 밖에되지 않습니다. 그래서 할 self.tableView.delegate = 자기; self.tableView.dataSource = self; 세포 앞에? – Xcoder
http://www.appcoda.com/uitableview-tutorial-storyboard-xcode5/ – Puvanarajan