제 질문은 텍스트 데이터를 가져 와서 셀이 도청 될 때 PHP의 ViewController에서 읽을 수 있습니까?UITableView - 도청했을 때 데이터를 얻습니다.
나는 이것을 할 수있는 열쇠는 didSelectRowAtIndexPath
이라고 생각하지만, 글 쓰는 방법을 모르겠습니다.
다음과 같이 PHP에서 데이터를 TableViewController
으로 가져올 수 있습니다.
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return [json count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil){
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier];
}
NSDictionary *info = [json objectAtIndex:indexPath.row];
cell.textLabel.text = [info objectForKey:@"Artist"];
cell.detailTextLabel.text = [info objectForKey:@"Song"];
return cell;
}
예 이전 방법으로 배열을 원하거나 새로운보기 컨트롤러를 호출하고 거기에 전달하려면 해당 방법으로 검색 방법을 사용하고 데이터보기 코드를 다시 작성하고 tableview를 다시로드 할 수 있습니다. – vishiphone