WXHL学习文章连载 十四

来源:互联网 发布:台湾进口知乎 编辑:程序博客网 时间:2024/05/22 02:10
项目二已经进行了四天,第一天搭建基本框架,第二天,微博主题的切换,第三、四天,微博首页布局、以及数据请求,第五天,实现下拉刷新,上拉加载更多功能,期间了解了更多的第三方框架,整合到项目中。





   

    //禁止视图控制器调整滑动视图的insets

    self.automaticallyAdjustsScrollViewInsets = NO;

    

    __weak LCHomeViewController *weakSelf = self;

    

    //下拉刷新

    [self.homeTableView addPullToRefreshWithActionHandler:^{

        __strong LCHomeViewController *strongSelf = weakSelf;

        

        [strongSelf loadNewData];

    }];

    

    //上拉刷新

    [self.homeTableView addInfiniteScrollingWithActionHandler:^{

        

        __strong LCHomeViewController *strongSelf = weakSelf;

        

        [strongSelf loadOldData];


   

        //读取已经保存的主题

        NSString *savedTheme = [[NSUserDefaults standardUserDefaultsobjectForKey:SavedTheme];

        

        if (savedTheme == nil) {

            //默认主题名字

            _themeName = @"猫爷";

        }else{

        

            _themeName = savedTheme;

        }

        

       //配置文件

        _themeConfig = [NSDictionary dictionaryWithContentsOfFile:[[NSBundle mainBundlepathForResource:@"theme"ofType:@"plist"]];

        

    }


    return self;

0 0