UITableView

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
再描画(アニメーション)
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
[_tableView beginUpdates];
[_tableView deleteSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationTop];
[_tableView insertSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationTop];
[_tableView endUpdates];

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
選択行を選択状態にする
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
NSIndexPath *indexPath = self.indexPathForSelectedRow;
if (indexPath) {
    [self selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionMiddle];
}

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
セクション設定
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
// 高さ(固定)
_tableView.sectionHeaderHeight = 40;
_tableView.rowHeight = 100;

// 高さ(動的)
-(CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
   switch (section) {
       case 0:
           return 40;
       case 1:
           return 60;
       default:
           return 20;
   }
}

// タイトル設定
-(NSString*)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger) section {
   switch(section) {
       case 0:
           return @"セクション0";
       case 1:
           return @"セクション1";
       default:
           return @"セクション-";
   }
}

// 画像設定(画像以外も可能)
-(UIView*)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section {
   UIImageView* view = [[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 320, 32)] autorelease];
   switch(section) {
       case 0:
           view.image = [UIImage imageNamed:@"header01.png"];
           break;
       case 1:
           view.image = [UIImage imageNamed:@"header02.png"];
           break;
       default:
           return nil;
       }
  
   return view;
}


_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
イベント座標から行数を求める
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
- (NSIndexPath *)indexPathForControlEvent:(UIEvent *)event
{
  UITouch *touch = [[event allTouches] anyObject];
   CGPoint p = [touch locationInView:_tableView];
   NSIndexPath *indexPath = [_tableView indexPathForRowAtPoint:p];
   return indexPath;
}

// 参考
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
  ・・・
   label.userInteractionEnabled = YES;
   [label addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAction:)]];
   ・・・
}
  
- (void)tapAction:(UITapGestureRecognizer *)sender
{
  CGPoint p = [sender locationInView:_tableView];
   NSIndexPath *indexPath = [_tableView indexPathForRowAtPoint:p];
   ・・・
}


_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
アニメーションにより再描画する
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
[_tableView beginUpdates];
[_tableView deleteSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationTop];
[_tableView insertSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationTop];
[_tableView endUpdates];

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
境界線設定
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_tableView.separatorColor = [UIColor redColor];
_tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
背景変更
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
// 背景色変更(緑)
[_tableView setBackgroundColor:[UIColor greenColor]];

//  背景画像変更
UIColor* col = [[UIColor alloc] initWithPatternImage:[UIImage imageNamed:@"sample_back.jpg"]];
[self.myTableView setBackgroundColor:col];

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
特定のセルを更新する
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
// その1
NSArray *indexPaths = [NSArray arrayWithObject:indexPath];
[tableView reloadRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone];

// その2(未検証)
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
[cell setNeedsLayout];

// 可視セルのみを更新する
- (void)updateVisibleCells
{
  for (UITableViewCell *cell in [self.tableView visibleCells]){
       [self updateCell:cell atIndexPath:[self.tableView indexPathForCell:cell]];
   }
}

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
セルを取得する
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
指定セルにスクロールする
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
// 先頭の場合
if ([self tableView:tableView numberOfRowsInSection:0] > 0) {
  NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
   [tableView scrollToRowAtIndexPath:indexPath atScrollPosition:UITableViewScrollPositionTop animated:NO];
}

// 選択状態有の場合
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
[tableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionTop];

// 可視範囲の最終行にスクロールする
- (void)scrollToVisibleEnd
{
  NSArray *visibleArray = [[NSArray alloc] initWithArray:[self.tableView indexPathsForVisibleRows]];
   NSIndexPath *visibleTopIndexPath = [[NSIndexPath alloc] init];
   visibleTopIndexPath = [visibleArray objectAtIndex:0];
   int i = visibleTopIndexPath.row;
   i = i + [visibleArray count] -1;
  
   [self.tableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:i inSection:0] atScrollPosition:UITableViewScrollPositionBottom animated:YES];
}

// 最後に選択したセルの位置にスクロールさせる
[_tableView scrollToNearestSelectedRowAtScrollPosition:UITableViewScrollPositionTop animated:YES];

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
選択状態解除
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
// その1
[_tableView deselectRowAtIndexPath:[_tableView indexPathForSelectedRow] animated:YES];

// その2
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
  [tableView deselectRowAtIndexPath:indexPath animated:YES];
}

// その3
リロードするだけでもOK?


_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
スクロール同期
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
// イベント定義
#define SCROLL_NOTIFICATION @"scrollNotification"

// イベント登録
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
[center addObserver:self selector:@selector(receiveScrollNotification:) name:SCROLL_NOTIFICATION object:nil];
// イベント登録(ブロック使用の場合)
NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter];
[notificationCenter addObserverForName:SCROLL_NOTIFICATION
                                object:nil
                                 queue:nil
                            usingBlock:^(NSNotification *note) {
                                [weakSelf receiveScrollNotification];
                            }];
// イベント通知
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
  [[NSNotificationCenter defaultCenter] postNotificationName:SCROLL_NOTIFICATION object:scrollView];
}

// イベントハンドラ
- (void)receiveScrollNotification:(NSNotification *)notification
{
  UIScrollView *stockTableView = notification.object;
  
   _firstTableView.contentOffset = stockTableView.contentOffset;
   _secondTableView.contentOffset = stockTableView.contentOffset;
}

// イベント削除
- (void)dealloc
{
  [[NSNotificationCenter defaultCenter] removeObserver:self name:SCROLL_NOTIFICATION object:nil];
}

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
セクションカスタマイズ
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
CustomSectionHeader *header = [tableView dequeueReusableHeaderFooterViewWithIdentifier:NSStringFromClass([CustomSectionHeader class])];

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
セクションインデックス
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

.h

@property (strong, nonatomic) NSMutableArray *sectionIndexes;

.m
// 初期化
_sectionIndexes = [NSMutableArray array];

// データ生成このブロックを編集する
for (NSInteger i = 0; i < [_tableItems count]; i++) {
  NSString *str = [NSString stringWithFormat:@"%d", i+1];
   [_sectionIndexes addObject:str];
}

/**
*  セクションインデックス一覧を返す。
*  @param tableView 対象UITableViewインスタンス
*  @return セクションインデックス一覧
*/
- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView
{
  return _sectionIndexes;
}


/**
*  セクションインデックスをタップ時に呼ばれる。
*  @param 無し
*  @return 無し
*/
- (NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title
              atIndex:(NSInteger)index
{
  // 移動したいインデックスを指定する(通常はこのまま)
   return index;
}


_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
再選択を抑制する
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
/**
* セルを選択する直前に呼ばれる
* @param tableView 対象テーブルビュー
* @param indexPath 索引データ
* @return 選択対象となるNSIndexPath
*/
- (NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSIndexPath *selectedIndexPath = [tableView indexPathForSelectedRow];
    NSComparisonResult result = [selectedIndexPath compare:indexPath];
    if (result == NSOrderedSame) {
        return nil;
    }
    
    return indexPath;
}

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
最初の行を選択状態にする
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
if ([self tableView:_tableView numberOfRowsInSection:0] > 0) {
  NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];
   [_tableView selectRowAtIndexPath:indexPath
                                animated:NO
                          scrollPosition:UITableViewScrollPositionTop];
}

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
選択行数を取得する
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
NSIndexPath *indexPath = [tableView indexPathForSelectedRow];

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
指定行(範囲)のみを更新する
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
NSArray *indexPaths = @[indexPath];
[_tableView reloadRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone];

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
セル単位にスクロールする
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
#pragma mark UIScrollViewDelegate
/**
*  スクロール停止時に呼ばれる(ドラッグ後の惰性による停止)
*  @param scrollView UIScrollViewインスタンス
*  @return 無し
*/
- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
    [self scrollPositonByEveryCell];
}


/**
*  ドラッグ後に呼ばれる
*  @param scrollView UIScrollViewインスタンス
*  @param decelerate 減速有無(慣性が効いて動く場合、YES)
*  @return 無し
*/
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate
{
    // 加速無しの場合
    if (!decelerate) {
        [self scrollPositonByEveryCell];
    }
}


/**
*  セル単位にスクロールする
*  @param 無し
*  @return 無し
*/
- (void)scrollPositonByEveryCell
{
    UITableView *tableView = (_constructionView.isHidden)? _businessPlaceTableView: _constructionTableView;
    
    // 現在Y座標から現在のインデックスを求める
    NSInteger offsetY = tableView.contentOffset.y;
    NSIndexPath *indexPath = [tableView indexPathForRowAtPoint:CGPointMake(0, offsetY)];
    
    // 現在のインデックスの高さを求める
    CGFloat height = [self tableView:tableView heightForRowAtIndexPath:indexPath];
    
    // 現在のインデックスの標準Y座標を求める
    CGRect indexPathRect = [tableView rectForRowAtIndexPath:indexPath];
    NSInteger indexPathY = indexPathRect.origin.y;
    
    // 残り(超過分)を求める
    NSInteger remain = offsetY - indexPathY;
    
    if (remain != 0) {
        
        CGPoint point = tableView.contentOffset;
        if (remain >= height/2) {
            // 残りがセル半分以上の場合、次のセルへスクロールする
            NSInteger diff = height - remain;
            point.y += diff;
        } else {
            // 上記以外の場合、現在のセルの標準Y座標に戻る
            point.y -= remain;
        }
        
        [tableView setContentOffset:point animated:YES];
    }
}

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
NSIndexPath比較
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
NSComparisonResult result = [indexPath1 compare:indexPath2];
if (result == NSOrderedAscending) {
    NSLog(@"indexPath1はindexPath2より小さい");
} else if (result == NSOrderedDescending) {
    NSLog(@"indexPath1はindexPath2より大きい");
} else { // result == NSOrderedSame
    NSLog(@"indexPath1といndexPath2は等しい");
}

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
一番下に移動する
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
// 方法1
NSInteger section = [self.tableView numberOfSections] - 1;
NSInteger row = [self.tableView numberOfRowsInSection:section] - 1;
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:row inSection:section];
[self.tableView scrollToRowAtIndexPath:indexPath
                      atScrollPosition:UITableViewScrollPositionBottom
                              animated:YES];

// 方法2
if (self.tableView.contentSize.height > self.tableView.frame.size.height
                                        - self.tableView.contentInset.top
                                        - self.tableView.contentInset.bottom) {
   CGPoint offset = CGPointMake(0, self.tableView.contentSize.height
                                - self.tableView.frame.size.height
                                + self.tableView.contentInset.bottom);
   [self.tableView setContentOffset:offset animated:YES];

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
座標取得
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
// 先頭セルの各矩形情報を取得する
NSIndexPath *indexpath = [NSIndexPath indexPathForRow:0 inSection:0];
CGRect rectOfCellInTableView = [tableview rectForRowAtIndexPath:indexpath];
CGRect rectOfCellInSuperview = [tableview convertRect:rectOfCellInTableView toView:[tableview superview]];
CGPoint pointer = CGPointMake(rectOfCellInSuperview.size.width, rectOfCellInSuperview.size.height);

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
    NSIndexPath
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
NSIndexPath *indexPath = [NSIndexPath indexPathForRow:0 inSection:0];

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
    遷移用アニメション(見た目)
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
// 遷移用アニメション(見た目)
UITableViewRowAnimation deleteAnimation = (isTargetTab)? UITableViewRowAnimationRight: UITableViewRowAnimationLeft;
UITableViewRowAnimation insertAnimation = (isTargetTab)? UITableViewRowAnimationLeft: UITableViewRowAnimationRight;
[tableView beginUpdates];
[tableView deleteSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:deleteAnimation];
[tableView insertSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:insertAnimation];
[tableView endUpdates];

_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
    セル背景色設定(交互)
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/

/**
* セルを表示する直前に呼ばれる。
* @param tableView 対象テーブルビュー
* @param indexPath 索引データ
* @return 無し
*/
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
{
    // セルを交互に背景色を変更する
    if (indexPath.row % 2) {
        cell.backgroundColor = [UIColor colorWithRed:235/255.0 green:241/255.0 blue:252/255.0 alpha:1.0f];
    }
}


_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
    境界線を消去する(データが存在しないセルにおける)
_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/_/
_tableView.tableFooterView = [[UIView alloc] init];
_tableView.tableFooterView = UIView.new;
最終更新:2016年09月26日 10:04