適切なプロトコルを備えた MainWindowViewController があります。また、MainWindowViewController に実装された dataSouce メソッドもあります。
@interface MainWindowController : UIViewController < UITableViewDelegate, UITableViewDataSource, UAModalPanelDelegate, UIGestureRecognizerDelegate>
MainWindowViewController にデリゲートとデータソースを設定しましたviewDidLoad
。
self.friendsTableView.delegate = self;
self.friendsTableView.dataSource = self;
何が起こるかというと、友達ボタンを押すことです。FriendsPopUpView_iPhone という名前の xib ファイルが読み込まれ、複数UITableView
の友達が表示されます。しかし、friendsPopUpView のテーブルビューには空の行が表示されます。私は何を間違っていますか?
FriendsPopUpView_iPhone.xib にはUITableView
. friendsTableView は、FriendsPopUpView_iPhone.xib で作成された tableview からのアウトレットです。friendsPopUpView は、UIView
FriendsPopUpView_iPhone.xib のビューのアウトレットです。メインの MainWindowController のフレンド ボタンに接続されたアクションを次に示します。
- (IBAction)on_friends:(id)sender {
if (self.friendsPopUpView == nil) {
[[NSBundle mainBundle] loadNibNamed:@"FriendsPopUpView_iPhone" owner:self options:nil];
[self.view addSubview:self.friendsPopUpView];
UIButton* clickedButton = (UIButton*) sender;
CGRect sFrame = CGRectMake(clickedButton.frame.origin.x-100, clickedButton.frame.origin.y,
self.friendsPopUpView.frame.size.width,
self.friendsPopUpView.frame.size.height);
self.friendsPopUpView.frame = sFrame;
}
}