iOS滾動視圖:MMScrollPresenter

jopen 10年前發布 | 13K 次閱讀 iOS開發 移動開發 MMScrollPresenter

MMScrollPresenter是一款很容易使用的滾動視圖,支持各種自定義。視圖可以設置標題和描述。在StoryBoard中使用也很方便。

Example Usage

  1. Download the repo and include MMScrollPresenter.h/.m, MMScrollPage.h/.m, arrow/@2x.png in your app
  2. Drag and drop a UIScrollView into your Interface Builder and under the custom class section, subclass your UIScrollView to MMScrollPresenter
  3. Now add: @property (weak, nonatomic) IBOutlet MMScrollPresenter *mmScrollPresenter; to your list of properties and dont forget to link it up in your Interface Builder
  4. Add a MMScrollPage to the MMScrollPresenter

Here is a code snippet from the example app in the - (void)viewDidLoad method for #4:

UIImageView *mountainImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"mountains.jpg"]];
[mountainImage setFrame:CGRectMake(0, 0, self.mmScrollPresenter.frame.size.width, self.mmScrollPresenter.frame.size.height)];

MMScrollPage *firstPage = [[MMScrollPage alloc] init];
firstPage.titleLabel.text = @"Look a picture of mountains";
firstPage.detailLabel.text = @"I'm the detail text";
[firstPage.backgroundView addSubview:mountainImage];
firstPage.titleBackgroundColor = [UIColor colorWithRed:119/255.0f green:92/255.0f blue:166/255.0f alpha:0.5];

[self.mmScrollPresenter setupViewsWithArray:@[firstPage]];

iOS滾動視圖:MMScrollPresenter

項目主頁:http://www.baiduhome.net/lib/view/home/1418872592261

 本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
 轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
 本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!