TGFoursquareLocationDetail 1.0.1

TGFoursquareLocationDetail 1.0.1

测试已测试
语言语言 Obj-CObjective C
许可证 MIT
发布最新发布2014年12月

Thibault Guégan 维护。



  • 作者
  • Thibault Guégan

TGFoursquareLocationDetail-Demo

Foursquare 最近发布了其应用的新版本,利用了 iOS 7 的新特性。这个 iOS 项目重现了 Foursquare 在展示位置详情时的设计和行为。

该项目并没有提供所有功能,但主要部分都是可用的。你们当然可以邀请使用、分支和改进此项目,使用你自己的知识。

行为

当您滚动时,显示图像的区域会变大,就像它在 Foursquare 应用中的位置详情页面上出现的那样。同时,当您滚动 UITableView 时,标题将自动出现。相反,如果您向下滚动,它将淡出。

使用方法

将 TGFoursquareLocationDetail 文件夹导入到您的项目中,然后在您的控制器中设置 TGFoursquareLocationDetail 对象

- (void)viewDidLoad
{
    [super viewDidLoad];

    self.locationDetail = [[TGFoursquareLocationDetail alloc] initWithFrame:self.view.bounds];
    self.locationDetail.tableViewDataSource = self;
    self.locationDetail.tableViewDelegate = self;

    self.locationDetail.delegate = self;
    self.locationDetail.parallaxScrollFactor = 0.3; // little slower than normal.

    [self.view addSubview:self.locationDetail];

    [self.navigationController setNavigationBarHidden:YES animated:YES];

    [self.view bringSubviewToFront:_headerView];

    UIButton *buttonBack = [UIButton buttonWithType:UIButtonTypeCustom];
    buttonBack.frame = CGRectMake(10, 22, 44, 44);
    [buttonBack setImage:[UIImage imageNamed:@"btn_back"] forState:UIControlStateNormal];
    [buttonBack addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:buttonBack];

    UIButton *buttonPost = [UIButton buttonWithType:UIButtonTypeCustom];
    buttonPost.frame = CGRectMake(self.view.bounds.size.width - 44, 18, 44, 44);
    [buttonPost setImage:[UIImage imageNamed:@"btn_post"] forState:UIControlStateNormal];
    [buttonPost addTarget:self action:@selector(post) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:buttonPost];

    self.locationDetail.headerView = _headerView;
}

屏幕截图

1

2

待办事项或建议

改善图像翻页器的滚动行为,目前它仅基于 UISwipeLeftGestureRecognizer 或 UISwipeRightGestureRecognizer。

致谢

关于图片,我受到了 kimar 和他的项目 KIImagePager 的帮助: https://github.com/kimar/KIImagePager

使用本项目,请随意。

您可以在 Github 或 Linkedln 上关注我: http://www.linkedin.com/pub/thibault-gu%C3%A9gan/27/399/607