首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

增添textField到tableviewheader

2013-03-01 
添加textField到tableviewheader- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSectio

添加textField到tableviewheader

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{return 30.0;}    -(UIView*) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{    UIView *tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(40, 0, self.view.frame.size.width - 70, 30)];    tableHeaderView.backgroundColor =[UIColor grayColor];    UITextField *sectionTitleTF1 = [[UITextField alloc] initWithFrame:CGRectMake(58, 0, 500, 30)];    sectionTitleTF1.backgroundColor = [UIColor whiteColor];    [sectionTitleTF1 setBackgroundColor:[UIColor whiteColor]];    [sectionTitleTF1 setFont:[UIFont boldSystemFontOfSize:15]];    [sectionTitleTF1 setBorderStyle:UITextBorderStyleLine];    [sectionTitleTF1 setTextAlignment:UITextAlignmentCenter];    [sectionTitleTF1 setKeyboardType:UIKeyboardTypeNumbersAndPunctuation];    [sectionTitleTF1 becomeFirstResponder];    [tableHeaderView addSubview:sectionTitleTF1];    return tableHeaderView;    }

热点排行