ナビゲーション ビュー コントローラー内に埋め込んだ HomeViewController というタイトルのビューがあります。ビュー内で、テーブル ビューをドラッグし、IBOutlet を使用してリンクしました。APParallaxHeaderライブラリから必要なコードを追加し、 cocoapodsを使用してプロジェクトにインポートしました。
ただし、現在、画像の表示に問題があります。スペースが作成されても、実際の画像は表示されません。どんな助けでも大歓迎です!
これは私の .h/.m ファイルがどのように見えるかです:
.h
#import <UIKit/UIKit.h>
#import "UIScrollView+APParallaxHeader.h"
@interface HomeViewController : UIViewController <UITableViewDelegate, UITableViewDataSource> {
NSArray *menu;
IBOutlet UITableView *menuTableView;
}
@property (nonatomic, strong) IBOutlet UITableView *menuTableView;
@end
.m
#import "HomeViewController.h"
@interface HomeViewController ()
@end
@implementation HomeViewController
@synthesize menuTableView;
- (void)viewDidLoad
{
[super viewDidLoad];
menu = [NSArray arrayWithObjects: @"1", @"2,", @"3", @"4", @"5", @"6", nil];
[self.menuTableView addParallaxWithImage:[UIImage imageNamed:@"ParallaxImage.jpg"] andHeight:160];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [menu count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"MenuCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
}
cell.textLabel.text = [menu objectAtIndex:indexPath.row];
return cell;
}