0

didSelectRowAtIndexPath が機能していません。
2 つのデリゲートを構成しましたか。すべてがリンクされています(テーブルビュー、テーブルビューセル)。
すでに削除され、再度実行されました。
ここですべてを検索しましたが、何も機能しませんでした。これは最高のリンク
の 1 つだったと思いますが、まだ役に立ちません。

私の最後の希望は、このテーブルビューがあるViewControllerをモーダル用に開いていることです。しかし、それは非常に間違った問題です。

それ以外に、私はいくつかの助けが必要です

Somo コード .H

@interface simulator : UIViewController <UITableViewDelegate, UITableViewDataSource, UIScrollViewDelegate>
{
   NSArray                                          *array_products;
}
@property (nonatomic, strong) NSDictionary          *plist_products;
@property (nonatomic, strong) IBOutlet UITableView  *table_menu_left;
@property (nonatomic, strong) NSString              *file_plist;

@end

いくつかのコード.M

#import "cel_products.h"

- (void)viewDidLoad
{
   NSString *path_root      = [[NSBundle mainBundle] bundlePath];
   NSString *full_path      = [path_root stringByAppendingPathComponent:self.file_plist];
   self.plist_products      = [[NSDictionary alloc] initWithContentsOfFile:full_path];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
   static NSString *CellIdentifier = @"id_cell_products";
   UITableViewCell *cell           = [self.table_menu_left dequeueReusableCellWithIdentifier:CellIdentifier];

   array_products                  = [self.plist_produtcs allKeys];
   if (cell == nil)
   {
       NSArray *topLevelObjects    = [[NSBundle mainBundle] loadNibNamed:@"cel_products" owner:self options:nil];

       for(id currentObject in topLevelObjects)
       {
           if([currentObject isKindOfClass:[cel_products class]])
           {
               cell = (cel_products *)currentObject;
               break;
           }
       }
   }
   cell.textLabel.text       = [array_products objectAtIndex:indexPath.row];
   return cell;
}

// numberofrowsinsection - OK
// numberofsectionintableviw - OK

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
   NSLog(@"Hein?????");
   // Nothing..........
}
4

2 に答える 2

4

私は謙虚にすべての人に謝罪します!うっかり属性インスペクタ > 選択をクリックしてしまいました: NO SELECTION

したがって、コードには何も見つかりません。

繰り返しますが、すべての人に申し訳ありませんが、誰かがこの問題を抱えている場合は、これを確認するためのもう 1 つのステップです。" Attributes Inspector> Selection に変更: SINGLE SELECTION または MULTIPLE SELECTION (あなた次第です)

答えと助けをありがとう

于 2012-08-28T14:22:09.353 に答える
1

で休憩を取りましたdidSelectRowAtIndexPathか?そこで正常に壊れるかどうか試してみてください。

rokjarkの回答を拡張すると、デリゲートとデータ ソースを問題のファイルに手動で設定する必要があります。

ヘッダー ファイルは、 SOME UITableViewデリゲート/データ ソースsimulator.hとして宣言するだけです。

すべてのコールバックを処理するには、デリゲートファイルとしてtable_menu_left使用するように指定する必要があります。simulator.h

設定:

self.table_menu_left.delegate = self;
self.table_menu_left.datasource = self;

そして再びブレークインdidSelectRowAtIndexPathを設定し、それが呼び出されるかどうかを確認します。

于 2012-08-27T22:13:35.463 に答える