ETFoursquareImages 1.0

ETFoursquareImages 1.0

测试已测试
语言语言 Obj-CObjective C
许可 MIT
发布最新发布2015年6月

Eugene Trapeznikov维护。




当您滚动时,图片的显示区域将会变大。就像在Foursquare应用中的地点页面一样。

example

要求

  • Xcode 5.
  • iOS 6或更高版本。
  • ARC。

使用方法

ETFoursquareImages是一个简单的带有此UIScrollView顶部图片的UIScrollView

ETFoursquareImages.hETFoursquareImages.m包含到您的项目中。

要显示ETFoursquareImages,只需像基本的UIVIewinitWithFrame那样做。

ETFoursquareImages *foursquareImages = [[ETFoursquareImages alloc] initWithFrame:CGRectMake(0, 0, 320, self.view.frame.size.height)];
[self.view addSubview:foursquareImages];

然后您应该设置图片的高度和图片数组。我建议您将图片高度设置为大约160像素。

int imagesHeight = 160;
[foursquareImages setImagesHeight:imagesHeight];
NSArray *images  = [NSArray arrayWithObjects:[UIImage imageNamed:@"horses"], [UIImage imageNamed:@"surfer"], [UIImage imageNamed:@"bridge"], nil];
[foursquareImages setImages:images];

在添加子视图或设置scrollView的内容大小时,别忘了图片的高度。

UITextView *hintTextView = [[UITextView alloc] initWithFrame:CGRectMake(0, imagesHeight+10, 320, 110)];
hintTextView.text = @"When you scroll, image's shown area will become bigger. Like it appears on place's page in Foursquare app.";
[foursquareImages.scrollView addSubview:hintTextView];

foursquareImages.scrollView.contentSize = CGSizeMake(320, 110+imagesHeight);

您可以通过以下变量来调整scroll view、页控件和图片下方的视图(bottomView)。

@property (nonatomic, strong) UIPageControl *pageControl;
@property (nonatomic) int pageControlHeight;

@property (nonatomic, strong) UIScrollView *scrollView;
@property (nonatomic, strong) UIView *bottomView;

包含示例项目。

许可

MIT许可(MIT)

版权所有 (c) 2013 Eugene Trapeznikov

根据以下条件,特此免费授予任何获得此软件和关联文档副本(“软件”)的任何人,无限制地使用软件的权利,包括但不限于使用、复制、修改、合并、发布、分发、再许可和/或销售软件副本的权利,以及允许向软件提供方提供软件的人,以执行上述操作:

上述版权声明和本许可声明应包括在软件的所有副本或主要部分中。

软件按原样提供,不提供任何形式的保证,无论是明示的、默示的或隐含的,包括但不限于适销性、特定用途适用性和非侵权性保证。在任何情况下,作者或版权所有者不对因软件或其使用或其它交易而产生的任何索赔、损害或其他责任负责,不论该索赔、损害或其他责任是基于合同、侵权或其他原因引起的。

支持 / 联系 / 错误 / 特性

我不能承诺回答关于如何使用代码的问题。

如果您想提交功能请求或错误报告,请使用此项目的GitHub问题跟踪器。或者最好fork代码并自行实现功能/修复,然后提交pull请求。

祝您愉快!

尤金·特拉佩兹尼科夫