2011-09-24 119 views

回答

0

以下是UITextFieldUIButton的文檔。您也許會發現UISearchBar有用,它包含文本字段和按鈕。

將您的意見添加到表視圖的標題視圖。

0

您有一個表代表tableview:cellForRowAtIndexPath。在這個委託中添加下面的代碼。

//Suppose you want to add textfield and button at the first row 
if(indexPath.Row == 0) 
{ 
     UITextField *txtSearch = [UITextField alloc] initWithFrame:CGRectMake(0,0,150,35)]; 
     UIButton *btnSearch = [UIButton buttonWithType:UIButtoTypeCustom]; 
     btnSearch.frame = CGRectMake(160,0,50,35); 

     [[cell contentView] addSubView:txtSearch]; 
     [[cell contentView] addSubView:btnSearch]; 
} 

,你也可以像

[btnSearch addTarget:self action:@selector(eventName) forControlEvents:UIControlEventTouchUpInside]; 

感謝

相關問題