私は2カスタムtableViewsを作成テーブルビューでheaderVIewを表示することはできません。は、私はこのコードを使用する場合、正しく
UITableView *mainTableView=[[MainTableView alloc]init];
self.view=mainTableView;
このコードは正しい表示を示しています。私のheaderViewには何が起こったのですか?
UPDATE:MainTableView.m
+(instancetype)createMainView
{
return [[self alloc]init];
}
-(instancetype)initWithFrame:(CGRect)frame
{
self=[super initWithFrame:frame];
[self addmainTableView];
[self addHeadImageViewAndPageControl];
[self addTitleLabelAndNavigationButton];
return self;
}
#pragma mark -add view to main view
-(void)addHeadImageViewAndPageControl
{
UIScrollView *headImageView=[[UIScrollView alloc]init];
headImageView.frame=CGRectMake(0, 0, yScreenWidth, yScreenHeight/3);
headImageView.backgroundColor=[UIColor redColor];
self.tableHeaderView=headImageView;
//add pagecontroll
UIPageControl *headPageControl=[[UIPageControl alloc]initWithFrame:CGRectMake(-100, yScreenHeight/3-30, yScreenWidth/3, 25)];
headPageControl.numberOfPages=5;
headPageControl.pageIndicatorTintColor=[UIColor lightGrayColor];
headPageControl.currentPageIndicatorTintColor=[UIColor whiteColor];
headPageControl.currentPage=1;
[self.tableHeaderView addSubview:headPageControl];
}
は、これが私のheaderViewです。
?投稿したコードは、ヘッダービューを作成または表示しようとしません。 – rmaddy
詳細を提供するbuddy @rmaddyが正しいです。 – sanman