1、tableView使用心得
1、如果要实现footer、header随时跟着tableView滚动,就需要设定UITableViewStyleGrouped分组样式。
2、设置section的头部高度
设置self.tableView.sectionFooterHeight = 0;时,该代理方法不执行。只执行下面方法,就可以设置表头高度了
- (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 30;
}
3、设置tableView第一个表头高度,系统的CGFLOAT_MIN无限小。
CGRect frame = CGRectMake(0, 0, 0, CGFLOAT_MIN);
self.tableView.tableHeaderView = [[UIView alloc] initWithFrame:frame];
2、开关UISwitch使用心得
_myswitch = [[UISwitch alloc] init] ;
_myswitch.frame = CGRectMake(SCREEN_WIDTH - 75 , 5, 60, 30);
_myswitch.on = NO;
//设置开关圆点的风格颜色
[_myswitch setThumbTintColor:[UIColor whiteColor]] ;
//设置开启状态的风格颜色
[_myswitch setOnTintColor:[UIColor greenColor]] ;
//设置开关整体风格颜色
[_myswitch setTintColor:[UIColor grayColor]] ;
//向开关控件添加事件
[_myswitch addTarget:self action:@selector(swChange:) forControlEvents:
UIControlEventValueChanged] ;
3、多行文本 UITextView 使用
1、需要实现UITextViewDelegate代理
2、文本内容多行时,内容可以滚动:_textView.scrollEnabled = YES;