2014-02-06 39 views
-1

我有以下問題 我有在主視圖中的一個按鈕,如果我是點擊該按鈕在主視圖的tableview 這裏添加子視圖是代碼如何製作UITableview的確切高度?

FNsettingsViewController *fnsettings = [[FNsettingsViewController alloc]initWithNibName:@"FNsettingsViewController" bundle:nil]; 
fnsettings.delegate=self; 
[fnsettings.view setFrame:CGRectMake(0, 30, self.view.frame.size.width,250)]; 
[self.view addSubview:fnsettings.view]; 

後,我按一下按鈕獲得子視圖爲tableview,但其餘部分有空白。

然後如何刪除剩餘的空格。

請任何人知道幫助我。

+1

組'fnsettings.backgroundColor = [的UIColor clearColor];' – Akhilrajtr

回答

-2

嗨,你可以嘗試以下一個

//You can manage the height of a table view using this method. 
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath  *)indexPath 
{ 

// Return the height of the row what ever you want Like:below. 
return 50; 
} 

感謝

0

前值分配給泰伯維你會知道細胞計數嗎?的嘗試我的代碼:

float height=[arrayTableValues count]*height of your single cell; 
tableview.frame=CGRectMake(0,30,self.view.frame.size.width,height);