zoukankan      html  css  js  c++  java
  • v2ex 下拉刷新模块


    https://github.com/singro/SCPullRefresh


    self.tableHeaderView = [[UIView alloc] initWithFrame:(CGRect){0, 0, kScreenWidth, 0}];


    关于viewDidLoad 和 loadView

    http://stackoverflow.com/questions/573958/iphone-sdk-what-is-the-difference-between-loadview-and-viewdidload


    导航+UITableView,在push,back回来之后,当前cell仍然是选中的状态。
    当然,解决办法简单,添加一句[tableView deselectRowAtIndexPath:indexPath animated:YES]即可。
    令人纠结的时,在没加这句的时候,有的视图同样回来之后,选中状态消失,为什么会出现这种情况呢?
    原来是,如果UITableView是在UITableViewController中时,就会默认取消,而如果是在UIViewController时,需要添加这一句,不过有时即使前者也需要添加,那是因为在视图加载时有其它功能代码,具体情况各异。所以后者必须加,前者可能需要加。

    - (void)viewWillAppear:(BOOL)animated {
        [super viewWillAppear:animated];
        
        [self.tableView deselectRowAtIndexPath:self.tableView.indexPathForSelectedRow animated:YES];
        
    }


    为什么要delegate = nil

     http://stackoverflow.com/questions/15016348/set-delegates-to-nil-under-arc

    - (void)dealloc {
        
        self.tableView.delegate = nil;
        self.tableView.dataSource = nil;
        
        [[NSNotificationCenter defaultCenter] removeObserver:self];
        
    }


    - (void)viewWillLayoutSubviews {
        
        [super viewWillLayoutSubviews];
        
        self.tableView.scrollIndicatorInsets = UIEdgeInsetsMake(self.tableViewInsertTop, 0, self.tableViewInsertBottom, 0);
        NSLog(@"%s",__func__);
        
    }
    2015-08-26 12:20:32.298 SCPullRefresh[79798:1946898] -[SCPullRefreshViewController viewWillLayoutSubviews]
    2015-08-26 12:20:32.306 SCPullRefresh[79798:1946898] -[SCPullRefreshViewController viewWillLayoutSubviews]

    调用了两次。


     指定滚动条在scrollerView中的位置

    http://www.cnblogs.com/woainilsr/archive/2012/03/28/2421881.html

    self.tableView.scrollIndicatorInsets = UIEdgeInsetsMake(self.tableViewInsertTop, 0, self.tableViewInsertBottom, 0);
    UIEdgeInsetsMake 逆时钟,上左下右

    @property (nonatomic, copy) void (^loadMoreBlock)();


    
    
    
    
    
    
    
    
    
    
     
  • 相关阅读:
    一维数组的 K-Means 聚类算法理解
    c#计算2个字符串的相似度
    一个人开发的html整站源码分享网站就这么上线了
    html页面显示服务器时间
    禁用浏览器自动填充表单解决办法
    布隆过滤器
    (转)二进制与三进制趣题
    随机算法_模拟退火算法
    NAT穿越
    (转)为什么所有浏览器的userAgent都带Mozilla
  • 原文地址:https://www.cnblogs.com/pencilCool/p/4759227.html
Copyright © 2011-2022 走看看