コンパイル時に別の関数から呼び出す必要があるUITableView
デリゲートメソッドが必要です...私が使用できるデフォルトのUITableView
デリゲートメソッドはありますか?そうでない場合は、既存のものに加えて追加の代理メソッドを追加する方法についてコメントしてください。このメソッドが存在する場合には、事前UITableViewデリゲートメソッド
18
A
答えて
39
あなたがいずれかの方法でUITableview
委任を設定していることを確認します - NIB
またはprogramatially
からペン先からNIB を使用する: -
プログラムにより: -
その後、 : -
-(void)viewWillAppear:(BOOL)animated
{
tblService.delegate=self;
tblService.dataSource=self;
[super viewWillAppear:YES];
}
使用以下の代表者:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1; //count of section
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [catagorry count]; //count number of row from counting array hear cataGorry is An Array
}
- (UITableViewCell *)tableView:(UITableView *)tableView
cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *MyIdentifier = @"MyIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil)
{
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:MyIdentifier] autorelease];
}
// Here we use the provided setImageWithURL: method to load the web image
// Ensure you use a placeholder image otherwise cells will be initialized with no image
[cell.imageView setImageWithURL:[NSURL URLWithString:@"http://example.com/image.jpg"]
placeholderImage:[UIImage imageNamed:@"placeholder"]];
cell.textLabel.text = @"My Text";
return cell;
}
Below use for set height of cell
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 80;
}
Below use for gatting particular cells data by selecting row this method called
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
Yourstring=[catagorry objectAtIndex:indexPath.row];
//Pushing next view
cntrSecondViewController *cntrinnerService = [[cntrSecondViewController alloc] initWithNibName:@"cntrSecondViewController" bundle:nil];
[self.navigationController pushViewController:cntrinnerService animated:YES];
}
+0
http://stackoverflow.com/questions/5831813/delegate-and-datasource-methods-for-uitableview/42105964#42105964 –
4
で
おかげで、私は知りませんが、あなたがUITableView
デリゲート内の他の方法が必要な場合は、UITableViewDelegate
の新しいカテゴリを作成することができます。
関連する問題
- 1. なぜUITableViewはUIScrollViewのデリゲートメソッドを呼び出しますか?
- 2. UITableViewデリゲートメソッドが呼び出されていない
- 3. 次デリゲートメソッドを使用しています、私はUIViewController..IでのUITableViewで働いているのuitableビューのデリゲートメソッド
- 4. UITableViewデリゲートメソッドがuiSplitViewのマスタービュー用に呼び出されていません
- 5. デリゲートメソッドobjective-c
- 6. 遅延NSFetchedResultsControllerデリゲートメソッド
- 7. CMMotionManagerのデリゲートメソッド
- 8. デリゲートメソッド - 私は
- 9. NSURLConnectionのデリゲートメソッド
- 10. オプションのデリゲートメソッドに
- 11. respondsToSelector(任意のデリゲートメソッド)
- 12. マイアプリのバックグラウンドのデリゲートメソッド
- 13. TabBarデリゲートメソッドを使用する
- 14. CLLocationManagerは、任意のデリゲートメソッド
- 15. Eclipseでのラッパー実装(デリゲートメソッド)
- 16. デリゲートメソッドの作成方法
- 17. アプリケーションの削除時にデリゲートメソッド
- 18. iPhone - UIToolbar - デリゲートメソッド/通知/ KVC
- 19. 目的C:didFinishPLayingデリゲートメソッドの誤解
- 20. デリゲートメソッドを呼び出す
- 21. デリゲートメソッドからセグを実行
- 22. iOS FBRequestの成功デリゲートメソッド
- 23. Objective-Cデリゲートメソッドが別のクラス内にあるクラスからデリゲートメソッドを呼び出す
- 24. 別のクラスのデリゲートメソッドを呼び出す
- 25. デリゲートメソッドが呼び出されない
- 26. セットデリゲートオブジェクトのデリゲートメソッドが応答しない
- 27. コードのクラスのデリゲートメソッドを呼び出す
- 28. デリゲートメソッドがアクセスされていません
- 29. セル上の指スワイプでのデリゲートメソッド
- 30. UISplitViewControllerデリゲートメソッドのUIButtonBarItemsとUIPopovercontrollerの参照
uは別の関数からのtableViewをリフレッシュする必要がありますか? – AppleDelegate
なぜデリゲートメソッドを作成したいですか?代わりに、関数の完了後にすべてのテーブルデータをリロードすることができます –
問題についての詳細と達成したいことを提供してください。 – Kassem