SDCycleScrollView Documentation

repository·master·Indexed 27 days ago

https://github.com/gsdios/sdcyclescrollview

An iOS component for creating infinite looping, automatic image and text carousels. SDCycleScrollView supports both local and network-loaded images and integrates with SDWebImage for image management. It includes features for configuring auto-scroll intervals, page control alignment, and title groups, with support for both Objective-C and Swift.

Tokens
1.5K
Snippets
9
Records
14
Agent score
41%

What's inside SDCycleScrollView

  1. Overview of SDWebImage features

    master

    SDWebImage is an asynchronous image downloader with built-in support for:

    • UI Categories: Extensions for UIImageView, UIButton, and MKAnnotationView for easy web image and cache management.
    • Caching: Asynchronous memory and disk caching with automatic expiration handling.
    • Performance: Background image decompression and non-blocking main thread execution.
    • Transformations: Customizable and composable transformations applied immediately after download.
    • Loading Indicators: Built-in support for loading indicators.
    • Reliability: Guarantees that the same URL won't be downloaded multiple times and prevents retrying bogus URLs.
  2. Install SDWebImage using CocoaPods

    master

    You can install SDWebImage using CocoaPods by adding it to your Podfile.

    For standard installation:

    platform :ios, '7.0'
    pod 'SDWebImage', '~> 4.0'

    Swift and Static Frameworks

    If you are using a Swift project and want to use SDWebImage as a static framework (avoiding use_frameworks!), use modular headers with CocoaPods 1.5.0+ and Xcode 9+:

    platform :ios, '8.0'
    # use_modular_headers!
    pod 'SDWebImage', :modular_headers => true

    Alternatively, to use it as a dynamic framework, include use_frameworks!:

    platform :ios, '8.0'
    use_frameworks!
    pod 'SDWebImage'
    platform :ios, '7.0'
    pod 'SDWebImage', '~> 4.0'
  3. Install SDWebImage using Carthage

    master

    To install SDWebImage with Carthage (iOS 8+), add the following entry to your Cartfile:

    github "SDWebImage/SDWebImage"

    Then run the command: carthage update

    Note: Carthage builds all components (including SDWebImageMapKit). If you do not need specific components, you can manually delete the unused frameworks from the Carthage Build directory after the update completes.

    github "SDWebImage/SDWebImage"
    carthage update
  4. Fix top whitespace issue in SDCycleScrollView

    master

    If you encounter an unexpected blank area at the top of the scroll view, it is likely due to iOS 7+ automatic scroll view insets adjustment.

    Solution: Set self.automaticallyAdjustsScrollViewInsets = NO; in your ViewController.

  5. Initialize SDCycleScrollView for images

    master

    You can initialize the scroll view for either network-loaded images or local images using the provided factory methods.

    For network-loaded images: Use cycleScrollViewWithFrame:delegate:placeholderImage: and assign your URL strings to the imageURLStringsGroup property.

    For local images: Use cycleScrollViewWithFrame:imagesGroup: and pass your local image array.

    // 网络加载图片的轮播器
    SDCycleScrollView *cycleScrollView = [cycleScrollViewWithFrame:frame delegate:delegate placeholderImage:placeholderImage];
    cycleScrollView.imageURLStringsGroup = imagesURLStrings;
    
    // 本地加载图片的轮播器
    SDCycleScrollView *cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame: imagesGroup:图片数组];