私のView Controllerでは、 TableView を追加しました。file.h と file.m にすべてのデリゲートを入力しました。ストーリーボードにもセルの識別が正しく入力されており、作成したセル ch カスタム クラスにカスタム セルが接続されました。
今、私はこのコード (Parse.com を使用) を入れてもエラーは発生しません。コードは常に非常にクリーンですが、Run を実行すると、セルに接続されているかのように、テーブルにデータが表示されません。または、再利用識別子がなかった場合はカスタム クラスとして、代わりに両方の手順が行われました...なぜ何も表示されないのかわかりません...何がエラーなのか分かりますか?
# import " FFFriendInAttesa.h "
# import " FFCustomCellFriendInAttesa.h "
@ interface FFFriendInAttesa ()
@ end
@ implementation FFFriendInAttesa
- (Void) viewDidLoad
{
[super viewDidLoad ] ;
self.FFTableView.delegate = self ;
self.FFTableView.dataSource = self ;
[self QueryForTableView ] ;
}
- ( NSInteger ) numberOfSectionsInTableView : ( UITableView * ) tableView
{
return 1;
}
- ( NSInteger ) tableView : ( UITableView * ) tableView numberOfRowsInSection : ( NSInteger ) section {
return [ self.UtentiInAttesa count] ;
}
- (void) { QueryForTableView
PFQuery QueryForUserClass * = [ PFUser query ] ;
[ QueryForUserClass findObjectsInBackgroundWithBlock : ^ ( NSArray * objects , NSError * error ) {
if ( error) {
self.UtentiInAttesa = objects ;
NSLog ( @ " start query : % @ " , self.UtentiInAttesa ) ;
}
} ] ;
[ self.FFTableView reloadData ] ;
}
- ( UITableViewCell * ) tableView : ( UITableView * ) tableView cellForRowAtIndexPath : ( NSIndexPath * ) indexPath
{
static NSString * CellIdentifier = @ " CellaAmici " ;
FFCustomCellFriendInAttesa * cell = [ self.FFTableView dequeueReusableCellWithIdentifier : CellIdentifier forIndexPath : indexPath ] ;
if ( cell) {
cell = [ [ FFCustomCellFriendInAttesa alloc ] initWithStyle : UITableViewCellStyleDefault reuseIdentifier : @ " CellaAmici "] ;
}
PFObject * user = [ self.UtentiInAttesa objectAtIndex : indexPath.row ] ;
cell.FFNomeFriendLabel.text = [user objectForKey : FF_USER_NOMECOGNOME ] ;
return cell ;
}
@ end
File.h
#import <UIKit/UIKit.h>
#import <Parse/Parse.h>
@interface FFFriendInAttesa : UIViewController <UITableViewDataSource, UITableViewDelegate>
@property (strong, nonatomic) IBOutlet UITableView *FFTableView;
@property (strong, nonatomic) NSArray *UtentiInAttesa;
@end