1.关于uitableview只设置了头部和底部高度的问题,没有设置对于的view,会出现两个Sections间距变大的问题
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{return 2;}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{return 2;}
解决方法
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{return nil;}
- (UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{return nil;}
2.关于leftbarbuttonitem和rightbarbuttonitem如果是uibutton就会变大的问题,解决方法是把uibutton放进一个containVew。
UIButton * RightBarButton = [UIButton buttonWithType:UIButtonTypeCustom];
RightBarButton.frame = AutoRect(0, 0, 21, 19);
[RightBarButton addTarget:self action:@selector(RightBarButtonAction) forControlEvents:UIControlEventTouchUpInside];
UIView *containVew = [[UIView alloc] initWithFrame:RightBarButton.bounds];
[containVew addSubview:RightBarButton];
UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithCustomView:containVew];
self.navigationItem.rightBarButtonItem = [NSArray arrayWithObjects:backItem, nil];
3.键盘上添加的UIToolbar无法点击问题,解决方式,把按钮赋给为UIToolBar添加UIBarButtonItem
1、创建一个数组itemsArray;
2、数组上添加UIBarButtonItem;
3、将itemsArray传给UIToolBar:self.toolbarItems = itemsArray。
注意:要平均排版就需要添加空格space。
UIButton *doneButton = [[UIButton alloc]initWithFrame:CGRectMake(236, 3, 74, 38)];
[doneButton setImage:[UIImage imageWithContentsOfFile:[CSIILibBundle getFileWithName:@"done.png"]] forState:UIControlStateNormal];
[doneButton addTarget:self action:@selector(hiddenKeyboardAction:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem * btnSpace = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:self action:nil];
UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc]initWithCustomView:doneButton];
NSArray * buttonsArray = [NSArray arrayWithObjects:btnSpace,doneBtn,nil];
[self setItems:buttonsArray];