해결하기 어려운 문제가 있습니다.행 선택시 새 UIView 열기
위 표의 셀을 클릭하면 새 UITableView
을 열어야합니다.
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
ChoiceChampionViewController *choiceChampionViewController = [[ChoiceChampionViewController alloc] initWithNibName:@"ChoiceChampionViewController" bundle:nil];
NSString * ind = @".....";
NSString * number = ..;
ind = [ind stringByReplacingOccurrencesOfString:@"XX" withString:number];
[[NSUserDefaults standardUserDefaults] setValue:number forKey:@"Region"];
choiceChampionViewController.url = ind;
[self.view addSubview: choiceChampionViewController.view];
}
다음 ChoiceChampionViewController 구조화 :
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
champion = [[NSMutableArray alloc] init ];
self.navigationItem.title = @"Here is some text to make the navBar big";
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
dispatch_async(kBgQueue, ^{
NSData* data = [NSData dataWithContentsOfURL:[NSURL URLWithString:url]];
[self performSelectorOnMainThread:@selector(fetchedData:) withObject:data waitUntilDone:YES];
});
}
- (void)fetchedData:(NSData *)responseData {
Method for process data
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [champion count];
}
- (UITableViewCell *)tableView:(UITableView *)atableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
League * app = [[League alloc] init];
app = [champion objectAtIndex:[indexPath row]];
cell.textLabel.text = app.title;
return cell;
}
을하지만 날이 오류주는 유지 : [ChoiceChampionViewController있는 tableView : cellForRowAtIndexPath을 :] 해제 된 경우에 송신 메시지. 우리가 도와 줄 수 있습니까?
도 cellForRowAtIndexPath:
방법이 울부 짖는 소리 구조를 사용 .. :
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath;{
ChoiceChampionViewController * choiceChampionViewController = [[ChoiceChampionViewController alloc]initWithNibName:@"ChoiceChampionViewController" bundle:nil];
UIBarButtonItem *_backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back" style:UIBarButtonItemStyleDone target:nil action:nil];
self.navigationItem.backBarButtonItem = _backButton;
[_backButton release],
_backButton = nil;
[self.navigationController pushViewController:choiceChampionViewController animated:YES];
[choiceChampionViewController release];
}
UPDATE ... 울부 짖는 소리와 같은 새로운 UIViewController
에 이동에 대한 pushViewController
의 사용과 UITableViewController
또는 UIViewController
새로운 것을
나는 당신이 어디 있니? 그것을 확인하십시오 – IKKA
"챔피언"배열에 개체가 있는지 여부를 확인할 수 있습니까? – IKKA
ARC를 사용합니다. "챔피언"배열에는 50 개의 개체가 있습니다. – user1319267