私は配列を解析して別の文字列に分割しようとしていました。私は文字列を設定するときに固定objectAtIndex
を個別に追加することによって、この作業を成功させることができました。テーブルビューから個々の文字列に配列を解析する - Objective-C
例:しかし
NSString *weightString = [[[results valueForKey:@"Endurance"] objectAtIndex:7]objectAtIndex:2];
、私は試してみて、どんなobjectAtIndex
文字列を使用してのtableView didSelectRowAtIndexPath
内の文字列を設定し、常にnullを返します。 objectAtIndex:indexPath.row
を使用してtableView行をクリックする必要があります。私はどこに間違っているのか分からない。お気軽にもっとコードやクエリをリクエストしてください。
問合せ:
PFQuery *arrayQuery = [PFQuery queryWithClassName:@"Exercises"];
[arrayQuery selectKeys:@[@"Endurance"]];
[arrayQuery orderByAscending:@"ExerciseName"];
[arrayQuery findObjectsInBackgroundWithBlock:^(NSArray *results, NSError *error) {
if (!error) { self.arrayResults = [results valueForKey:@"Endurance"];
cellForRowAtIndexPath:
- (TableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"list";
TableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier];
UILabel *cellTitle;
cell.cellTitle.text = [[browseAllArray objectAtIndex: indexPath.row] objectForKey:@"ExerciseName"];
if (cell == nil) {
cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
cell = [[TableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
//Exercise Bar Label
cellTitle = [[UILabel alloc] initWithFrame:CGRectMake(80, 20, 220, 60)];
cellTitle.font = [UIFont fontWithName:@"ethnocentric" size:14];
cellTitle.textColor = [UIColor blackColor];
cellTitle.numberOfLines = 2;
cellTitle.textAlignment = NSTextAlignmentCenter;
cell.cellTitle.text = [[browseAllArray objectAtIndex: indexPath.row] objectForKey:@"ExerciseName"];
[self.tableView reloadData];
}
cellTitle.text = [[browseAllArray objectAtIndex:indexPath.row]objectForKey:@"ExerciseName"];
return cell;
は、cellForRowAtIndexメソッドを共有します。 –
'result'と' tableView:cellForRowAtIndexPath: ' – Larme
を表示します。私のcellForRowAtIndexPathメソッドには、セルをデザインするコードだけが含まれています。私のデータベースから、関連するセルに対応する情報を解析しようとしています。あなたはまだそれを必要としますか?もしそうなら私はそれを送るでしょう。 – HJDavies