DevStore首页 > DEV资源 > 源码下载 > 源码详情

模仿网易新闻的主页框架,左右滑动

 
limingli | 2014-09-06 21:08    浏览量(3848)    评论(1)    收藏(2)
功能分类:特效 支持平台:iOS 运行环境:iOS
开发语言:Object-c 开发工具:Xcode 源码大小:7.75MB
下载源码 269 人下载

源码简介

模仿网易新闻的主页框架,左右滑动(带缩放功能),左右滑动主页里面的TableView支持滑动最左边或者右边触发Drawer Left Drawer Right的动画效果。

源码截图

  • 运行截图
DevStore所有源码来自用户上传分享,版权问题及牵扯到商业纠纷均与DevStore无关。

源码片段

XHDrawerController *drawerController = [[XHDrawerController alloc] init];
    drawerController.springAnimationOn = YES;
    
    XHExampleLeftSideDrawerViewController *leftSideDrawerViewController = [[XHExampleLeftSideDrawerViewController alloc] init];
    
    XHExampleRightSideDrawerViewController *rightSideDrawerViewController = [[XHExampleRightSideDrawerViewController alloc] init];
    
    XHExampleCenterSideDrawerViewController *centerSideDrawerViewController = [[XHExampleCenterSideDrawerViewController alloc] init];

    drawerController.leftViewController = leftSideDrawerViewController;
    drawerController.rightViewController = rightSideDrawerViewController;
    drawerController.centerViewController = [[UINavigationController alloc] initWithRootViewController:centerSideDrawerViewController];
    
    UIImageView *backgroundImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"MenuBackground"]];
    [backgroundImageView setContentMode:UIViewContentModeCenter];
drawerController.backgroundView = backgroundImageView;
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [[self dataSource] count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *cellIdentifier = @"cellIdentifier";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
    }
    [cell setBackgroundColor:[UIColor clearColor]];
    [[cell textLabel] setTextColor:[UIColor whiteColor]];
    [[cell textLabel] setText:[self dataSource][[indexPath row]]];
    [cell setSelectedBackgroundView:[UIView new]];
    [[cell textLabel] setHighlightedTextColor:[UIColor purpleColor]];
    return cell;
}

#pragma mark - UITableViewDelegate Methods

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    
    XHExampleCenterSideDrawerViewController *centerViewController = [[XHExampleCenterSideDrawerViewController alloc] init];
    [[centerViewController navigationItem] setTitle:[self dataSource][[indexPath row]]];
    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:centerViewController];
    self.drawerController.centerViewController = navigationController;
    [self.drawerController closeDrawerAnimated:YES completion:^(BOOL finished) {
        
    }];
}
  •   赞(2) 赞 +1 赞(2) 已赞
  •   收藏(2) 收藏 +1 已收藏 取消
  •   下载(269)
评论(1)
souapp

souapp 2014-09-28 10:02:51

下载了,谢谢了
回复(0) 赞(0) 赞(1)
  • 推荐
  • 审核
  • 收录
  • 获取活力值

源码上传作者

  • 22 能力值
  • 10 源码
  • 0 评测
  • 0 资料

热门源码