tableview使用詳細

729 ワード

iOS終了sectionHeaderフローティング方法
1.カスタムヘッダーに2つのプロパティを追加
@property (nonatomic, assign) NSUInteger section;
@property (nonatomic, weak) UITableView *tableView;

2.setFrameメソッドの書き換え
- (void)setFrame:(CGRect)frame{

  CGRect sectionRect = [self.tableView rectForSection:self.section];
  CGRect newFrame = CGRectMake(CGRectGetMinX(frame);  
  CGRectGetMinY(sectionRect), CGRectGetWidth(frame);     
  CGRectGetHeight(frame));
   [super setFrame:newFrame];

} 

2.tableViewを作成行にスライドさせる
[self.tableViewscrollToRowAtIndexPath:[NSIndexPathindexPathForRow:_songlist.songArray.count-1 inSection:0]atScrollPosition:UITableViewScrollPositionBottomanimated:YES];