//
//  UITableView+gmsafekit.m
//  OJAKitDemo
//
//  Created by luxiaoming on 2016/12/22.
//  Copyright © 2016年 luxiaoming. All rights reserved.
//

#import "UITableView+gmsafekit.h"

@implementation UITableView (gmsafekit)

- (void)safeScrollToRowAtIndexPath:(NSIndexPath *)indexPath atScrollPosition:(UITableViewScrollPosition)scrollPosition animated:(BOOL)animated {
    
    [self reloadData];
    dispatch_async(dispatch_get_main_queue(), ^{
        if (indexPath.section >= [self numberOfSections] || indexPath.section < 0) return;
        if (indexPath.row >= [self numberOfRowsInSection:indexPath.section] || indexPath.row < 0) return;
        [self scrollToRowAtIndexPath:indexPath atScrollPosition:scrollPosition animated:animated];
    });
    
}

@end
