2013-10-08 122 views
0
- (void)viewDidLoad 
{ 
[super viewDidLoad]; 
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7) { 
    //  self.view.frame=CGRectMake(0,20,self.view.frame.size.width,self.view.frame.size.height-20); 
    self.headerView.frame=CGRectMake(0,20,320,45); 

} 

的位置,但headerview不會改變任何一個可以幫助簡單的方法來改變的UIView

+0

也許是因爲在這一點上self.headerView是零? – johnyu

+0

您是否以編程方式創建標題視圖? – Ganapathy

回答

0
-(void)viewDidLoad 
    { 
     // ... 
     UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(XXX, YYY, XXX, YYY)]; 
     UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(XXX, YYY, XXX, YYY)]; 
     [headerView addSubview:imageView]; 
     UILabel *labelView = [[UILabel alloc] initWithFrame:CGRectMake(XXX, YYY, XXX, YYY)]; 
     [headerView addSubview:labelView]; 
     self.tableView.tableHeaderView = headerView; 

     // ... 
    } 
相關問題