├── .gitignore ├── Example ├── XHTwitterPaggingViewerExample │ ├── Podfile │ ├── Podfile.lock │ ├── Pods │ │ ├── BuildHeaders │ │ │ └── XHRefreshControl │ │ │ │ ├── XHActivityCircleIndicatorView.h │ │ │ │ ├── XHBaseTableViewController.h │ │ │ │ ├── XHCircleView.h │ │ │ │ ├── XHFoundationCommon.h │ │ │ │ ├── XHLoadMoreView.h │ │ │ │ ├── XHPullRefreshTableViewController.h │ │ │ │ ├── XHRefreshActivityIndicatorContainerView.h │ │ │ │ ├── XHRefreshCircleContainerView.h │ │ │ │ ├── XHRefreshControl.h │ │ │ │ ├── XHRefreshControlHeader.h │ │ │ │ ├── XHSysatemRefreshTableViewController.h │ │ │ │ └── XHSystemTableViewController.h │ │ ├── Headers │ │ │ └── XHRefreshControl │ │ │ │ ├── XHActivityCircleIndicatorView.h │ │ │ │ ├── XHBaseTableViewController.h │ │ │ │ ├── XHCircleView.h │ │ │ │ ├── XHFoundationCommon.h │ │ │ │ ├── XHLoadMoreView.h │ │ │ │ ├── XHPullRefreshTableViewController.h │ │ │ │ ├── XHRefreshActivityIndicatorContainerView.h │ │ │ │ ├── XHRefreshCircleContainerView.h │ │ │ │ ├── XHRefreshControl.h │ │ │ │ ├── XHRefreshControlHeader.h │ │ │ │ ├── XHSysatemRefreshTableViewController.h │ │ │ │ └── XHSystemTableViewController.h │ │ ├── Manifest.lock │ │ ├── Pods-XHRefreshControl-Private.xcconfig │ │ ├── Pods-XHRefreshControl-dummy.m │ │ ├── Pods-XHRefreshControl-prefix.pch │ │ ├── Pods-XHRefreshControl.xcconfig │ │ ├── Pods-acknowledgements.markdown │ │ ├── Pods-acknowledgements.plist │ │ ├── Pods-dummy.m │ │ ├── Pods-environment.h │ │ ├── Pods-resources.sh │ │ ├── Pods.xcconfig │ │ ├── Pods.xcodeproj │ │ │ ├── project.pbxproj │ │ │ └── xcuserdata │ │ │ │ └── dw_ios.xcuserdatad │ │ │ │ └── xcschemes │ │ │ │ ├── Pods-XHRefreshControl.xcscheme │ │ │ │ ├── Pods.xcscheme │ │ │ │ └── xcschememanagement.plist │ │ └── XHRefreshControl │ │ │ ├── LICENSE │ │ │ ├── README.md │ │ │ └── RefreshControl │ │ │ ├── Controllers │ │ │ ├── CustomTableViewController │ │ │ │ ├── XHBaseTableViewController.h │ │ │ │ ├── XHBaseTableViewController.m │ │ │ │ ├── XHFoundationCommon.h │ │ │ │ ├── XHFoundationCommon.m │ │ │ │ ├── XHPullRefreshTableViewController.h │ │ │ │ └── XHPullRefreshTableViewController.m │ │ │ └── SystemTableViewController │ │ │ │ ├── XHSysatemRefreshTableViewController.h │ │ │ │ ├── XHSysatemRefreshTableViewController.m │ │ │ │ ├── XHSystemTableViewController.h │ │ │ │ └── XHSystemTableViewController.m │ │ │ ├── Manager │ │ │ ├── XHRefreshControl.h │ │ │ ├── XHRefreshControl.m │ │ │ └── XHRefreshControlHeader.h │ │ │ └── Views │ │ │ ├── XHActivityCircleIndicatorView.h │ │ │ ├── XHActivityCircleIndicatorView.m │ │ │ ├── XHCircleView.h │ │ │ ├── XHCircleView.m │ │ │ ├── XHLoadMoreView.h │ │ │ ├── XHLoadMoreView.m │ │ │ ├── XHRefreshActivityIndicatorContainerView.h │ │ │ ├── XHRefreshActivityIndicatorContainerView.m │ │ │ ├── XHRefreshCircleContainerView.h │ │ │ └── XHRefreshCircleContainerView.m │ ├── XHTwitterPaggingViewerExample.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ └── XHTwitterPaggingViewerExample.xccheckout │ │ └── xcuserdata │ │ │ ├── JackMacbook.xcuserdatad │ │ │ ├── xcdebugger │ │ │ │ └── Breakpoints_v2.xcbkptlist │ │ │ └── xcschemes │ │ │ │ ├── XHTwitterPaggingViewerExample.xcscheme │ │ │ │ └── xcschememanagement.plist │ │ │ └── dw_ios.xcuserdatad │ │ │ ├── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ │ │ └── xcschemes │ │ │ ├── XHTwitterPaggingViewerExample.xcscheme │ │ │ └── xcschememanagement.plist │ ├── XHTwitterPaggingViewerExample.xcworkspace │ │ ├── contents.xcworkspacedata │ │ ├── xcshareddata │ │ │ └── XHTwitterPaggingViewerExample.xccheckout │ │ └── xcuserdata │ │ │ └── dw_ios.xcuserdatad │ │ │ └── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ ├── XHTwitterPaggingViewerExample │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Images.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ ├── LaunchImage.launchimage │ │ │ │ └── Contents.json │ │ │ ├── icon_avator0.imageset │ │ │ │ ├── Contents.json │ │ │ │ └── icon_avator0@2x.png │ │ │ ├── icon_avator1.imageset │ │ │ │ ├── Contents.json │ │ │ │ └── icon_avator1@2x.png │ │ │ └── icon_avator2.imageset │ │ │ │ ├── Contents.json │ │ │ │ └── icon_avator2@2x.png │ │ ├── XHTableViewController.h │ │ ├── XHTableViewController.m │ │ ├── XHTwitterPaggingViewerExample-Info.plist │ │ ├── XHTwitterPaggingViewerExample-Prefix.pch │ │ ├── en.lproj │ │ │ └── InfoPlist.strings │ │ └── main.m │ └── XHTwitterPaggingViewerExampleTests │ │ ├── XHTwitterPaggingViewerExampleTests-Info.plist │ │ ├── XHTwitterPaggingViewerExampleTests.m │ │ └── en.lproj │ │ └── InfoPlist.strings └── XHTwitterPaggingViewerStoryboradExample │ ├── XHTwitterPaggingViewerStoryboradExample.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── XHTwitterPaggingViewerStoryboradExample.xccheckout │ └── xcuserdata │ │ ├── JackMacbook.xcuserdatad │ │ ├── xcdebugger │ │ │ └── Breakpoints_v2.xcbkptlist │ │ └── xcschemes │ │ │ ├── XHTwitterPaggingViewerStoryboradExample.xcscheme │ │ │ └── xcschememanagement.plist │ │ └── dw_ios.xcuserdatad │ │ └── xcschemes │ │ ├── XHTwitterPaggingViewerStoryboradExample.xcscheme │ │ └── xcschememanagement.plist │ ├── XHTwitterPaggingViewerStoryboradExample │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Base.lproj │ │ ├── Main_iPad.storyboard │ │ └── Main_iPhone.storyboard │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ ├── LaunchImage.launchimage │ │ │ └── Contents.json │ │ ├── icon_avator0.imageset │ │ │ ├── Contents.json │ │ │ └── icon_avator0@2x.png │ │ ├── icon_avator1.imageset │ │ │ ├── Contents.json │ │ │ └── icon_avator1@2x.png │ │ └── icon_avator2.imageset │ │ │ ├── Contents.json │ │ │ └── icon_avator2@2x.png │ ├── XHBaseTableViewController.h │ ├── XHBaseTableViewController.m │ ├── XHFoundationCommon.h │ ├── XHFoundationCommon.m │ ├── XHTableViewController.h │ ├── XHTableViewController.m │ ├── XHTwitterPaggingViewerStoryboradExample-Info.plist │ ├── XHTwitterPaggingViewerStoryboradExample-Prefix.pch │ ├── en.lproj │ │ └── InfoPlist.strings │ └── main.m │ └── XHTwitterPaggingViewerStoryboradExampleTests │ ├── XHTwitterPaggingViewerStoryboradExampleTests-Info.plist │ ├── XHTwitterPaggingViewerStoryboradExampleTests.m │ └── en.lproj │ └── InfoPlist.strings ├── LICENSE ├── README.md ├── XHTwitterPaggingViewer.podspec └── XHTwitterPaggingViewer ├── Assets ├── thumbnail_normal@2x.png └── thumbnail_selected@2x.png ├── Controllers ├── XHTwitterPaggingViewer.h └── XHTwitterPaggingViewer.m └── Views ├── XHPageControl.h ├── XHPageControl.m ├── XHPaggingNavbar.h └── XHPaggingNavbar.m /.gitignore: -------------------------------------------------------------------------------- 1 | # Created by http://www.gitignore.io 2 | 3 | #!! ERROR: obj is undefined. Use list command to see defined gitignore types !!# 4 | 5 | ### Objective-C ### 6 | # Xcode 7 | # 8 | build/ 9 | *.xcuserstate 10 | *.xcbkptlist 11 | *.pbxuser 12 | !default.pbxuser 13 | *.mode1v3 14 | !default.mode1v3 15 | *.mode2v3 16 | !default.mode2v3 17 | *.perspectivev3 18 | !default.perspectivev3 19 | xcuserdata 20 | *.xccheckout 21 | *.moved-aside 22 | DerivedData 23 | *.hmap 24 | *.ipa 25 | *.xcuserstate 26 | 27 | # CocoaPods 28 | # 29 | # We recommend against adding the Pods directory to your .gitignore. However 30 | # you should judge for yourself, the pros and cons are mentioned at: 31 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 32 | # 33 | # Pods/ 34 | 35 | .DS_Store 36 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Podfile: -------------------------------------------------------------------------------- 1 | pod 'XHRefreshControl' 2 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Podfile.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - XHRefreshControl (2.3) 3 | 4 | DEPENDENCIES: 5 | - XHRefreshControl 6 | 7 | SPEC CHECKSUMS: 8 | XHRefreshControl: 3f22d8c9e1e17dcedb25da41cbbb6a1059f0add4 9 | 10 | COCOAPODS: 0.33.1 11 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/BuildHeaders/XHRefreshControl/XHActivityCircleIndicatorView.h: -------------------------------------------------------------------------------- 1 | ../../XHRefreshControl/RefreshControl/Views/XHActivityCircleIndicatorView.h -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/BuildHeaders/XHRefreshControl/XHBaseTableViewController.h: -------------------------------------------------------------------------------- 1 | ../../XHRefreshControl/RefreshControl/Controllers/CustomTableViewController/XHBaseTableViewController.h -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/BuildHeaders/XHRefreshControl/XHCircleView.h: -------------------------------------------------------------------------------- 1 | ../../XHRefreshControl/RefreshControl/Views/XHCircleView.h -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/BuildHeaders/XHRefreshControl/XHFoundationCommon.h: -------------------------------------------------------------------------------- 1 | ../../XHRefreshControl/RefreshControl/Controllers/CustomTableViewController/XHFoundationCommon.h -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/BuildHeaders/XHRefreshControl/XHLoadMoreView.h: -------------------------------------------------------------------------------- 1 | ../../XHRefreshControl/RefreshControl/Views/XHLoadMoreView.h -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/BuildHeaders/XHRefreshControl/XHPullRefreshTableViewController.h: -------------------------------------------------------------------------------- 1 | ../../XHRefreshControl/RefreshControl/Controllers/CustomTableViewController/XHPullRefreshTableViewController.h -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/BuildHeaders/XHRefreshControl/XHRefreshActivityIndicatorContainerView.h: -------------------------------------------------------------------------------- 1 | ../../XHRefreshControl/RefreshControl/Views/XHRefreshActivityIndicatorContainerView.h -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/BuildHeaders/XHRefreshControl/XHRefreshCircleContainerView.h: -------------------------------------------------------------------------------- 1 | ../../XHRefreshControl/RefreshControl/Views/XHRefreshCircleContainerView.h -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/BuildHeaders/XHRefreshControl/XHRefreshControl.h: -------------------------------------------------------------------------------- 1 | ../../XHRefreshControl/RefreshControl/Manager/XHRefreshControl.h -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/BuildHeaders/XHRefreshControl/XHRefreshControlHeader.h: -------------------------------------------------------------------------------- 1 | ../../XHRefreshControl/RefreshControl/Manager/XHRefreshControlHeader.h -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/BuildHeaders/XHRefreshControl/XHSysatemRefreshTableViewController.h: -------------------------------------------------------------------------------- 1 | ../../XHRefreshControl/RefreshControl/Controllers/SystemTableViewController/XHSysatemRefreshTableViewController.h -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/BuildHeaders/XHRefreshControl/XHSystemTableViewController.h: -------------------------------------------------------------------------------- 1 | ../../XHRefreshControl/RefreshControl/Controllers/SystemTableViewController/XHSystemTableViewController.h -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/Headers/XHRefreshControl/XHActivityCircleIndicatorView.h: -------------------------------------------------------------------------------- 1 | ../../XHRefreshControl/RefreshControl/Views/XHActivityCircleIndicatorView.h -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/Headers/XHRefreshControl/XHBaseTableViewController.h: -------------------------------------------------------------------------------- 1 | ../../XHRefreshControl/RefreshControl/Controllers/CustomTableViewController/XHBaseTableViewController.h -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/Headers/XHRefreshControl/XHCircleView.h: -------------------------------------------------------------------------------- 1 | ../../XHRefreshControl/RefreshControl/Views/XHCircleView.h -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/Headers/XHRefreshControl/XHFoundationCommon.h: -------------------------------------------------------------------------------- 1 | ../../XHRefreshControl/RefreshControl/Controllers/CustomTableViewController/XHFoundationCommon.h -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/Headers/XHRefreshControl/XHLoadMoreView.h: -------------------------------------------------------------------------------- 1 | ../../XHRefreshControl/RefreshControl/Views/XHLoadMoreView.h -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/Headers/XHRefreshControl/XHPullRefreshTableViewController.h: -------------------------------------------------------------------------------- 1 | ../../XHRefreshControl/RefreshControl/Controllers/CustomTableViewController/XHPullRefreshTableViewController.h -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/Headers/XHRefreshControl/XHRefreshActivityIndicatorContainerView.h: -------------------------------------------------------------------------------- 1 | ../../XHRefreshControl/RefreshControl/Views/XHRefreshActivityIndicatorContainerView.h -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/Headers/XHRefreshControl/XHRefreshCircleContainerView.h: -------------------------------------------------------------------------------- 1 | ../../XHRefreshControl/RefreshControl/Views/XHRefreshCircleContainerView.h -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/Headers/XHRefreshControl/XHRefreshControl.h: -------------------------------------------------------------------------------- 1 | ../../XHRefreshControl/RefreshControl/Manager/XHRefreshControl.h -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/Headers/XHRefreshControl/XHRefreshControlHeader.h: -------------------------------------------------------------------------------- 1 | ../../XHRefreshControl/RefreshControl/Manager/XHRefreshControlHeader.h -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/Headers/XHRefreshControl/XHSysatemRefreshTableViewController.h: -------------------------------------------------------------------------------- 1 | ../../XHRefreshControl/RefreshControl/Controllers/SystemTableViewController/XHSysatemRefreshTableViewController.h -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/Headers/XHRefreshControl/XHSystemTableViewController.h: -------------------------------------------------------------------------------- 1 | ../../XHRefreshControl/RefreshControl/Controllers/SystemTableViewController/XHSystemTableViewController.h -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/Manifest.lock: -------------------------------------------------------------------------------- 1 | PODS: 2 | - XHRefreshControl (2.3) 3 | 4 | DEPENDENCIES: 5 | - XHRefreshControl 6 | 7 | SPEC CHECKSUMS: 8 | XHRefreshControl: 3f22d8c9e1e17dcedb25da41cbbb6a1059f0add4 9 | 10 | COCOAPODS: 0.33.1 11 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/Pods-XHRefreshControl-Private.xcconfig: -------------------------------------------------------------------------------- 1 | #include "Pods-XHRefreshControl.xcconfig" 2 | GCC_PREPROCESSOR_DEFINITIONS = COCOAPODS=1 3 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/BuildHeaders" "${PODS_ROOT}/BuildHeaders/XHRefreshControl" "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/XHRefreshControl" 4 | OTHER_LDFLAGS = -ObjC ${PODS_XHREFRESHCONTROL_OTHER_LDFLAGS} 5 | PODS_ROOT = ${SRCROOT} -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/Pods-XHRefreshControl-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods_XHRefreshControl : NSObject 3 | @end 4 | @implementation PodsDummy_Pods_XHRefreshControl 5 | @end 6 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/Pods-XHRefreshControl-prefix.pch: -------------------------------------------------------------------------------- 1 | #ifdef __OBJC__ 2 | #import 3 | #endif 4 | 5 | #import "Pods-environment.h" 6 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/Pods-XHRefreshControl.xcconfig: -------------------------------------------------------------------------------- 1 | PODS_XHREFRESHCONTROL_OTHER_LDFLAGS = -framework CoreGraphics -framework Foundation -framework UIKit -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/Pods-acknowledgements.markdown: -------------------------------------------------------------------------------- 1 | # Acknowledgements 2 | This application makes use of the following third party libraries: 3 | 4 | ## XHRefreshControl 5 | 6 | The MIT License (MIT) 7 | 8 | Copyright (c) 2014 Jack 9 | 10 | Permission is hereby granted, free of charge, to any person obtaining a copy 11 | of this software and associated documentation files (the "Software"), to deal 12 | in the Software without restriction, including without limitation the rights 13 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 14 | copies of the Software, and to permit persons to whom the Software is 15 | furnished to do so, subject to the following conditions: 16 | 17 | The above copyright notice and this permission notice shall be included in all 18 | copies or substantial portions of the Software. 19 | 20 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 21 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 22 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 23 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 24 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 25 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 26 | SOFTWARE. 27 | Generated by CocoaPods - http://cocoapods.org 28 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/Pods-acknowledgements.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | PreferenceSpecifiers 6 | 7 | 8 | FooterText 9 | This application makes use of the following third party libraries: 10 | Title 11 | Acknowledgements 12 | Type 13 | PSGroupSpecifier 14 | 15 | 16 | FooterText 17 | The MIT License (MIT) 18 | 19 | Copyright (c) 2014 Jack 20 | 21 | Permission is hereby granted, free of charge, to any person obtaining a copy 22 | of this software and associated documentation files (the "Software"), to deal 23 | in the Software without restriction, including without limitation the rights 24 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 25 | copies of the Software, and to permit persons to whom the Software is 26 | furnished to do so, subject to the following conditions: 27 | 28 | The above copyright notice and this permission notice shall be included in all 29 | copies or substantial portions of the Software. 30 | 31 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 32 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 33 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 34 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 35 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 36 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 37 | SOFTWARE. 38 | Title 39 | XHRefreshControl 40 | Type 41 | PSGroupSpecifier 42 | 43 | 44 | FooterText 45 | Generated by CocoaPods - http://cocoapods.org 46 | Title 47 | 48 | Type 49 | PSGroupSpecifier 50 | 51 | 52 | StringsTable 53 | Acknowledgements 54 | Title 55 | Acknowledgements 56 | 57 | 58 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/Pods-dummy.m: -------------------------------------------------------------------------------- 1 | #import 2 | @interface PodsDummy_Pods : NSObject 3 | @end 4 | @implementation PodsDummy_Pods 5 | @end 6 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/Pods-environment.h: -------------------------------------------------------------------------------- 1 | 2 | // To check if a library is compiled with CocoaPods you 3 | // can use the `COCOAPODS` macro definition which is 4 | // defined in the xcconfigs so it is available in 5 | // headers also when they are imported in the client 6 | // project. 7 | 8 | 9 | // XHRefreshControl 10 | #define COCOAPODS_POD_AVAILABLE_XHRefreshControl 11 | #define COCOAPODS_VERSION_MAJOR_XHRefreshControl 2 12 | #define COCOAPODS_VERSION_MINOR_XHRefreshControl 3 13 | #define COCOAPODS_VERSION_PATCH_XHRefreshControl 0 14 | 15 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/Pods-resources.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt 5 | > "$RESOURCES_TO_COPY" 6 | 7 | install_resource() 8 | { 9 | case $1 in 10 | *.storyboard) 11 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 12 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .storyboard`.storyboardc" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 13 | ;; 14 | *.xib) 15 | echo "ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile ${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib ${PODS_ROOT}/$1 --sdk ${SDKROOT}" 16 | ibtool --reference-external-strings-file --errors --warnings --notices --output-format human-readable-text --compile "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$1\" .xib`.nib" "${PODS_ROOT}/$1" --sdk "${SDKROOT}" 17 | ;; 18 | *.framework) 19 | echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 20 | mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 21 | echo "rsync -av ${PODS_ROOT}/$1 ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 22 | rsync -av "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" 23 | ;; 24 | *.xcdatamodel) 25 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1"`.mom\"" 26 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodel`.mom" 27 | ;; 28 | *.xcdatamodeld) 29 | echo "xcrun momc \"${PODS_ROOT}/$1\" \"${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd\"" 30 | xcrun momc "${PODS_ROOT}/$1" "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$1" .xcdatamodeld`.momd" 31 | ;; 32 | *.xcassets) 33 | ;; 34 | /*) 35 | echo "$1" 36 | echo "$1" >> "$RESOURCES_TO_COPY" 37 | ;; 38 | *) 39 | echo "${PODS_ROOT}/$1" 40 | echo "${PODS_ROOT}/$1" >> "$RESOURCES_TO_COPY" 41 | ;; 42 | esac 43 | } 44 | 45 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${CONFIGURATION_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 46 | if [[ "${ACTION}" == "install" ]]; then 47 | rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 48 | fi 49 | rm -f "$RESOURCES_TO_COPY" 50 | 51 | if [[ -n "${WRAPPER_EXTENSION}" ]] && [ `xcrun --find actool` ] && [ `find . -name '*.xcassets' | wc -l` -ne 0 ] 52 | then 53 | case "${TARGETED_DEVICE_FAMILY}" in 54 | 1,2) 55 | TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" 56 | ;; 57 | 1) 58 | TARGET_DEVICE_ARGS="--target-device iphone" 59 | ;; 60 | 2) 61 | TARGET_DEVICE_ARGS="--target-device ipad" 62 | ;; 63 | *) 64 | TARGET_DEVICE_ARGS="--target-device mac" 65 | ;; 66 | esac 67 | find "${PWD}" -name "*.xcassets" -print0 | xargs -0 actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${IPHONEOS_DEPLOYMENT_TARGET}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" 68 | fi 69 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/Pods.xcconfig: -------------------------------------------------------------------------------- 1 | GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 2 | HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers" "${PODS_ROOT}/Headers/XHRefreshControl" 3 | OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers" -isystem "${PODS_ROOT}/Headers/XHRefreshControl" 4 | OTHER_LDFLAGS = -ObjC -framework CoreGraphics -framework Foundation -framework UIKit 5 | PODS_ROOT = ${SRCROOT}/Pods -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/Pods.xcodeproj/xcuserdata/dw_ios.xcuserdatad/xcschemes/Pods-XHRefreshControl.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 42 | 43 | 44 | 45 | 51 | 52 | 54 | 55 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/Pods.xcodeproj/xcuserdata/dw_ios.xcuserdatad/xcschemes/Pods.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 42 | 43 | 44 | 45 | 51 | 52 | 54 | 55 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/Pods.xcodeproj/xcuserdata/dw_ios.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | Pods-XHRefreshControl.xcscheme 8 | 9 | isShown 10 | 11 | 12 | Pods.xcscheme 13 | 14 | isShown 15 | 16 | 17 | 18 | SuppressBuildableAutocreation 19 | 20 | 1BC8C833983342C9B83C408B 21 | 22 | primary 23 | 24 | 25 | 20F6DCDB18D642BC984E5958 26 | 27 | primary 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/XHRefreshControl/LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Jack 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/XHRefreshControl/README.md: -------------------------------------------------------------------------------- 1 | ![image](https://github.com/xhzengAIB/LearnEnglish/raw/master/Screenshots/XHRefreshControl.gif) 2 | XHRefreshControl 3 | ================ 4 | 5 | XHRefreshControl 是一款高扩展性、低耦合度的下拉刷新、上提加载更多的组件。 6 | 7 | ## Podfile 8 | 9 | [CocosPods](http://cocosPods.org) is the recommended method to install XHRefreshControl, just add the following line to `Podfile` 10 | 11 | ``` 12 | pod 'XHRefreshControl' 13 | ``` 14 | 15 | and run `pod install`, then you're all done! 16 | 17 | ## To Do: 18 | * 添加外部自定义下拉View和下拉状态-------已经完成 19 | 20 | ## How to use 21 | ```objc 22 | 提供两种使用方式: 23 | 1、继承UIViewController,自定义TableView。 24 | 使用方法很简单 25 | #import "XHPullRefreshTableViewController.h" 26 | 27 | 继承XHPullRefreshTableViewController, 28 | 29 | 提供以下多个方法处理加载数据的不同处理方法: 30 | /** 31 | * 是否支持下拉刷新 32 | */ 33 | @property (nonatomic, assign) BOOL pullDownRefreshed; 34 | 35 | /** 36 | * 是否支持上拉刷新 37 | */ 38 | @property (nonatomic, assign) BOOL loadMoreRefreshed; 39 | 40 | /** 41 | * 下拉刷新的样式 42 | */ 43 | @property (nonatomic, assign) XHPullDownRefreshViewType refreshViewType; 44 | 45 | /** 46 | * 加载数据的页码 47 | */ 48 | @property (nonatomic, assign) NSInteger requestCurrentPage; 49 | 50 | /** 51 | * 自动下拉刷新调用的方法,必须放在viewDidAppear方法内,别把这行代码放到别处,然后导致了错误,那就不好了嘛! 52 | */ 53 | - (void)startPullDownRefreshing; 54 | 55 | /** 56 | * 当下拉加载数据完成后,你必须调用该方法哦! 57 | */ 58 | - (void)endPullDownRefreshing; 59 | 60 | /** 61 | * 当上啦加载数据完成后,你也得调用该方法哦!然后你可能会问,那我要怎么判断是下拉还是上啦啊?requestCurrentPage看这个变量,会跟着变化哦! 62 | */ 63 | - (void)endLoadMoreRefreshing; 64 | 65 | /** 66 | * 当上啦加载数据回调告诉我们,已经没有下一页了,那你可以调用该方法,告诉用户你已经没有数据了哦! 67 | * 68 | * @param message 提示用户的信息 69 | */ 70 | - (void)endMoreOverWithMessage:(NSString *)message; 71 | 72 | /** 73 | * 当网络加载失败的时候,你必须调用该方法,如果你不调用,我也帮不了你了 74 | */ 75 | - (void)handleLoadMoreError; 76 | 77 | 78 | 2、直接使用UITableViewController,提供兼容下拉、上啦刷新的处理。 79 | #import "XHSysatemRefreshTableViewController.h" 80 | 81 | 提供的内部方法和第一个方式是一样的! 82 | 83 | 84 | 你也可以自己定制一个属于你自己的控制器,至于你要加入其他基础类的方法,那就您好好定制了。以下提供这些方法给您定制下拉、上拉的样式。 85 | #import "XHRefreshControl.h" 86 | 87 | XHRefreshControl *refreshControl = [[XHRefreshControl alloc] initWithScrollView:self.yourTableView delegate:self]; 88 | 89 | 以下手动可调用的方法 90 | /** 91 | * 外部手动启动下拉加载的方法,这个方法不需要手动去拖动UIScrollView 92 | */ 93 | - (void)startPullDownRefreshing; 94 | 95 | /** 96 | * 停止下拉刷新的方法 97 | */ 98 | - (void)endPullDownRefreshing; 99 | 100 | /** 101 | * 停止上提加载更多的方法 102 | */ 103 | - (void)endLoadMoreRefresing; 104 | 105 | /** 106 | * 没有更多的数据加载 107 | */ 108 | - (void)endMoreOverWithMessage:(NSString *)message; 109 | 110 | 111 | 112 | 以下是delegate方法,用于外部定制 113 | implementation XHRefreshControl required delegate: 114 | 115 | @required 116 | /** 117 | * 1、将要开始下拉刷新的方法 118 | */ 119 | - (void)beginPullDownRefreshing; 120 | 121 | /** 122 | * 2、将要开始上提加载更多的方法 123 | */ 124 | - (void)beginLoadMoreRefreshing; 125 | 126 | /** 127 | * 3、最后更新数据的时间 128 | * 129 | * @return 返回缓存最后更新某个页面的时间 130 | */ 131 | - (NSDate *)lastUpdateTime; 132 | 133 | @optional 134 | /** 135 | * 1、是否支持下拉刷新 136 | * 137 | * @return 如果没有实现该delegate方法,默认是支持下拉的,为YES 138 | */ 139 | - (BOOL)isPullDownRefreshed; 140 | 141 | /** 142 | * 2、是否支持上提加载更多 143 | * 144 | * @return 如果没有实现该delegate方法,默认是支持上提加载更多的,为YES 145 | */ 146 | - (BOOL)isLoadMoreRefreshed; 147 | 148 | /** 149 | * 3、标识下拉刷新是UIScrollView的子view,还是UIScrollView父view的子view 150 | * 151 | * @return 如果没有实现该delegate方法,默认是scrollView的子View,为XHRefreshViewLayerTypeOnScrollViews 152 | */ 153 | - (XHRefreshViewLayerType)refreshViewLayerType; 154 | 155 | /** 156 | * 4、下拉刷新使用哪种样式 157 | * 158 | * @return 如果没有实现该delegate方法,默认是网易新闻App的样式 159 | */ 160 | - (XHPullDownRefreshViewType)pullDownRefreshViewType; 161 | 162 | /** 163 | * 4、UIScrollView的控制器是否保留iOS7新的特性,意思是:tablView的内容是否可以穿透过导航条 164 | * 165 | * @return 如果不是先该delegate方法,默认是不支持的 166 | */ 167 | - (BOOL)keepiOS7NewApiCharacter; 168 | 169 | /** 170 | * 5、将自动加载更多的状态转换为手动加载需要的条件,现在是加载更多多少次后,开始转换 171 | * 172 | * @return 如果不实现该delegate方法,默认是5次 173 | */ 174 | - (NSInteger)autoLoadMoreRefreshedCountConverManual; 175 | 176 | /** 177 | * 6、获取用户定义下拉的View 178 | * 179 | * @return 返回用户定义的View 180 | */ 181 | - (UIView *)customPullDownRefreshView; 182 | 183 | /** 184 | * 7、通知外部,下拉的距离,用于定制某个时机的状态 185 | * 186 | * @param refreshView 需要改变状态的View 187 | * @param pullDownOffset 下拉的距离 188 | */ 189 | - (void)customPullDownRefreshView:(UIView *)customPullDownRefreshView withPullDownOffset:(CGFloat)pullDownOffset; 190 | 191 | /** 192 | * 8、将要下拉的时候,被调用 193 | * 194 | * @param customPullDownRefreshView 目标下拉的View 195 | */ 196 | - (void)customPullDownRefreshViewWillStartRefresh:(UIView *)customPullDownRefreshView; 197 | 198 | /** 199 | * 9、将要停止下啦的时候,被调用 200 | * 201 | * @param customPullDownRefreshView 目标下啦的View 202 | */ 203 | - (void)customPullDownRefreshViewWillEndRefresh:(UIView *)customPullDownRefreshView; 204 | 205 | 206 | 207 | 208 | ``` 209 | 210 | 211 | ## License 212 | 213 | 中文: XHRefreshControl 是在MIT协议下使用的,可以在LICENSE文件里面找到相关的使用协议信息。 214 | 215 | English: XHRefreshControl is available under the MIT license, see the LICENSE file for more information. 216 | 217 | 218 | 219 | ## 须知 Notes 220 | 如果您在您的项目中使用该开源组件,请给我们发[电子邮件](mailto:xhzengAIB@gmail.com?subject=From%20GitHub%20XHRefreshControl)告诉我们您的应用程序的名称,谢谢!主要是为了互推的效果,如果您的app火了,请给予少许的回报,如果您的App不火,或许能通过这个开源库了解到您的App! 221 | 222 | If you use this open source components in your project, please [Email us](mailto:xhzengAIB@gmail.com?subject=From%20GitHub%20XHRefreshControl) to notify us the name of your application(s). Thanks! 223 | 224 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/XHRefreshControl/RefreshControl/Controllers/CustomTableViewController/XHBaseTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // XHBaseTableViewController.h 3 | // MessageDisplayExample 4 | // 5 | // Created by qtone-1 on 14-5-6. 6 | // Copyright (c) 2014年 曾宪华 开发团队(http://iyilunba.com ) 本人QQ:543413507 本人QQ群(142557668). All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface XHBaseTableViewController : UIViewController 12 | 13 | /** 14 | * 显示大量数据的控件 15 | */ 16 | @property (nonatomic, strong) UITableView *tableView; 17 | /** 18 | * 初始化init的时候设置tableView的样式才有效 19 | */ 20 | @property (nonatomic, assign) UITableViewStyle tableViewStyle; 21 | 22 | /** 23 | * 大量数据的数据源 24 | */ 25 | @property (nonatomic, strong) NSMutableArray *dataSource; 26 | 27 | /** 28 | * 去除iOS7新的功能api,tableView的分割线变成iOS6正常的样式 29 | */ 30 | - (void)configuraTableViewNormalSeparatorInset; 31 | 32 | /** 33 | * 配置tableView右侧的index title 背景颜色,因为在iOS7有白色底色,iOS6没有 34 | * 35 | * @param tableView 目标tableView 36 | */ 37 | - (void)configuraSectionIndexBackgroundColorWithTableView:(UITableView *)tableView; 38 | 39 | /** 40 | * 加载本地或者网络数据源 41 | */ 42 | - (void)loadDataSource; 43 | 44 | @end 45 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/XHRefreshControl/RefreshControl/Controllers/CustomTableViewController/XHBaseTableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // XHBaseTableViewController.m 3 | // MessageDisplayExample 4 | // 5 | // Created by qtone-1 on 14-5-6. 6 | // Copyright (c) 2014年 曾宪华 开发团队(http://iyilunba.com ) 本人QQ:543413507 本人QQ群(142557668). All rights reserved. 7 | // 8 | 9 | #import "XHBaseTableViewController.h" 10 | 11 | #import "XHFoundationCommon.h" 12 | 13 | @interface XHBaseTableViewController () 14 | 15 | /** 16 | * 判断tableView是否支持iOS7的api方法 17 | * 18 | * @return 返回预想结果 19 | */ 20 | - (BOOL)validateSeparatorInset; 21 | 22 | @end 23 | 24 | @implementation XHBaseTableViewController 25 | 26 | #pragma mark - Publish Method 27 | 28 | - (void)configuraTableViewNormalSeparatorInset { 29 | if ([self validateSeparatorInset]) { 30 | [_tableView setSeparatorInset:UIEdgeInsetsZero]; 31 | } 32 | } 33 | 34 | - (void)configuraSectionIndexBackgroundColorWithTableView:(UITableView *)tableView { 35 | if ([tableView respondsToSelector:@selector(setSectionIndexBackgroundColor:)]) { 36 | tableView.sectionIndexBackgroundColor = [UIColor clearColor]; 37 | } 38 | } 39 | 40 | - (void)loadDataSource { 41 | // subClasse 42 | } 43 | 44 | #pragma mark - Propertys 45 | 46 | - (UITableView *)tableView { 47 | if (!_tableView) { 48 | CGRect tableViewFrame = self.view.bounds; 49 | tableViewFrame.size.height -= (self.navigationController.viewControllers.count > 1 ? 0 : (CGRectGetHeight(self.tabBarController.tabBar.bounds))) + [XHFoundationCommon getAdapterHeight]; 50 | _tableView = [[UITableView alloc] initWithFrame:tableViewFrame style:self.tableViewStyle]; 51 | _tableView.delegate = self; 52 | _tableView.dataSource = self; 53 | 54 | _tableView.tableFooterView = [[UIView alloc] init]; 55 | if (![self validateSeparatorInset]) { 56 | if (self.tableViewStyle == UITableViewStyleGrouped) { 57 | UIView *backgroundView = [[UIView alloc] initWithFrame:_tableView.bounds]; 58 | backgroundView.backgroundColor = _tableView.backgroundColor; 59 | _tableView.backgroundView = backgroundView; 60 | } 61 | } 62 | 63 | if (self.tabBarController) { 64 | UIEdgeInsets scrollIndicatorInsets = _tableView.scrollIndicatorInsets; 65 | scrollIndicatorInsets.bottom -= CGRectGetHeight(self.tabBarController.tabBar.bounds); 66 | _tableView.scrollIndicatorInsets = scrollIndicatorInsets; 67 | } 68 | } 69 | return _tableView; 70 | } 71 | 72 | - (NSMutableArray *)dataSource { 73 | if (!_dataSource) { 74 | _dataSource = [[NSMutableArray alloc] initWithCapacity:1]; 75 | } 76 | return _dataSource; 77 | } 78 | 79 | #pragma mark - Life cycle 80 | 81 | - (void)viewDidLoad { 82 | [super viewDidLoad]; 83 | // Do any additional setup after loading the view. 84 | self.view.backgroundColor = [UIColor whiteColor]; 85 | [self.view addSubview:self.tableView]; 86 | } 87 | 88 | - (void)dealloc { 89 | self.dataSource = nil; 90 | self.tableView.delegate = nil; 91 | self.tableView.dataSource = nil; 92 | self.tableView = nil; 93 | } 94 | 95 | - (void)didReceiveMemoryWarning { 96 | [super didReceiveMemoryWarning]; 97 | // Dispose of any resources that can be recreated. 98 | } 99 | 100 | #pragma mark - TableView Helper Method 101 | 102 | - (BOOL)validateSeparatorInset { 103 | if ([_tableView respondsToSelector:@selector(setSeparatorInset:)]) { 104 | return YES; 105 | } 106 | return NO; 107 | } 108 | 109 | #pragma mark - UITableView DataSource 110 | 111 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 112 | return 1; 113 | } 114 | 115 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 116 | return self.dataSource.count; 117 | } 118 | 119 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 120 | // in subClass 121 | return nil; 122 | } 123 | 124 | 125 | @end 126 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/XHRefreshControl/RefreshControl/Controllers/CustomTableViewController/XHFoundationCommon.h: -------------------------------------------------------------------------------- 1 | // 2 | // XHFoundationCommon.h 3 | // MessageDisplayExample 4 | // 5 | // Created by qtone-1 on 14-4-28. 6 | // Copyright (c) 2014年 曾宪华 开发团队(http://iyilunba.com ) 本人QQ:543413507 本人QQ群(142557668). All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface XHFoundationCommon : NSObject 12 | 13 | + (CGFloat)getAdapterHeight; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/XHRefreshControl/RefreshControl/Controllers/CustomTableViewController/XHFoundationCommon.m: -------------------------------------------------------------------------------- 1 | // 2 | // XHFoundationCommon.m 3 | // MessageDisplayExample 4 | // 5 | // Created by qtone-1 on 14-4-28. 6 | // Copyright (c) 2014年 曾宪华 开发团队(http://iyilunba.com ) 本人QQ:543413507 本人QQ群(142557668). All rights reserved. 7 | // 8 | 9 | #import "XHFoundationCommon.h" 10 | 11 | @implementation XHFoundationCommon 12 | 13 | + (CGFloat)getAdapterHeight { 14 | CGFloat adapterHeight = 0; 15 | if ([[[UIDevice currentDevice] systemVersion] integerValue] < 7.0) { 16 | adapterHeight = 44; 17 | } 18 | return adapterHeight; 19 | } 20 | 21 | @end 22 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/XHRefreshControl/RefreshControl/Controllers/CustomTableViewController/XHPullRefreshTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // XHPullRefreshTableViewController.h 3 | // MessageDisplayExample 4 | // 5 | // Created by 曾 宪华 on 14-6-6. 6 | // Copyright (c) 2014年 曾宪华 开发团队(http://iyilunba.com ) 本人QQ:543413507 本人QQ群(142557668). All rights reserved. 7 | // 8 | 9 | #import "XHBaseTableViewController.h" 10 | 11 | #import "XHRefreshControl.h" 12 | 13 | @interface XHPullRefreshTableViewController : XHBaseTableViewController 14 | 15 | /** 16 | * 是否支持下拉刷新 17 | */ 18 | @property (nonatomic, assign) BOOL pullDownRefreshed; 19 | 20 | /** 21 | * 是否支持上拉刷新 22 | */ 23 | @property (nonatomic, assign) BOOL loadMoreRefreshed; 24 | 25 | /** 26 | * 下拉刷新的样式 27 | */ 28 | @property (nonatomic, assign) XHPullDownRefreshViewType refreshViewType; 29 | 30 | /** 31 | * 加载数据的页码 32 | */ 33 | @property (nonatomic, assign) NSInteger requestCurrentPage; 34 | 35 | /** 36 | * 自动下拉刷新调用的方法,必须放在viewDidAppear方法内,别把这行代码放到别处,然后导致了错误,那就不好了嘛! 37 | */ 38 | - (void)startPullDownRefreshing; 39 | 40 | /** 41 | * 当下拉加载数据完成后,你必须调用该方法哦! 42 | */ 43 | - (void)endPullDownRefreshing; 44 | 45 | /** 46 | * 当上啦加载数据完成后,你也得调用该方法哦!然后你可能会问,那我要怎么判断是下拉还是上啦啊?requestCurrentPage看这个变量,会跟着变化哦! 47 | */ 48 | - (void)endLoadMoreRefreshing; 49 | 50 | /** 51 | * 当上啦加载数据回调告诉我们,已经没有下一页了,那你可以调用该方法,告诉用户你已经没有数据了哦! 52 | * 53 | * @param message 提示用户的信息 54 | */ 55 | - (void)endMoreOverWithMessage:(NSString *)message; 56 | 57 | /** 58 | * 当网络加载失败的时候,你必须调用该方法,如果你不调用,我也帮不了你了 59 | */ 60 | - (void)handleLoadMoreError; 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/XHRefreshControl/RefreshControl/Controllers/CustomTableViewController/XHPullRefreshTableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // XHPullRefreshTableViewController.m 3 | // MessageDisplayExample 4 | // 5 | // Created by 曾 宪华 on 14-6-6. 6 | // Copyright (c) 2014年 曾宪华 开发团队(http://iyilunba.com ) 本人QQ:543413507 本人QQ群(142557668). All rights reserved. 7 | // 8 | 9 | #import "XHPullRefreshTableViewController.h" 10 | 11 | @interface XHPullRefreshTableViewController () 12 | 13 | @property (nonatomic, strong) XHRefreshControl *refreshControl; 14 | 15 | @end 16 | 17 | @implementation XHPullRefreshTableViewController 18 | 19 | - (void)startPullDownRefreshing { 20 | [self.refreshControl startPullDownRefreshing]; 21 | } 22 | 23 | - (void)endPullDownRefreshing { 24 | [self.refreshControl endPullDownRefreshing]; 25 | } 26 | 27 | - (void)endLoadMoreRefreshing { 28 | [self.refreshControl endLoadMoreRefresing]; 29 | } 30 | 31 | - (void)endMoreOverWithMessage:(NSString *)message { 32 | [self.refreshControl endMoreOverWithMessage:message]; 33 | } 34 | 35 | - (void)handleLoadMoreError { 36 | [self.refreshControl handleLoadMoreError]; 37 | } 38 | 39 | #pragma mark - Life Cycle 40 | 41 | - (void)setupRefreshControl { 42 | if (!_refreshControl) { 43 | _refreshControl = [[XHRefreshControl alloc] initWithScrollView:self.tableView delegate:self]; 44 | } 45 | } 46 | 47 | - (id)init { 48 | self = [super init]; 49 | if (self) { 50 | self.pullDownRefreshed = YES; 51 | self.loadMoreRefreshed = YES; 52 | } 53 | return self; 54 | } 55 | 56 | - (void)viewDidAppear:(BOOL)animated { 57 | [super viewDidAppear:animated]; 58 | if (self.pullDownRefreshed) { 59 | [self setupRefreshControl]; 60 | } 61 | } 62 | 63 | - (void)viewDidLoad { 64 | [super viewDidLoad]; 65 | // Do any additional setup after loading the view. 66 | 67 | 68 | } 69 | 70 | - (void)didReceiveMemoryWarning { 71 | [super didReceiveMemoryWarning]; 72 | // Dispose of any resources that can be recreated. 73 | } 74 | 75 | #pragma mark - XHRefreshControl Delegate 76 | 77 | - (void)beginPullDownRefreshing { 78 | self.requestCurrentPage = 0; 79 | [self loadDataSource]; 80 | } 81 | 82 | - (void)beginLoadMoreRefreshing { 83 | self.requestCurrentPage ++; 84 | [self loadDataSource]; 85 | } 86 | 87 | - (NSString *)lastUpdateTimeString { 88 | 89 | NSString *destDateString; 90 | destDateString = @"从未更新"; 91 | 92 | return destDateString; 93 | } 94 | 95 | - (NSInteger)autoLoadMoreRefreshedCountConverManual { 96 | return 5; 97 | } 98 | 99 | - (BOOL)isPullDownRefreshed { 100 | return self.pullDownRefreshed; 101 | } 102 | 103 | - (BOOL)isLoadMoreRefreshed { 104 | return self.loadMoreRefreshed; 105 | } 106 | 107 | - (XHRefreshViewLayerType)refreshViewLayerType { 108 | return XHRefreshViewLayerTypeOnScrollViews; 109 | } 110 | 111 | - (XHPullDownRefreshViewType)pullDownRefreshViewType { 112 | return self.refreshViewType; 113 | } 114 | 115 | - (NSString *)displayAutoLoadMoreRefreshedMessage { 116 | return @"点击显示下10条"; 117 | } 118 | 119 | @end 120 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/XHRefreshControl/RefreshControl/Controllers/SystemTableViewController/XHSysatemRefreshTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // XHSysatemRefreshTableViewController.h 3 | // XHRefreshControlExample 4 | // 5 | // Created by dw_iOS on 14-6-17. 6 | // Copyright (c) 2014年 嗨,我是曾宪华(@xhzengAIB),曾加入YY Inc.担任高级移动开发工程师,拍立秀App联合创始人,热衷于简洁、而富有理性的事物 QQ:543413507 主页:http://zengxianhua.com All rights reserved. 7 | // 8 | 9 | #import "XHSystemTableViewController.h" 10 | 11 | #import "XHRefreshControl.h" 12 | 13 | @interface XHSysatemRefreshTableViewController : XHSystemTableViewController 14 | 15 | /** 16 | * 是否支持下拉刷新 17 | */ 18 | @property (nonatomic, assign) BOOL pullDownRefreshed; 19 | 20 | /** 21 | * 是否支持上拉刷新 22 | */ 23 | @property (nonatomic, assign) BOOL loadMoreRefreshed; 24 | 25 | /** 26 | * 下拉刷新的样式 27 | */ 28 | @property (nonatomic, assign) XHPullDownRefreshViewType refreshViewType; 29 | 30 | /** 31 | * 加载数据的页码 32 | */ 33 | @property (nonatomic, assign) NSInteger requestCurrentPage; 34 | 35 | /** 36 | * 自动下拉刷新调用的方法,必须放在viewDidAppear方法内,别把这行代码放到别处,然后导致了错误,那就不好了嘛! 37 | */ 38 | - (void)startPullDownRefreshing; 39 | 40 | /** 41 | * 当下拉加载数据完成后,你必须调用该方法哦! 42 | */ 43 | - (void)endPullDownRefreshing; 44 | 45 | /** 46 | * 当上啦加载数据完成后,你也得调用该方法哦!然后你可能会问,那我要怎么判断是下拉还是上啦啊?requestCurrentPage看这个变量,会跟着变化哦! 47 | */ 48 | - (void)endLoadMoreRefreshing; 49 | 50 | /** 51 | * 当上啦加载数据回调告诉我们,已经没有下一页了,那你可以调用该方法,告诉用户你已经没有数据了哦! 52 | * 53 | * @param message 提示用户的信息 54 | */ 55 | - (void)endMoreOverWithMessage:(NSString *)message; 56 | 57 | /** 58 | * 当网络加载失败的时候,你必须调用该方法,如果你不调用,我也帮不了你了 59 | */ 60 | - (void)handleLoadMoreError; 61 | @end 62 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/XHRefreshControl/RefreshControl/Controllers/SystemTableViewController/XHSysatemRefreshTableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // XHSysatemRefreshTableViewController.m 3 | // XHRefreshControlExample 4 | // 5 | // Created by dw_iOS on 14-6-17. 6 | // Copyright (c) 2014年 嗨,我是曾宪华(@xhzengAIB),曾加入YY Inc.担任高级移动开发工程师,拍立秀App联合创始人,热衷于简洁、而富有理性的事物 QQ:543413507 主页:http://zengxianhua.com All rights reserved. 7 | // 8 | 9 | #import "XHSysatemRefreshTableViewController.h" 10 | 11 | @interface XHSysatemRefreshTableViewController () 12 | 13 | @property (nonatomic, strong) XHRefreshControl *customRefreshControl; 14 | 15 | @end 16 | 17 | @implementation XHSysatemRefreshTableViewController 18 | 19 | - (void)startPullDownRefreshing { 20 | [self.customRefreshControl startPullDownRefreshing]; 21 | } 22 | 23 | - (void)endPullDownRefreshing { 24 | [self.customRefreshControl endPullDownRefreshing]; 25 | } 26 | 27 | - (void)endLoadMoreRefreshing { 28 | [self.customRefreshControl endLoadMoreRefresing]; 29 | } 30 | 31 | - (void)endMoreOverWithMessage:(NSString *)message { 32 | [self.customRefreshControl endMoreOverWithMessage:message]; 33 | } 34 | 35 | - (void)handleLoadMoreError { 36 | [self.customRefreshControl handleLoadMoreError]; 37 | } 38 | 39 | #pragma mark - Life Cycle 40 | 41 | - (void)setupRefreshControl { 42 | if (!_customRefreshControl) { 43 | _customRefreshControl = [[XHRefreshControl alloc] initWithScrollView:self.tableView delegate:self]; 44 | } 45 | } 46 | 47 | - (id)init { 48 | self = [super init]; 49 | if (self) { 50 | self.pullDownRefreshed = YES; 51 | self.loadMoreRefreshed = YES; 52 | } 53 | return self; 54 | } 55 | 56 | - (void)viewDidAppear:(BOOL)animated { 57 | [super viewDidAppear:animated]; 58 | 59 | if (self.pullDownRefreshed) { 60 | [self setupRefreshControl]; 61 | } 62 | } 63 | 64 | - (void)viewDidLoad { 65 | [super viewDidLoad]; 66 | // Do any additional setup after loading the view. 67 | } 68 | 69 | - (void)didReceiveMemoryWarning { 70 | [super didReceiveMemoryWarning]; 71 | // Dispose of any resources that can be recreated. 72 | } 73 | 74 | - (void)dealloc { 75 | 76 | } 77 | 78 | #pragma mark - XHRefreshControl Delegate 79 | 80 | - (void)beginPullDownRefreshing { 81 | self.requestCurrentPage = 0; 82 | [self loadDataSource]; 83 | } 84 | 85 | - (void)beginLoadMoreRefreshing { 86 | self.requestCurrentPage ++; 87 | [self loadDataSource]; 88 | } 89 | 90 | - (NSDate *)lastUpdateTime { 91 | return [NSDate date]; 92 | } 93 | 94 | - (NSInteger)autoLoadMoreRefreshedCountConverManual { 95 | return 2; 96 | } 97 | 98 | - (BOOL)isPullDownRefreshed { 99 | return self.pullDownRefreshed; 100 | } 101 | 102 | - (BOOL)isLoadMoreRefreshed { 103 | return self.loadMoreRefreshed; 104 | } 105 | 106 | - (XHRefreshViewLayerType)refreshViewLayerType { 107 | return XHRefreshViewLayerTypeOnScrollViews; 108 | } 109 | 110 | - (XHPullDownRefreshViewType)pullDownRefreshViewType { 111 | return XHPullDownRefreshViewTypeActivityIndicator; 112 | } 113 | 114 | - (NSString *)displayAutoLoadMoreRefreshedMessage { 115 | return @"点击显示下10条"; 116 | } 117 | 118 | @end 119 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/XHRefreshControl/RefreshControl/Controllers/SystemTableViewController/XHSystemTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // XHXHSystemTableViewController.h 3 | // XHRefreshControlExample 4 | // 5 | // Created by dw_iOS on 14-6-17. 6 | // Copyright (c) 2014年 嗨,我是曾宪华(@xhzengAIB),曾加入YY Inc.担任高级移动开发工程师,拍立秀App联合创始人,热衷于简洁、而富有理性的事物 QQ:543413507 主页:http://zengxianhua.com All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | 12 | @interface XHSystemTableViewController : UITableViewController 13 | 14 | /** 15 | * 大量数据的数据源 16 | */ 17 | @property (nonatomic, strong) NSMutableArray *dataSource; 18 | /** 19 | * 加载本地或者网络数据源 20 | */ 21 | - (void)loadDataSource; 22 | 23 | /** 24 | * 去除iOS7新的功能api,tableView的分割线变成iOS6正常的样式 25 | */ 26 | - (void)configuraTableViewNormalSeparatorInset; 27 | 28 | /** 29 | * 配置tableView右侧的index title 背景颜色,因为在iOS7有白色底色,iOS6没有 30 | * 31 | * @param tableView 目标tableView 32 | */ 33 | - (void)configuraSectionIndexBackgroundColorWithTableView:(UITableView *)tableView; 34 | 35 | 36 | @end 37 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/XHRefreshControl/RefreshControl/Controllers/SystemTableViewController/XHSystemTableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // XHSystemTableViewController.m 3 | // XHRefreshControlExample 4 | // 5 | // Created by dw_iOS on 14-6-17. 6 | // Copyright (c) 2014年 嗨,我是曾宪华(@xhzengAIB),曾加入YY Inc.担任高级移动开发工程师,拍立秀App联合创始人,热衷于简洁、而富有理性的事物 QQ:543413507 主页:http://zengxianhua.com All rights reserved. 7 | // 8 | 9 | #import "XHSystemTableViewController.h" 10 | 11 | @interface XHSystemTableViewController () 12 | 13 | 14 | @end 15 | 16 | @implementation XHSystemTableViewController 17 | 18 | #pragma mark - Publish Method 19 | 20 | - (void)configuraTableViewNormalSeparatorInset { 21 | if ([self validateSeparatorInset]) { 22 | [self.tableView setSeparatorInset:UIEdgeInsetsZero]; 23 | } 24 | } 25 | 26 | - (void)configuraSectionIndexBackgroundColorWithTableView:(UITableView *)tableView { 27 | if ([tableView respondsToSelector:@selector(setSectionIndexBackgroundColor:)]) { 28 | tableView.sectionIndexBackgroundColor = [UIColor clearColor]; 29 | } 30 | } 31 | 32 | - (void)loadDataSource { 33 | // in subClass 34 | } 35 | 36 | #pragma mark - TableView Helper Method 37 | 38 | - (BOOL)validateSeparatorInset { 39 | if ([self.tableView respondsToSelector:@selector(setSeparatorInset:)]) { 40 | return YES; 41 | } 42 | return NO; 43 | } 44 | 45 | #pragma mark - UITableView DataSource 46 | 47 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 48 | return 1; 49 | } 50 | 51 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 52 | return self.dataSource.count; 53 | } 54 | 55 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 56 | // in subClass 57 | return nil; 58 | } 59 | 60 | 61 | @end 62 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/XHRefreshControl/RefreshControl/Manager/XHRefreshControl.h: -------------------------------------------------------------------------------- 1 | // 2 | // XHRefreshControl.h 3 | // MessageDisplayExample 4 | // 5 | // Created by 曾 宪华 on 14-6-6. 6 | // Copyright (c) 2014年 曾宪华 开发团队(http://iyilunba.com ) 本人QQ:543413507 本人QQ群(142557668). All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "XHRefreshControlHeader.h" 12 | 13 | @protocol XHRefreshControlDelegate 14 | 15 | @required 16 | /** 17 | * 1、将要开始下拉刷新的方法 18 | */ 19 | - (void)beginPullDownRefreshing; 20 | 21 | /** 22 | * 2、将要开始上提加载更多的方法 23 | */ 24 | - (void)beginLoadMoreRefreshing; 25 | 26 | @optional 27 | /** 28 | * 1、是否支持下拉刷新 29 | * 30 | * @return 如果没有实现该delegate方法,默认是支持下拉的,为YES 31 | */ 32 | - (BOOL)isPullDownRefreshed; 33 | 34 | /** 35 | * 2、是否支持上提加载更多 36 | * 37 | * @return 如果没有实现该delegate方法,默认是支持上提加载更多的,为YES 38 | */ 39 | - (BOOL)isLoadMoreRefreshed; 40 | 41 | /** 42 | * 3、标识下拉刷新是UIScrollView的子view,还是UIScrollView父view的子view 43 | * 44 | * @return 如果没有实现该delegate方法,默认是scrollView的子View,为XHRefreshViewLayerTypeOnScrollViews 45 | */ 46 | - (XHRefreshViewLayerType)refreshViewLayerType; 47 | 48 | /** 49 | * 4、下拉刷新使用哪种样式 50 | * 51 | * @return 如果没有实现该delegate方法,默认是网易新闻App的样式 52 | */ 53 | - (XHPullDownRefreshViewType)pullDownRefreshViewType; 54 | 55 | /** 56 | * 5、将自动加载更多的状态转换为手动加载需要的条件,现在是加载更多多少次后,开始转换 57 | * 58 | * @return 如果不实现该delegate方法,默认是5次 59 | */ 60 | - (NSInteger)autoLoadMoreRefreshedCountConverManual; 61 | 62 | /** 63 | * 6、获取用户定义下拉的View 64 | * 65 | * @return 返回用户定义的View 66 | */ 67 | - (UIView *)customPullDownRefreshView; 68 | 69 | /** 70 | * 7、通知外部,下拉的距离,用于定制某个时机的状态 71 | * 72 | * @param refreshView 需要改变状态的View 73 | * @param pullDownOffset 下拉的距离 74 | */ 75 | - (void)customPullDownRefreshView:(UIView *)customPullDownRefreshView withPullDownOffset:(CGFloat)pullDownOffset; 76 | 77 | /** 78 | * 8、将要下拉的时候,被调用 79 | * 80 | * @param customPullDownRefreshView 目标下拉的View 81 | */ 82 | - (void)customPullDownRefreshViewWillStartRefresh:(UIView *)customPullDownRefreshView; 83 | 84 | /** 85 | * 9、将要停止下啦的时候,被调用 86 | * 87 | * @param customPullDownRefreshView 目标下啦的View 88 | */ 89 | - (void)customPullDownRefreshViewWillEndRefresh:(UIView *)customPullDownRefreshView; 90 | 91 | /** 92 | * 10、加载更多的按钮,默认是网易新闻App的样式,如果你需要自己定制的话,可以,那你实现该Delegate方法 93 | */ 94 | - (UIButton *)customLoadMoreButton; 95 | 96 | /** 97 | * 11、最后更新数据的时间 98 | * 99 | * @return 返回缓存最后更新某个页面的时间 100 | */ 101 | - (NSString *)lastUpdateTimeString; 102 | 103 | /** 104 | * 12、用于显示手动上提加载更多的提示字眼 105 | * 106 | * @return 如果没有实现该Delegate,默认显示为显示下20条的字眼 107 | */ 108 | - (NSString *)displayAutoLoadMoreRefreshedMessage; 109 | 110 | 111 | @end 112 | 113 | @interface XHRefreshControl : NSObject 114 | 115 | - (id)initWithScrollView:(UIScrollView *)scrollView delegate:(id )delegate; 116 | 117 | /** 118 | * 外部手动启动下拉加载的方法,这个方法不需要手动去拖动UIScrollView 119 | */ 120 | - (void)startPullDownRefreshing; 121 | 122 | /** 123 | * 停止下拉刷新的方法 124 | */ 125 | - (void)endPullDownRefreshing; 126 | 127 | /** 128 | * 停止上提加载更多的方法 129 | */ 130 | - (void)endLoadMoreRefresing; 131 | 132 | /** 133 | * 没有更多的数据加载 134 | */ 135 | - (void)endMoreOverWithMessage:(NSString *)message; 136 | 137 | /** 138 | * 当加载更多出现网络错误的时候 139 | */ 140 | - (void)handleLoadMoreError; 141 | 142 | @end 143 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/XHRefreshControl/RefreshControl/Manager/XHRefreshControlHeader.h: -------------------------------------------------------------------------------- 1 | // 2 | // XHRefreshControlHeader.h 3 | // XHRefreshControlExample 4 | // 5 | // Created by dw_iOS on 14-7-3. 6 | // Copyright (c) 2014年 嗨,我是曾宪华(@xhzengAIB),曾加入YY Inc.担任高级移动开发工程师,拍立秀App联合创始人,热衷于简洁、而富有理性的事物 QQ:543413507 主页:http://zengxianhua.com All rights reserved. 7 | // 8 | 9 | #ifndef XHRefreshControlExample_XHRefreshControlHeader_h 10 | #define XHRefreshControlExample_XHRefreshControlHeader_h 11 | 12 | typedef NS_ENUM(NSInteger, XHRefreshViewLayerType) { 13 | XHRefreshViewLayerTypeOnSuperView = 0, 14 | XHRefreshViewLayerTypeOnScrollViews = 1, 15 | }; 16 | 17 | typedef NS_ENUM(NSInteger, XHPullDownRefreshViewType) { 18 | XHPullDownRefreshViewTypeCircle = 0, 19 | XHPullDownRefreshViewTypeActivityIndicator = 1, 20 | XHPullDownRefreshViewTypeCustom = 2, 21 | }; 22 | 23 | #endif 24 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/XHRefreshControl/RefreshControl/Views/XHActivityCircleIndicatorView.h: -------------------------------------------------------------------------------- 1 | // 2 | // XHActivityCircleIndicatorView.h 3 | // XHRefreshControlExample 4 | // 5 | // Created by 曾 宪华 on 14-6-16. 6 | // Copyright (c) 2014年 嗨,我是曾宪华(@xhzengAIB),曾加入YY Inc.担任高级移动开发工程师,拍立秀App联合创始人,热衷于简洁、而富有理性的事物 QQ:543413507 主页:http://zengxianhua.com All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "XHRefreshControlHeader.h" 12 | 13 | @interface XHActivityCircleIndicatorView : UIView 14 | 15 | /** 16 | * 菊花的颜色 17 | */ 18 | @property (nonatomic, copy) UIColor *tintColor; 19 | 20 | /** 21 | * 外部设置滑动距离 22 | */ 23 | @property (nonatomic, assign) CGFloat timeOffset; // 0.0 ~ 1.0 24 | 25 | /** 26 | * 标识下拉刷新是UIScrollView的子view,还是UIScrollView父view的子view, 默认是scrollView的子View,为XHRefreshViewLayerTypeOnScrollViews 27 | */ 28 | @property (nonatomic, assign) XHRefreshViewLayerType refreshViewLayerType; 29 | 30 | /** 31 | * 开始动画加载 32 | */ 33 | - (void)beginRefreshing; 34 | 35 | /** 36 | * 结束动画加载 37 | */ 38 | - (void)endRefreshing; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/XHRefreshControl/RefreshControl/Views/XHActivityCircleIndicatorView.m: -------------------------------------------------------------------------------- 1 | // 2 | // XHActivityCircleIndicatorView.m 3 | // XHRefreshControlExample 4 | // 5 | // Created by 曾 宪华 on 14-6-16. 6 | // Copyright (c) 2014年 嗨,我是曾宪华(@xhzengAIB),曾加入YY Inc.担任高级移动开发工程师,拍立秀App联合创始人,热衷于简洁、而富有理性的事物 QQ:543413507 主页:http://zengxianhua.com All rights reserved. 7 | // 8 | 9 | #import "XHActivityCircleIndicatorView.h" 10 | 11 | static NSString* const kXHRotationAnimation = @"XHRotationAnimation"; 12 | 13 | @interface XHActivityCircleIndicatorView () 14 | 15 | @property (nonatomic, strong) CALayer *standbyLayer; 16 | @property (nonatomic, strong) CALayer *animationLayer; 17 | 18 | @property (nonatomic, strong) NSMutableArray *standbyLayersArray; 19 | @property (nonatomic, strong) NSMutableArray *animationLayerArray; 20 | 21 | @property (nonatomic, assign) BOOL isRotating; 22 | 23 | @end 24 | 25 | @implementation XHActivityCircleIndicatorView 26 | 27 | - (void)setup { 28 | self.standbyLayersArray = [[NSMutableArray alloc] init]; 29 | self.animationLayerArray = [[NSMutableArray alloc] init]; 30 | 31 | self.isRotating = NO; 32 | 33 | self.standbyLayer = [[CALayer alloc] init]; 34 | self.standbyLayer.frame = CGRectMake(0, 0, 1, 3); 35 | self.standbyLayer.anchorPoint = CGPointMake(0, 0.0); 36 | [self.layer addSublayer:self.standbyLayer]; 37 | 38 | self.animationLayer = [[CALayer alloc] init]; 39 | self.animationLayer.frame = CGRectMake(0, 0, 1, 3); 40 | self.animationLayer.anchorPoint = CGPointMake(0, 0.0); 41 | [self.layer addSublayer:self.animationLayer]; 42 | 43 | self.tintColor = [UIColor colorWithRed:0.093 green:0.532 blue:1.000 alpha:1.000]; 44 | 45 | [self createAnimationLayers]; 46 | [self createStandbyLayers]; 47 | 48 | self.animationLayer.hidden = YES; 49 | } 50 | 51 | - (instancetype)initWithFrame:(CGRect)frame { 52 | self = [super initWithFrame:frame]; 53 | if (self) { 54 | // Initialization code 55 | } 56 | return self; 57 | } 58 | 59 | - (void)willMoveToSuperview:(UIView *)newSuperview { 60 | if (newSuperview) { 61 | [self setup]; 62 | } 63 | } 64 | 65 | - (void)dealloc { 66 | self.tintColor = nil; 67 | 68 | self.standbyLayer = nil; 69 | 70 | self.animationLayer = nil; 71 | 72 | self.standbyLayersArray = nil; 73 | 74 | self.animationLayerArray = nil; 75 | } 76 | 77 | #pragma mark - Public methods 78 | 79 | - (void)setTintColor:(UIColor *)tintColor { 80 | _tintColor = tintColor; 81 | 82 | for (CALayer *layer in self.standbyLayersArray) { 83 | layer.backgroundColor = tintColor.CGColor; 84 | } 85 | 86 | for (CALayer *layer in self.animationLayerArray) { 87 | layer.backgroundColor = tintColor.CGColor; 88 | } 89 | } 90 | 91 | - (void)setTimeOffset:(CGFloat)timeOffset { 92 | _timeOffset = timeOffset; 93 | 94 | if (self.isRotating) { 95 | return; 96 | } 97 | 98 | CGFloat showingOffset = timeOffset * 12.0 - 1; 99 | 100 | for (int i = 0; i < 12; i ++) { 101 | CALayer *layer = self.standbyLayersArray[i]; 102 | if (i < showingOffset) { 103 | layer.hidden = NO; 104 | } else { 105 | layer.hidden = YES; 106 | } 107 | } 108 | } 109 | 110 | - (void)beginRefreshing { 111 | self.isRotating = YES; 112 | [self.standbyLayer addAnimation:[self createRotationAnimation] forKey:kXHRotationAnimation]; 113 | [self addOpacityAnimationForAnimationLayers]; 114 | } 115 | 116 | - (void)addOpacityAnimationForAnimationLayers { 117 | [self.animationLayerArray enumerateObjectsUsingBlock:^(CALayer *animationLayer, NSUInteger idx, BOOL *stop) { 118 | CAAnimation *animation = [self createOpacityAnimationWithIndex:idx]; 119 | [animationLayer addAnimation:animation forKey:[NSString stringWithFormat:@"key %lu", (unsigned long)idx]]; 120 | }]; 121 | } 122 | 123 | - (void)removeOpacityAnimationForAnimationLayers { 124 | [self.animationLayerArray enumerateObjectsUsingBlock:^(CALayer *animationLayer, NSUInteger idx, BOOL *stop) { 125 | [animationLayer removeAnimationForKey:[NSString stringWithFormat:@"key %lu", (unsigned long)idx]]; 126 | }]; 127 | } 128 | 129 | - (void)endRefreshing { 130 | [UIView animateWithDuration:0.3 animations:^{ 131 | self.animationLayer.transform = CATransform3DMakeScale(0.1, 0.1, 0.1); 132 | self.animationLayer.opacity = 0.8f; 133 | } completion:^(BOOL finished) { 134 | self.animationLayer.transform = CATransform3DIdentity; 135 | self.animationLayer.opacity = 1.0f; 136 | self.animationLayer.hidden = YES; 137 | [self removeOpacityAnimationForAnimationLayers]; 138 | self.standbyLayer.hidden = NO; 139 | self.timeOffset = 0.0; 140 | }]; 141 | } 142 | 143 | #pragma mark - Private methods 144 | 145 | - (void)createStandbyLayers { 146 | for (int i = 0; i < 12; i ++) { 147 | CALayer *layer = [self createLayer]; 148 | 149 | layer.transform = CATransform3DMakeRotation(M_PI / 6 * i + (self.refreshViewLayerType ? M_PI : 0), 0, 0, 1); 150 | 151 | layer.hidden = YES; 152 | 153 | [self.standbyLayer addSublayer:layer]; 154 | [self.standbyLayersArray addObject:layer]; 155 | } 156 | } 157 | 158 | - (void)createAnimationLayers { 159 | for (int i = 0; i < 12; i ++) { 160 | CALayer *layer = [self createLayer]; 161 | 162 | layer.transform = CATransform3DMakeRotation(M_PI / 6 * i, 0, 0, 1); 163 | 164 | [self.animationLayer addSublayer:layer]; 165 | 166 | [self.animationLayerArray addObject:layer]; 167 | } 168 | } 169 | 170 | - (CALayer *)createLayer { 171 | CALayer *rectLayer = [[CALayer alloc] init]; 172 | rectLayer.backgroundColor = self.tintColor.CGColor; 173 | rectLayer.frame = CGRectMake(-1, -3, 2, 6); 174 | rectLayer.anchorPoint = CGPointMake(0.5, 2.0); 175 | rectLayer.allowsEdgeAntialiasing = YES; 176 | rectLayer.cornerRadius = 1.0f; 177 | 178 | return rectLayer; 179 | } 180 | 181 | - (CAAnimation *)createOpacityAnimationWithIndex:(NSInteger)index { 182 | CABasicAnimation *opacityAnimation = [CABasicAnimation animationWithKeyPath:@"opacity"]; 183 | opacityAnimation.fromValue = [NSNumber numberWithFloat:1]; 184 | opacityAnimation.toValue = [NSNumber numberWithFloat:0]; 185 | opacityAnimation.duration = 1.0f; 186 | opacityAnimation.repeatCount = NSIntegerMax; 187 | opacityAnimation.speed = 1.0f; 188 | opacityAnimation.timeOffset = 1.0f - index/12.0f; 189 | 190 | return opacityAnimation; 191 | } 192 | 193 | - (CAAnimation *)createRotationAnimation { 194 | CABasicAnimation *rotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation"]; 195 | rotationAnimation.fromValue = [NSNumber numberWithFloat:0]; 196 | rotationAnimation.toValue = [NSNumber numberWithFloat:M_PI_2]; 197 | rotationAnimation.duration = 0.5f; 198 | rotationAnimation.repeatCount = 1; 199 | rotationAnimation.speed = 1.0f; 200 | rotationAnimation.delegate = self; 201 | rotationAnimation.removedOnCompletion = YES; 202 | 203 | return rotationAnimation; 204 | } 205 | 206 | - (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag { 207 | self.isRotating = NO; 208 | 209 | self.standbyLayer.hidden = YES; 210 | self.animationLayer.hidden = NO; 211 | } 212 | 213 | @end 214 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/XHRefreshControl/RefreshControl/Views/XHCircleView.h: -------------------------------------------------------------------------------- 1 | // 2 | // XHCircleView.h 3 | // MessageDisplayExample 4 | // 5 | // Created by 曾 宪华 on 14-6-6. 6 | // Copyright (c) 2014年 曾宪华 开发团队(http://iyilunba.com ) 本人QQ:543413507 本人QQ群(142557668). All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "XHRefreshControlHeader.h" 12 | 13 | // 开始画圆圈时的offset 14 | #define kXHRefreshCircleViewHeight 20 15 | 16 | @interface XHCircleView : UIView 17 | 18 | /** 19 | * 圆圈开始旋转时的offset (即开始刷新数据时) 20 | */ 21 | @property (nonatomic, assign) CGFloat heightBeginToRefresh; 22 | 23 | /** 24 | * offset的Y值 25 | */ 26 | @property (nonatomic, assign) CGFloat offsetY; 27 | 28 | /** 29 | * 标识下拉刷新是UIScrollView的子view,还是UIScrollView父view的子view, 默认是scrollView的子View,为XHRefreshViewLayerTypeOnScrollViews 30 | */ 31 | @property (nonatomic, assign) XHRefreshViewLayerType refreshViewLayerType; 32 | 33 | /** 34 | * 旋转的animation 35 | * 36 | * @return animation 37 | */ 38 | + (CABasicAnimation*)repeatRotateAnimation; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/XHRefreshControl/RefreshControl/Views/XHCircleView.m: -------------------------------------------------------------------------------- 1 | // 2 | // XHCircleView.m 3 | // MessageDisplayExample 4 | // 5 | // Created by 曾 宪华 on 14-6-6. 6 | // Copyright (c) 2014年 曾宪华 开发团队(http://iyilunba.com ) 本人QQ:543413507 本人QQ群(142557668). All rights reserved. 7 | // 8 | 9 | #import "XHCircleView.h" 10 | 11 | @implementation XHCircleView 12 | 13 | - (void)setOffsetY:(CGFloat)offsetY { 14 | _offsetY = offsetY; 15 | [self setNeedsDisplay]; 16 | } 17 | 18 | - (id)initWithFrame:(CGRect)frame { 19 | self = [super initWithFrame:frame]; 20 | if (self) { 21 | _heightBeginToRefresh = 40; 22 | _offsetY = 0; 23 | 24 | self.backgroundColor = [UIColor clearColor]; 25 | } 26 | return self; 27 | } 28 | 29 | + (CABasicAnimation*)repeatRotateAnimation { 30 | CABasicAnimation *rotateAni = [CABasicAnimation animationWithKeyPath: @"transform.rotation.z"]; 31 | rotateAni.duration = 0.25; 32 | rotateAni.cumulative = YES; 33 | rotateAni.removedOnCompletion = NO; 34 | rotateAni.fillMode = kCAFillModeForwards; 35 | rotateAni.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear]; 36 | rotateAni.toValue = [NSNumber numberWithFloat:M_PI / 2]; 37 | rotateAni.repeatCount = MAXFLOAT; 38 | 39 | return rotateAni; 40 | } 41 | 42 | - (void)drawRect:(CGRect)rect { 43 | 44 | CGContextRef context = UIGraphicsGetCurrentContext(); 45 | 46 | CGContextSetStrokeColorWithColor(context, [UIColor colorWithRed:173 / 255.0 green:53 / 255.0 blue:60 / 255.0 alpha:1].CGColor); 47 | CGContextSetLineWidth(context, 1.f); 48 | 49 | static CGFloat radius = 9; 50 | if (self.refreshViewLayerType) { 51 | static CGFloat startAngle = M_PI / 2; 52 | CGFloat endAngle = (ABS(_offsetY) / _heightBeginToRefresh) * (M_PI * 19 / 10) + startAngle; 53 | CGContextAddArc(context, CGRectGetWidth(self.frame) / 2, CGRectGetHeight(self.frame) / 2, radius, startAngle, endAngle, 0); 54 | } else { 55 | static CGFloat startAngle = 3 * M_PI / 2.0; 56 | CGFloat endAngle = (ABS(_offsetY) / _heightBeginToRefresh) * (M_PI * 19 / 10) + startAngle; 57 | CGContextAddArc(context, CGRectGetWidth(self.frame) / 2, CGRectGetHeight(self.frame) / 2, radius, startAngle, endAngle, 0); 58 | } 59 | CGContextDrawPath(context, kCGPathStroke); 60 | } 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/XHRefreshControl/RefreshControl/Views/XHLoadMoreView.h: -------------------------------------------------------------------------------- 1 | // 2 | // XHLoadMoreView.h 3 | // MessageDisplayExample 4 | // 5 | // Created by 曾 宪华 on 14-6-6. 6 | // Copyright (c) 2014年 曾宪华 开发团队(http://iyilunba.com ) 本人QQ:543413507 本人QQ群(142557668). All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #define kXHLoadMoreViewHeight 50 12 | 13 | @interface XHLoadMoreView : UIView 14 | 15 | /** 16 | * 加载更多的按钮 17 | */ 18 | @property (nonatomic, strong) UIButton *loadMoreButton; 19 | 20 | /** 21 | * 当外部需要自定义加载更多的按钮时,需要通过该方法进行覆盖原本的按钮 22 | * 23 | * @param customLoadMoreButton 目标自定义加载更多按钮 24 | */ 25 | - (void)setupCustomLoadMoreButton:(UIButton *)customLoadMoreButton; 26 | 27 | /** 28 | * 开始加载 29 | */ 30 | - (void)startLoading; 31 | 32 | /** 33 | * 结束加载 34 | */ 35 | - (void)endLoading; 36 | 37 | /** 38 | * 设置手动加载更多的UI 39 | */ 40 | - (void)configuraManualStateWithMessage:(NSString *)message; 41 | 42 | /** 43 | * 当外部加载更多数据的时候,发现没有数据了,可以进行设置一些提示字眼 44 | * 45 | * @param message 被显示的目标文本 46 | */ 47 | - (void)configuraNothingMoreWithMessage:(NSString *)message; 48 | 49 | @end 50 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/XHRefreshControl/RefreshControl/Views/XHLoadMoreView.m: -------------------------------------------------------------------------------- 1 | // 2 | // XHLoadMoreView.m 3 | // MessageDisplayExample 4 | // 5 | // Created by 曾 宪华 on 14-6-6. 6 | // Copyright (c) 2014年 曾宪华 开发团队(http://iyilunba.com ) 本人QQ:543413507 本人QQ群(142557668). All rights reserved. 7 | // 8 | 9 | #import "XHLoadMoreView.h" 10 | 11 | @interface XHLoadMoreView () 12 | 13 | /** 14 | * 系统默认菊花控件 15 | */ 16 | @property (nonatomic, strong) UIActivityIndicatorView *activityIndicatorView; 17 | 18 | @end 19 | 20 | @implementation XHLoadMoreView 21 | 22 | - (void)startLoading { 23 | self.loadMoreButton.userInteractionEnabled = NO; 24 | [self.loadMoreButton setTitle:@"正在载入" forState:UIControlStateNormal]; 25 | [self.activityIndicatorView startAnimating]; 26 | } 27 | 28 | - (void)endLoading { 29 | self.loadMoreButton.userInteractionEnabled = NO; 30 | [self.loadMoreButton setTitle:@"加载更多" forState:UIControlStateNormal]; 31 | [self.activityIndicatorView stopAnimating]; 32 | } 33 | 34 | - (void)configuraManualStateWithMessage:(NSString *)message { 35 | self.loadMoreButton.userInteractionEnabled = YES; 36 | [self.loadMoreButton setTitle:message forState:UIControlStateNormal]; 37 | } 38 | 39 | - (void)configuraNothingMoreWithMessage:(NSString *)message { 40 | self.loadMoreButton.userInteractionEnabled = NO; 41 | [self.loadMoreButton setTitle:message forState:UIControlStateNormal]; 42 | } 43 | 44 | - (void)setupCustomLoadMoreButton:(UIButton *)customLoadMoreButton { 45 | customLoadMoreButton.frame = self.loadMoreButton.frame; 46 | if (_loadMoreButton) { 47 | [_loadMoreButton removeFromSuperview]; 48 | _loadMoreButton = nil; 49 | } 50 | _loadMoreButton = customLoadMoreButton; 51 | [self insertSubview:_loadMoreButton atIndex:0]; 52 | } 53 | 54 | #pragma mark - Propertys 55 | 56 | - (UIButton *)loadMoreButton { 57 | if (!_loadMoreButton) { 58 | _loadMoreButton = [[UIButton alloc] initWithFrame:CGRectMake(10, 5, CGRectGetWidth(self.bounds) - 20, CGRectGetHeight(self.bounds) - 10)]; 59 | [_loadMoreButton setTitle:@"加载更多" forState:UIControlStateNormal]; 60 | _loadMoreButton.titleLabel.font = [UIFont systemFontOfSize:16]; 61 | [_loadMoreButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal]; 62 | [_loadMoreButton setBackgroundColor:[UIColor colorWithWhite:0.922 alpha:1.000]]; 63 | } 64 | return _loadMoreButton; 65 | } 66 | 67 | - (UIActivityIndicatorView *)activityIndicatorView { 68 | if (!_activityIndicatorView) { 69 | _activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]; 70 | _activityIndicatorView.hidesWhenStopped = YES; 71 | _activityIndicatorView.center = CGPointMake(CGRectGetWidth(self.bounds) / 3, CGRectGetHeight(self.bounds) / 2.0); 72 | } 73 | return _activityIndicatorView; 74 | } 75 | 76 | #pragma mark - Life Cycle 77 | 78 | - (id)initWithFrame:(CGRect)frame { 79 | self = [super initWithFrame:frame]; 80 | if (self) { 81 | // Initialization code 82 | self.backgroundColor = [UIColor clearColor]; 83 | [self addSubview:self.loadMoreButton]; 84 | [self addSubview:self.activityIndicatorView]; 85 | } 86 | return self; 87 | } 88 | 89 | - (void)dealloc { 90 | _loadMoreButton = nil; 91 | _activityIndicatorView = nil; 92 | } 93 | 94 | @end 95 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/XHRefreshControl/RefreshControl/Views/XHRefreshActivityIndicatorContainerView.h: -------------------------------------------------------------------------------- 1 | // 2 | // XHRefreshActivityIndicatorContainerView.h 3 | // XHRefreshControlExample 4 | // 5 | // Created by 曾 宪华 on 14-6-16. 6 | // Copyright (c) 2014年 嗨,我是曾宪华(@xhzengAIB),曾加入YY Inc.担任高级移动开发工程师,拍立秀App联合创始人,热衷于简洁、而富有理性的事物 QQ:543413507 主页:http://zengxianhua.com All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "XHActivityCircleIndicatorView.h" 12 | 13 | #import "XHRefreshControlHeader.h" 14 | 15 | @interface XHRefreshActivityIndicatorContainerView : UIView 16 | 17 | /** 18 | * iOS7自定义菊花转圈控件 19 | */ 20 | @property (nonatomic, strong) XHActivityCircleIndicatorView *activityIndicatorView; 21 | 22 | /** 23 | * 标识下拉刷新是UIScrollView的子view,还是UIScrollView父view的子view, 默认是scrollView的子View,为XHRefreshViewLayerTypeOnScrollViews 24 | */ 25 | @property (nonatomic, assign) XHRefreshViewLayerType refreshViewLayerType; 26 | 27 | @end 28 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/XHRefreshControl/RefreshControl/Views/XHRefreshActivityIndicatorContainerView.m: -------------------------------------------------------------------------------- 1 | // 2 | // XHRefreshActivityIndicatorContainerView.m 3 | // XHRefreshControlExample 4 | // 5 | // Created by 曾 宪华 on 14-6-16. 6 | // Copyright (c) 2014年 嗨,我是曾宪华(@xhzengAIB),曾加入YY Inc.担任高级移动开发工程师,拍立秀App联合创始人,热衷于简洁、而富有理性的事物 QQ:543413507 主页:http://zengxianhua.com All rights reserved. 7 | // 8 | 9 | #import "XHRefreshActivityIndicatorContainerView.h" 10 | 11 | @interface XHRefreshActivityIndicatorContainerView () 12 | 13 | @end 14 | 15 | @implementation XHRefreshActivityIndicatorContainerView 16 | 17 | #pragma mark - Propertys 18 | 19 | - (void)setRefreshViewLayerType:(XHRefreshViewLayerType)refreshViewLayerType { 20 | _refreshViewLayerType = refreshViewLayerType; 21 | 22 | CGRect activityIndicatorViewFrame; 23 | switch (refreshViewLayerType) { 24 | case XHRefreshViewLayerTypeOnSuperView: 25 | activityIndicatorViewFrame = CGRectMake(CGRectGetWidth(self.bounds) / 2.0, CGRectGetHeight(self.bounds) * 0.4, 0, 0); 26 | break; 27 | case XHRefreshViewLayerTypeOnScrollViews: 28 | activityIndicatorViewFrame = CGRectMake(CGRectGetWidth(self.bounds) / 2.0, CGRectGetHeight(self.bounds) * 0.6, 0, 0); 29 | break; 30 | default: 31 | break; 32 | } 33 | self.activityIndicatorView.frame = activityIndicatorViewFrame; 34 | } 35 | 36 | - (XHActivityCircleIndicatorView *)activityIndicatorView { 37 | if (!_activityIndicatorView) { 38 | _activityIndicatorView = [[XHActivityCircleIndicatorView alloc] initWithFrame:CGRectMake(CGRectGetWidth(self.bounds) / 2.0, CGRectGetHeight(self.bounds) * 0.6, 0, 0)]; 39 | _activityIndicatorView.refreshViewLayerType = self.refreshViewLayerType; 40 | 41 | } 42 | return _activityIndicatorView; 43 | } 44 | 45 | #pragma mark - Life Cycle 46 | 47 | - (instancetype)initWithFrame:(CGRect)frame { 48 | self = [super initWithFrame:frame]; 49 | if (self) { 50 | // Initialization code 51 | } 52 | return self; 53 | } 54 | 55 | - (void)willMoveToSuperview:(UIView *)newSuperview { 56 | if (newSuperview) { 57 | [self addSubview:self.activityIndicatorView]; 58 | } 59 | } 60 | 61 | - (void)dealloc { 62 | _activityIndicatorView = nil; 63 | } 64 | 65 | @end 66 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/XHRefreshControl/RefreshControl/Views/XHRefreshCircleContainerView.h: -------------------------------------------------------------------------------- 1 | // 2 | // XHRefreshView.h 3 | // MessageDisplayExample 4 | // 5 | // Created by 曾 宪华 on 14-6-6. 6 | // Copyright (c) 2014年 曾宪华 开发团队(http://iyilunba.com ) 本人QQ:543413507 本人QQ群(142557668). All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "XHCircleView.h" 12 | 13 | @interface XHRefreshCircleContainerView : UIView 14 | 15 | /** 16 | * 线条圆形的控件 17 | */ 18 | @property (nonatomic, strong) XHCircleView *circleView; 19 | 20 | /** 21 | * 提示下拉刷新状态的标签 22 | */ 23 | @property (nonatomic, strong) UILabel *stateLabel; 24 | 25 | /** 26 | * 提示最后更新时间的标签 27 | */ 28 | @property (nonatomic, strong) UILabel *timeLabel; 29 | 30 | @end 31 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/Pods/XHRefreshControl/RefreshControl/Views/XHRefreshCircleContainerView.m: -------------------------------------------------------------------------------- 1 | // 2 | // XHRefreshView.m 3 | // MessageDisplayExample 4 | // 5 | // Created by 曾 宪华 on 14-6-6. 6 | // Copyright (c) 2014年 曾宪华 开发团队(http://iyilunba.com ) 本人QQ:543413507 本人QQ群(142557668). All rights reserved. 7 | // 8 | 9 | #import "XHRefreshCircleContainerView.h" 10 | 11 | @interface XHRefreshCircleContainerView () 12 | 13 | @end 14 | 15 | @implementation XHRefreshCircleContainerView 16 | 17 | #pragma mark - Propertys 18 | 19 | - (XHCircleView *)circleView { 20 | if (!_circleView) { 21 | _circleView = [[XHCircleView alloc] initWithFrame:CGRectMake((CGRectGetWidth(self.bounds) - kXHRefreshCircleViewHeight) / 2 - 40, (CGRectGetHeight(self.bounds) - kXHRefreshCircleViewHeight) / 2 - 5, kXHRefreshCircleViewHeight, kXHRefreshCircleViewHeight)]; 22 | } 23 | return _circleView; 24 | } 25 | 26 | - (UILabel *)stateLabel { 27 | if (!_stateLabel) { 28 | _stateLabel = [[UILabel alloc] initWithFrame:CGRectMake(CGRectGetMaxX(self.circleView.frame) + 5, CGRectGetMinY(self.circleView.frame), 160, 14)]; 29 | _stateLabel.backgroundColor = [UIColor clearColor]; 30 | _stateLabel.font = [UIFont systemFontOfSize:14.f]; 31 | _stateLabel.textColor = [UIColor blackColor]; 32 | } 33 | return _stateLabel; 34 | } 35 | 36 | - (UILabel *)timeLabel { 37 | if (!_timeLabel) { 38 | CGRect timeLabelFrame = self.stateLabel.frame; 39 | timeLabelFrame.origin.y += CGRectGetHeight(timeLabelFrame) + 6; 40 | _timeLabel = [[UILabel alloc] initWithFrame:timeLabelFrame]; 41 | _timeLabel.backgroundColor = [UIColor clearColor]; 42 | _timeLabel.font = [UIFont systemFontOfSize:11.f]; 43 | _timeLabel.textColor = [UIColor colorWithWhite:0.659 alpha:1.000]; 44 | } 45 | return _timeLabel; 46 | } 47 | 48 | #pragma mark - Life Cycle 49 | 50 | - (id)initWithFrame:(CGRect)frame { 51 | self = [super initWithFrame:frame]; 52 | if (self) { 53 | // Initialization code 54 | self.backgroundColor = [UIColor whiteColor]; 55 | [self addSubview:self.circleView]; 56 | [self addSubview:self.stateLabel]; 57 | [self addSubview:self.timeLabel]; 58 | } 59 | return self; 60 | } 61 | 62 | - (void)dealloc { 63 | _circleView = nil; 64 | _stateLabel = nil; 65 | _timeLabel = nil; 66 | } 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample.xcodeproj/project.xcworkspace/xcshareddata/XHTwitterPaggingViewerExample.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 06AF9911-C7D9-4A3A-ACCC-76F519A74154 9 | IDESourceControlProjectName 10 | XHTwitterPaggingViewerExample 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 01FC7A01-F564-4A12-805F-42881BD2EAE6 14 | https://github.com/xhzengAIB/TwitterPaggingViewer.git 15 | 16 | IDESourceControlProjectPath 17 | Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 01FC7A01-F564-4A12-805F-42881BD2EAE6 21 | ../../../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/xhzengAIB/TwitterPaggingViewer.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | 01FC7A01-F564-4A12-805F-42881BD2EAE6 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 01FC7A01-F564-4A12-805F-42881BD2EAE6 36 | IDESourceControlWCCName 37 | TwitterPaggingViewer 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample.xcodeproj/xcuserdata/JackMacbook.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample.xcodeproj/xcuserdata/JackMacbook.xcuserdatad/xcschemes/XHTwitterPaggingViewerExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample.xcodeproj/xcuserdata/JackMacbook.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | XHTwitterPaggingViewerExample.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | ABFA681F195510C800335010 16 | 17 | primary 18 | 19 | 20 | ABFA683A195510C800335010 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample.xcodeproj/xcuserdata/dw_ios.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample.xcodeproj/xcuserdata/dw_ios.xcuserdatad/xcschemes/XHTwitterPaggingViewerExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample.xcodeproj/xcuserdata/dw_ios.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | XHTwitterPaggingViewerExample.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | ABFA681F195510C800335010 16 | 17 | primary 18 | 19 | 20 | ABFA683A195510C800335010 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample.xcworkspace/xcshareddata/XHTwitterPaggingViewerExample.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 9BAF0C9C-A2C6-408C-AE55-C32D21C753B9 9 | IDESourceControlProjectName 10 | XHTwitterPaggingViewerExample 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | FDCD7AE640D28D7281A83FC676144608A8E938E9 14 | https://github.com/xhzengAIB/TwitterPaggingViewer.git 15 | 16 | IDESourceControlProjectPath 17 | Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | FDCD7AE640D28D7281A83FC676144608A8E938E9 21 | ../../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/xhzengAIB/TwitterPaggingViewer.git 25 | IDESourceControlProjectVersion 26 | 111 27 | IDESourceControlProjectWCCIdentifier 28 | FDCD7AE640D28D7281A83FC676144608A8E938E9 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | FDCD7AE640D28D7281A83FC676144608A8E938E9 36 | IDESourceControlWCCName 37 | TwitterPaggingViewer 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample.xcworkspace/xcuserdata/dw_ios.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // XHTwitterPaggingViewerExample 4 | // 5 | // Created by 曾 宪华 on 14-6-21. 6 | // Copyright (c) 2014年 嗨,我是曾宪华(@xhzengAIB),曾加入YY Inc.担任高级移动开发工程师,拍立秀App联合创始人,热衷于简洁、而富有理性的事物 QQ:543413507 主页:http://zengxianhua.com All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // TwitterPagging 4 | // 5 | // Created by 曾 宪华 on 14-6-20. 6 | // Copyright (c) 2014年 嗨,我是曾宪华(@xhzengAIB),曾加入YY Inc.担任高级移动开发工程师,拍立秀App联合创始人,热衷于简洁、而富有理性的事物 QQ:543413507 主页:http://zengxianhua.com All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | #import "XHTwitterPaggingViewer.h" 12 | #import "XHTableViewController.h" 13 | 14 | @interface AppDelegate () { 15 | XHTwitterPaggingViewer *twitterPaggingViewer; 16 | } 17 | 18 | @end 19 | 20 | @implementation AppDelegate 21 | 22 | - (void)setupNavigationBarStyle { 23 | 24 | UINavigationBar *appearance = [UINavigationBar appearance]; 25 | if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 7.0) { 26 | 27 | // 设置导航条背景颜色,在iOS7才这么用 28 | [appearance setBarTintColor:[UIColor colorWithRed:0.291 green:0.607 blue:1.000 alpha:1.000]]; 29 | // 设置导航条的返回按钮或者系统按钮的文字颜色,在iOS7才这么用 30 | [appearance setTintColor:[UIColor whiteColor]]; 31 | // 设置导航条的title文字颜色,在iOS7才这么用 32 | [appearance setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: 33 | [UIColor whiteColor], NSForegroundColorAttributeName, [UIFont systemFontOfSize:17], NSFontAttributeName, nil]]; 34 | 35 | } else { 36 | // 设置导航条的背景颜色,在iOS7以下才这么用 37 | [appearance setTintColor:[UIColor colorWithRed:0.291 green:0.607 blue:1.000 alpha:1.000]]; 38 | } 39 | } 40 | 41 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 42 | self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 43 | // Override point for customization after application launch. 44 | self.window.backgroundColor = [UIColor whiteColor]; 45 | 46 | [self setupNavigationBarStyle]; 47 | 48 | twitterPaggingViewer = [[XHTwitterPaggingViewer alloc] init]; 49 | 50 | NSMutableArray *viewControllers = [[NSMutableArray alloc] initWithCapacity:7]; 51 | 52 | NSArray *titles = @[@"最新", @"最热", @"段子", @"图片", @"GIF"]; 53 | 54 | [titles enumerateObjectsUsingBlock:^(NSString *title, NSUInteger idx, BOOL *stop) { 55 | XHTableViewController *tableViewController = [[XHTableViewController alloc] init]; 56 | tableViewController.title = title; 57 | [viewControllers addObject:tableViewController]; 58 | }]; 59 | 60 | twitterPaggingViewer.viewControllers = viewControllers; 61 | 62 | twitterPaggingViewer.didChangedPageCompleted = ^(NSInteger cuurentPage, NSString *title) { 63 | NSLog(@"cuurentPage : %ld on title : %@", (long)cuurentPage, title); 64 | }; 65 | 66 | self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:twitterPaggingViewer]; 67 | 68 | [self.window makeKeyAndVisible]; 69 | 70 | dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ 71 | [twitterPaggingViewer setCurrentPage:2 animated:YES]; 72 | }); 73 | 74 | return YES; 75 | } 76 | 77 | - (void)applicationWillResignActive:(UIApplication *)application 78 | { 79 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 80 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 81 | } 82 | 83 | - (void)applicationDidEnterBackground:(UIApplication *)application 84 | { 85 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 86 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 87 | } 88 | 89 | - (void)applicationWillEnterForeground:(UIApplication *)application 90 | { 91 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 92 | } 93 | 94 | - (void)applicationDidBecomeActive:(UIApplication *)application 95 | { 96 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 97 | } 98 | 99 | - (void)applicationWillTerminate:(UIApplication *)application 100 | { 101 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 102 | } 103 | 104 | @end 105 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "ipad", 20 | "size" : "29x29", 21 | "scale" : "1x" 22 | }, 23 | { 24 | "idiom" : "ipad", 25 | "size" : "29x29", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "ipad", 30 | "size" : "40x40", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "40x40", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "76x76", 41 | "scale" : "1x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "76x76", 46 | "scale" : "2x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "orientation" : "portrait", 20 | "idiom" : "ipad", 21 | "extent" : "full-screen", 22 | "minimum-system-version" : "7.0", 23 | "scale" : "1x" 24 | }, 25 | { 26 | "orientation" : "landscape", 27 | "idiom" : "ipad", 28 | "extent" : "full-screen", 29 | "minimum-system-version" : "7.0", 30 | "scale" : "1x" 31 | }, 32 | { 33 | "orientation" : "portrait", 34 | "idiom" : "ipad", 35 | "extent" : "full-screen", 36 | "minimum-system-version" : "7.0", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "orientation" : "landscape", 41 | "idiom" : "ipad", 42 | "extent" : "full-screen", 43 | "minimum-system-version" : "7.0", 44 | "scale" : "2x" 45 | } 46 | ], 47 | "info" : { 48 | "version" : 1, 49 | "author" : "xcode" 50 | } 51 | } -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample/Images.xcassets/icon_avator0.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "icon_avator0@2x.png" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample/Images.xcassets/icon_avator0.imageset/icon_avator0@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xhzengAIB/XHTwitterPaggingViewer/71175a69887137a5a159b74f3468368feab91937/Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample/Images.xcassets/icon_avator0.imageset/icon_avator0@2x.png -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample/Images.xcassets/icon_avator1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "icon_avator1@2x.png" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample/Images.xcassets/icon_avator1.imageset/icon_avator1@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xhzengAIB/XHTwitterPaggingViewer/71175a69887137a5a159b74f3468368feab91937/Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample/Images.xcassets/icon_avator1.imageset/icon_avator1@2x.png -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample/Images.xcassets/icon_avator2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "icon_avator2@2x.png" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample/Images.xcassets/icon_avator2.imageset/icon_avator2@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xhzengAIB/XHTwitterPaggingViewer/71175a69887137a5a159b74f3468368feab91937/Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample/Images.xcassets/icon_avator2.imageset/icon_avator2@2x.png -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample/XHTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // XHTableViewController.h 3 | // TwitterPagging 4 | // 5 | // Created by 曾 宪华 on 14-6-21. 6 | // Copyright (c) 2014年 嗨,我是曾宪华(@xhzengAIB),曾加入YY Inc.担任高级移动开发工程师,拍立秀App联合创始人,热衷于简洁、而富有理性的事物 QQ:543413507 主页:http://zengxianhua.com All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "XHPullRefreshTableViewController.h" 12 | 13 | @interface XHTableViewController : XHPullRefreshTableViewController 14 | 15 | @property (nonatomic, assign) BOOL showPushDetail; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample/XHTableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // XHTableViewController.m 3 | // TwitterPagging 4 | // 5 | // Created by 曾 宪华 on 14-6-21. 6 | // Copyright (c) 2014年 嗨,我是曾宪华(@xhzengAIB),曾加入YY Inc.担任高级移动开发工程师,拍立秀App联合创始人,热衷于简洁、而富有理性的事物 QQ:543413507 主页:http://zengxianhua.com All rights reserved. 7 | // 8 | 9 | #import "XHTableViewController.h" 10 | 11 | @interface XHTableViewController () 12 | 13 | @end 14 | 15 | @implementation XHTableViewController 16 | 17 | #pragma mark - DataSource 18 | 19 | - (void)loadDataSource { 20 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ 21 | NSMutableArray *dataSource = [[NSMutableArray alloc] initWithArray:@[@"A twitter like navigation bar, page viewer.", @"A twitter like navigation bar, page viewer.", @"A twitter like navigation bar, page viewer.", @"A twitter like navigation bar, page viewer.", @"A twitter like navigation bar, page viewer.", @"A twitter like navigation bar, page viewer.", @"A twitter like navigation bar, page viewer.", @"A twitter like navigation bar, page viewer.", @"A twitter like navigation bar, page viewer.", @"A twitter like navigation bar, page viewer.", @"A twitter like navigation bar, page viewer.", @"A twitter like navigation bar, page viewer.", @"A twitter like navigation bar, page viewer.", @"A twitter like navigation bar, page viewer."]]; 22 | 23 | NSMutableArray *indexPaths; 24 | if (self.requestCurrentPage) { 25 | indexPaths = [[NSMutableArray alloc] initWithCapacity:dataSource.count]; 26 | [dataSource enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { 27 | [indexPaths addObject:[NSIndexPath indexPathForRow:self.dataSource.count + idx inSection:0]]; 28 | }]; 29 | } 30 | sleep(1.5); 31 | dispatch_async(dispatch_get_main_queue(), ^{ 32 | if (self.requestCurrentPage) { 33 | [self.dataSource addObjectsFromArray:dataSource]; 34 | [self.tableView insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone]; 35 | [self endLoadMoreRefreshing]; 36 | } else { 37 | self.dataSource = dataSource; 38 | [self.tableView reloadData]; 39 | [self endPullDownRefreshing]; 40 | } 41 | }); 42 | }); 43 | } 44 | 45 | #pragma mark - Life Cycle 46 | 47 | - (void)didAppear { 48 | [self startPullDownRefreshing]; 49 | } 50 | 51 | - (id)init { 52 | self = [super init]; 53 | if (self) { 54 | self.refreshViewType = XHPullDownRefreshViewTypeActivityIndicator; 55 | } 56 | return self; 57 | } 58 | 59 | - (void)viewWillAppear:(BOOL)animated { 60 | [super viewWillAppear:animated]; 61 | } 62 | 63 | - (void)viewDidAppear:(BOOL)animated { 64 | [super viewDidAppear:animated]; 65 | [self startPullDownRefreshing]; 66 | } 67 | 68 | - (void)viewDidLoad { 69 | [super viewDidLoad]; 70 | // Do any additional setup after loading the view. 71 | if (!self.showPushDetail) { 72 | CGRect tableViewFrame = self.tableView.frame; 73 | tableViewFrame.size.height -= 64; 74 | self.tableView.frame = tableViewFrame; 75 | } 76 | } 77 | 78 | - (void)didReceiveMemoryWarning { 79 | [super didReceiveMemoryWarning]; 80 | // Dispose of any resources that can be recreated. 81 | } 82 | 83 | #pragma mark - UITableView DataSource 84 | 85 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 86 | static NSString *cellIdentifier = @"cellIdentifier"; 87 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; 88 | if (!cell) { 89 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier]; 90 | cell.textLabel.numberOfLines = 0; 91 | } 92 | cell.imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"icon_avator%ld", (indexPath.row % 3)]]; 93 | cell.textLabel.text = self.dataSource[indexPath.row]; 94 | 95 | return cell; 96 | } 97 | 98 | #pragma mark - UITableView Delegate 99 | 100 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 101 | return 120; 102 | } 103 | 104 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 105 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 106 | XHTableViewController *detailTableViewController = [[[self class] alloc] init]; 107 | detailTableViewController.showPushDetail = YES; 108 | detailTableViewController.title = @"Detail"; 109 | [self.navigationController pushViewController:detailTableViewController animated:YES]; 110 | } 111 | 112 | @end 113 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.HUAJIE.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | 35 | UISupportedInterfaceOrientations~ipad 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationPortraitUpsideDown 39 | UIInterfaceOrientationLandscapeLeft 40 | UIInterfaceOrientationLandscapeRight 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_3_0 10 | #warning "This project uses features only available in iOS SDK 3.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // XHTwitterPaggingViewerExample 4 | // 5 | // Created by 曾 宪华 on 14-6-21. 6 | // Copyright (c) 2014年 嗨,我是曾宪华(@xhzengAIB),曾加入YY Inc.担任高级移动开发工程师,拍立秀App联合创始人,热衷于简洁、而富有理性的事物 QQ:543413507 主页:http://zengxianhua.com All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExampleTests/XHTwitterPaggingViewerExampleTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.HUAJIE.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExampleTests/XHTwitterPaggingViewerExampleTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // XHTwitterPaggingViewerExampleTests.m 3 | // XHTwitterPaggingViewerExampleTests 4 | // 5 | // Created by 曾 宪华 on 14-6-21. 6 | // Copyright (c) 2014年 嗨,我是曾宪华(@xhzengAIB),曾加入YY Inc.担任高级移动开发工程师,拍立秀App联合创始人,热衷于简洁、而富有理性的事物 QQ:543413507 主页:http://zengxianhua.com All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface XHTwitterPaggingViewerExampleTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation XHTwitterPaggingViewerExampleTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerExample/XHTwitterPaggingViewerExampleTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample.xcodeproj/project.xcworkspace/xcshareddata/XHTwitterPaggingViewerStoryboradExample.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | 3A4F79DF-F9EB-4FF7-B6FF-7FFF5715CD86 9 | IDESourceControlProjectName 10 | XHTwitterPaggingViewerStoryboradExample 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 01FC7A01-F564-4A12-805F-42881BD2EAE6 14 | https://github.com/xhzengAIB/TwitterPaggingViewer.git 15 | 16 | IDESourceControlProjectPath 17 | Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample.xcodeproj/project.xcworkspace 18 | IDESourceControlProjectRelativeInstallPathDictionary 19 | 20 | 01FC7A01-F564-4A12-805F-42881BD2EAE6 21 | ../../../.. 22 | 23 | IDESourceControlProjectURL 24 | https://github.com/xhzengAIB/TwitterPaggingViewer.git 25 | IDESourceControlProjectVersion 26 | 110 27 | IDESourceControlProjectWCCIdentifier 28 | 01FC7A01-F564-4A12-805F-42881BD2EAE6 29 | IDESourceControlProjectWCConfigurations 30 | 31 | 32 | IDESourceControlRepositoryExtensionIdentifierKey 33 | public.vcs.git 34 | IDESourceControlWCCIdentifierKey 35 | 01FC7A01-F564-4A12-805F-42881BD2EAE6 36 | IDESourceControlWCCName 37 | TwitterPaggingViewer 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample.xcodeproj/xcuserdata/JackMacbook.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 8 | 14 | 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample.xcodeproj/xcuserdata/JackMacbook.xcuserdatad/xcschemes/XHTwitterPaggingViewerStoryboradExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample.xcodeproj/xcuserdata/JackMacbook.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | XHTwitterPaggingViewerStoryboradExample.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | ABCFFB22196384D500E7E72C 16 | 17 | primary 18 | 19 | 20 | ABCFFB46196384D600E7E72C 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample.xcodeproj/xcuserdata/dw_ios.xcuserdatad/xcschemes/XHTwitterPaggingViewerStoryboradExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 49 | 50 | 51 | 52 | 61 | 62 | 68 | 69 | 70 | 71 | 72 | 73 | 79 | 80 | 86 | 87 | 88 | 89 | 91 | 92 | 95 | 96 | 97 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample.xcodeproj/xcuserdata/dw_ios.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | XHTwitterPaggingViewerStoryboradExample.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | ABCFFB22196384D500E7E72C 16 | 17 | primary 18 | 19 | 20 | ABCFFB46196384D600E7E72C 21 | 22 | primary 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // XHTwitterPaggingViewerStoryboradExample 4 | // 5 | // Created by 曾 宪华 on 14-7-2. 6 | // Copyright (c) 2014年 嗨,我是曾宪华(@xhzengAIB),曾加入YY Inc.担任高级移动开发工程师,拍立秀App联合创始人,热衷于简洁、而富有理性的事物 QQ:543413507 主页:http://zengxianhua.com All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | @end 16 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // XHTwitterPaggingViewerStoryboradExample 4 | // 5 | // Created by 曾 宪华 on 14-7-2. 6 | // Copyright (c) 2014年 嗨,我是曾宪华(@xhzengAIB),曾加入YY Inc.担任高级移动开发工程师,拍立秀App联合创始人,热衷于简洁、而富有理性的事物 QQ:543413507 主页:http://zengxianhua.com All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | #import "XHTwitterPaggingViewer.h" 12 | #import "XHTableViewController.h" 13 | 14 | @implementation AppDelegate 15 | 16 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 17 | { 18 | // Override point for customization after application launch. 19 | UINavigationController *navigationController = (UINavigationController *)self.window.rootViewController; 20 | 21 | XHTwitterPaggingViewer *twitterPaggingViewer = (XHTwitterPaggingViewer *)navigationController.topViewController; 22 | 23 | UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main_iPhone" bundle:nil]; 24 | 25 | XHTableViewController *tableViewController1 = [storyboard instantiateViewControllerWithIdentifier:@"TableViewController1"]; 26 | XHTableViewController *tableViewController2 = [storyboard instantiateViewControllerWithIdentifier:@"TableViewController2"]; 27 | 28 | twitterPaggingViewer.viewControllers = @[tableViewController1, tableViewController2]; 29 | 30 | return YES; 31 | } 32 | 33 | - (void)applicationWillResignActive:(UIApplication *)application 34 | { 35 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 36 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 37 | } 38 | 39 | - (void)applicationDidEnterBackground:(UIApplication *)application 40 | { 41 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 42 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 43 | } 44 | 45 | - (void)applicationWillEnterForeground:(UIApplication *)application 46 | { 47 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 48 | } 49 | 50 | - (void)applicationDidBecomeActive:(UIApplication *)application 51 | { 52 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 53 | } 54 | 55 | - (void)applicationWillTerminate:(UIApplication *)application 56 | { 57 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 58 | } 59 | 60 | @end 61 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample/Base.lproj/Main_iPad.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample/Base.lproj/Main_iPhone.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "40x40", 11 | "scale" : "2x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "60x60", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "ipad", 20 | "size" : "29x29", 21 | "scale" : "1x" 22 | }, 23 | { 24 | "idiom" : "ipad", 25 | "size" : "29x29", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "ipad", 30 | "size" : "40x40", 31 | "scale" : "1x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "40x40", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "76x76", 41 | "scale" : "1x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "76x76", 46 | "scale" : "2x" 47 | } 48 | ], 49 | "info" : { 50 | "version" : 1, 51 | "author" : "xcode" 52 | } 53 | } -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample/Images.xcassets/LaunchImage.launchimage/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "orientation" : "portrait", 5 | "idiom" : "iphone", 6 | "extent" : "full-screen", 7 | "minimum-system-version" : "7.0", 8 | "scale" : "2x" 9 | }, 10 | { 11 | "orientation" : "portrait", 12 | "idiom" : "iphone", 13 | "subtype" : "retina4", 14 | "extent" : "full-screen", 15 | "minimum-system-version" : "7.0", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "orientation" : "portrait", 20 | "idiom" : "ipad", 21 | "extent" : "full-screen", 22 | "minimum-system-version" : "7.0", 23 | "scale" : "1x" 24 | }, 25 | { 26 | "orientation" : "landscape", 27 | "idiom" : "ipad", 28 | "extent" : "full-screen", 29 | "minimum-system-version" : "7.0", 30 | "scale" : "1x" 31 | }, 32 | { 33 | "orientation" : "portrait", 34 | "idiom" : "ipad", 35 | "extent" : "full-screen", 36 | "minimum-system-version" : "7.0", 37 | "scale" : "2x" 38 | }, 39 | { 40 | "orientation" : "landscape", 41 | "idiom" : "ipad", 42 | "extent" : "full-screen", 43 | "minimum-system-version" : "7.0", 44 | "scale" : "2x" 45 | } 46 | ], 47 | "info" : { 48 | "version" : 1, 49 | "author" : "xcode" 50 | } 51 | } -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample/Images.xcassets/icon_avator0.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "icon_avator0@2x.png" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample/Images.xcassets/icon_avator0.imageset/icon_avator0@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xhzengAIB/XHTwitterPaggingViewer/71175a69887137a5a159b74f3468368feab91937/Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample/Images.xcassets/icon_avator0.imageset/icon_avator0@2x.png -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample/Images.xcassets/icon_avator1.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "icon_avator1@2x.png" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample/Images.xcassets/icon_avator1.imageset/icon_avator1@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xhzengAIB/XHTwitterPaggingViewer/71175a69887137a5a159b74f3468368feab91937/Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample/Images.xcassets/icon_avator1.imageset/icon_avator1@2x.png -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample/Images.xcassets/icon_avator2.imageset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "universal", 5 | "scale" : "1x" 6 | }, 7 | { 8 | "idiom" : "universal", 9 | "scale" : "2x", 10 | "filename" : "icon_avator2@2x.png" 11 | } 12 | ], 13 | "info" : { 14 | "version" : 1, 15 | "author" : "xcode" 16 | } 17 | } -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample/Images.xcassets/icon_avator2.imageset/icon_avator2@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xhzengAIB/XHTwitterPaggingViewer/71175a69887137a5a159b74f3468368feab91937/Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample/Images.xcassets/icon_avator2.imageset/icon_avator2@2x.png -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample/XHBaseTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // XHBaseTableViewController.h 3 | // MessageDisplayExample 4 | // 5 | // Created by qtone-1 on 14-5-6. 6 | // Copyright (c) 2014年 曾宪华 开发团队(http://iyilunba.com ) 本人QQ:543413507 本人QQ群(142557668). All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "XHFoundationCommon.h" 12 | 13 | @interface XHBaseTableViewController : UIViewController 14 | 15 | /** 16 | * 显示大量数据的控件 17 | */ 18 | @property (nonatomic, strong) UITableView *tableView; 19 | /** 20 | * 初始化init的时候设置tableView的样式才有效 21 | */ 22 | @property (nonatomic, assign) UITableViewStyle tableViewStyle; 23 | 24 | /** 25 | * 大量数据的数据源 26 | */ 27 | @property (nonatomic, strong) NSMutableArray *dataSource; 28 | 29 | /** 30 | * 去除iOS7新的功能api,tableView的分割线变成iOS6正常的样式 31 | */ 32 | - (void)configuraTableViewNormalSeparatorInset; 33 | 34 | /** 35 | * 配置tableView右侧的index title 背景颜色,因为在iOS7有白色底色,iOS6没有 36 | * 37 | * @param tableView 目标tableView 38 | */ 39 | - (void)configuraSectionIndexBackgroundColorWithTableView:(UITableView *)tableView; 40 | 41 | /** 42 | * 加载本地或者网络数据源 43 | */ 44 | - (void)loadDataSource; 45 | 46 | @end 47 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample/XHBaseTableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // XHBaseTableViewController.m 3 | // MessageDisplayExample 4 | // 5 | // Created by qtone-1 on 14-5-6. 6 | // Copyright (c) 2014年 曾宪华 开发团队(http://iyilunba.com ) 本人QQ:543413507 本人QQ群(142557668). All rights reserved. 7 | // 8 | 9 | #import "XHBaseTableViewController.h" 10 | 11 | @interface XHBaseTableViewController () 12 | 13 | /** 14 | * 判断tableView是否支持iOS7的api方法 15 | * 16 | * @return 返回预想结果 17 | */ 18 | - (BOOL)validateSeparatorInset; 19 | 20 | @end 21 | 22 | @implementation XHBaseTableViewController 23 | 24 | #pragma mark - Publish Method 25 | 26 | - (void)configuraTableViewNormalSeparatorInset { 27 | if ([self validateSeparatorInset]) { 28 | [_tableView setSeparatorInset:UIEdgeInsetsZero]; 29 | } 30 | } 31 | 32 | - (void)configuraSectionIndexBackgroundColorWithTableView:(UITableView *)tableView { 33 | if ([tableView respondsToSelector:@selector(setSectionIndexBackgroundColor:)]) { 34 | tableView.sectionIndexBackgroundColor = [UIColor clearColor]; 35 | } 36 | } 37 | 38 | - (void)loadDataSource { 39 | // subClasse 40 | } 41 | 42 | #pragma mark - Propertys 43 | 44 | - (UITableView *)tableView { 45 | if (!_tableView) { 46 | CGRect tableViewFrame = self.view.bounds; 47 | tableViewFrame.size.height -= (self.navigationController.viewControllers.count > 1 ? 0 : (CGRectGetHeight(self.tabBarController.tabBar.bounds))) + [XHFoundationCommon getAdapterHeight]; 48 | _tableView = [[UITableView alloc] initWithFrame:tableViewFrame style:self.tableViewStyle]; 49 | _tableView.delegate = self; 50 | _tableView.dataSource = self; 51 | [_tableView setScrollsToTop:NO]; 52 | 53 | _tableView.tableFooterView = [[UIView alloc] init]; 54 | if (![self validateSeparatorInset]) { 55 | if (self.tableViewStyle == UITableViewStyleGrouped) { 56 | UIView *backgroundView = [[UIView alloc] initWithFrame:_tableView.bounds]; 57 | backgroundView.backgroundColor = _tableView.backgroundColor; 58 | _tableView.backgroundView = backgroundView; 59 | } 60 | } 61 | } 62 | return _tableView; 63 | } 64 | 65 | - (NSMutableArray *)dataSource { 66 | if (!_dataSource) { 67 | _dataSource = [[NSMutableArray alloc] initWithCapacity:1]; 68 | } 69 | return _dataSource; 70 | } 71 | 72 | #pragma mark - Life cycle 73 | 74 | - (void)viewDidLoad { 75 | [super viewDidLoad]; 76 | // Do any additional setup after loading the view. 77 | self.view.backgroundColor = [UIColor whiteColor]; 78 | [self.view addSubview:self.tableView]; 79 | } 80 | 81 | - (void)dealloc { 82 | self.dataSource = nil; 83 | self.tableView.delegate = nil; 84 | self.tableView.dataSource = nil; 85 | self.tableView = nil; 86 | } 87 | 88 | - (void)didReceiveMemoryWarning { 89 | [super didReceiveMemoryWarning]; 90 | // Dispose of any resources that can be recreated. 91 | } 92 | 93 | #pragma mark - TableView Helper Method 94 | 95 | - (BOOL)validateSeparatorInset { 96 | if ([_tableView respondsToSelector:@selector(setSeparatorInset:)]) { 97 | return YES; 98 | } 99 | return NO; 100 | } 101 | 102 | #pragma mark - UITableView DataSource 103 | 104 | - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { 105 | return 1; 106 | } 107 | 108 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 109 | return self.dataSource.count; 110 | } 111 | 112 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 113 | // in subClass 114 | return nil; 115 | } 116 | 117 | 118 | @end 119 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample/XHFoundationCommon.h: -------------------------------------------------------------------------------- 1 | // 2 | // XHFoundationCommon.h 3 | // MessageDisplayExample 4 | // 5 | // Created by qtone-1 on 14-4-28. 6 | // Copyright (c) 2014年 曾宪华 开发团队(http://iyilunba.com ) 本人QQ:543413507 本人QQ群(142557668). All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface XHFoundationCommon : NSObject 12 | 13 | + (BOOL)isIOS7; 14 | 15 | + (CGFloat)getAdapterHeight; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample/XHFoundationCommon.m: -------------------------------------------------------------------------------- 1 | // 2 | // XHFoundationCommon.m 3 | // MessageDisplayExample 4 | // 5 | // Created by qtone-1 on 14-4-28. 6 | // Copyright (c) 2014年 曾宪华 开发团队(http://iyilunba.com ) 本人QQ:543413507 本人QQ群(142557668). All rights reserved. 7 | // 8 | 9 | #import "XHFoundationCommon.h" 10 | 11 | @implementation XHFoundationCommon 12 | 13 | + (BOOL)isIOS7 { 14 | return [[[UIDevice currentDevice] systemVersion] integerValue] >= 7.0; 15 | } 16 | 17 | + (CGFloat)getAdapterHeight { 18 | CGFloat adapterHeight = 0; 19 | if (![self isIOS7]) { 20 | adapterHeight = 44; 21 | } 22 | return adapterHeight; 23 | } 24 | 25 | @end 26 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample/XHTableViewController.h: -------------------------------------------------------------------------------- 1 | // 2 | // XHTableViewController.h 3 | // TwitterPagging 4 | // 5 | // Created by 曾 宪华 on 14-6-21. 6 | // Copyright (c) 2014年 嗨,我是曾宪华(@xhzengAIB),曾加入YY Inc.担任高级移动开发工程师,拍立秀App联合创始人,热衷于简洁、而富有理性的事物 QQ:543413507 主页:http://zengxianhua.com All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "XHBaseTableViewController.h" 12 | 13 | @interface XHTableViewController : XHBaseTableViewController 14 | 15 | @property (nonatomic, assign) BOOL showPushDetail; 16 | 17 | @end 18 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample/XHTableViewController.m: -------------------------------------------------------------------------------- 1 | // 2 | // XHTableViewController.m 3 | // TwitterPagging 4 | // 5 | // Created by 曾 宪华 on 14-6-21. 6 | // Copyright (c) 2014年 嗨,我是曾宪华(@xhzengAIB),曾加入YY Inc.担任高级移动开发工程师,拍立秀App联合创始人,热衷于简洁、而富有理性的事物 QQ:543413507 主页:http://zengxianhua.com All rights reserved. 7 | // 8 | 9 | #import "XHTableViewController.h" 10 | 11 | @interface XHTableViewController () 12 | 13 | @end 14 | 15 | @implementation XHTableViewController 16 | 17 | - (void)loadDataSource { 18 | self.dataSource = (NSMutableArray *)@[@"A twitter like navigation bar, page viewer.", @"A twitter like navigation bar, page viewer.", @"A twitter like navigation bar, page viewer.", @"A twitter like navigation bar, page viewer.", @"A twitter like navigation bar, page viewer.", @"A twitter like navigation bar, page viewer.", @"A twitter like navigation bar, page viewer.", @"A twitter like navigation bar, page viewer.", @"A twitter like navigation bar, page viewer.", @"A twitter like navigation bar, page viewer.", @"A twitter like navigation bar, page viewer.", @"A twitter like navigation bar, page viewer.", @"A twitter like navigation bar, page viewer.", @"A twitter like navigation bar, page viewer."]; 19 | } 20 | 21 | - (void)viewWillAppear:(BOOL)animated { 22 | [super viewWillAppear:animated]; 23 | } 24 | 25 | - (void)viewDidAppear:(BOOL)animated { 26 | [super viewDidAppear:animated]; 27 | } 28 | 29 | - (void)viewDidLoad { 30 | [super viewDidLoad]; 31 | // Do any additional setup after loading the view. 32 | if (!self.showPushDetail) { 33 | UIEdgeInsets edgeInsets = self.tableView.contentInset; 34 | edgeInsets.top = ([XHFoundationCommon isIOS7] ? 64 : 0); 35 | self.tableView.contentInset = edgeInsets; 36 | self.tableView.scrollIndicatorInsets = edgeInsets; 37 | } 38 | [self loadDataSource]; 39 | } 40 | 41 | - (void)didReceiveMemoryWarning { 42 | [super didReceiveMemoryWarning]; 43 | // Dispose of any resources that can be recreated. 44 | } 45 | 46 | #pragma mark - UITableView DataSource 47 | 48 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 49 | static NSString *cellIdentifier = @"cellIdentifier"; 50 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; 51 | if (!cell) { 52 | cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier]; 53 | cell.textLabel.numberOfLines = 0; 54 | } 55 | cell.imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"icon_avator%d", (indexPath.row % 3)]]; 56 | cell.textLabel.text = self.dataSource[indexPath.row]; 57 | 58 | return cell; 59 | } 60 | 61 | #pragma mark - UITableView Delegate 62 | 63 | - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { 64 | return 120; 65 | } 66 | 67 | - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { 68 | [tableView deselectRowAtIndexPath:indexPath animated:YES]; 69 | XHTableViewController *detailTableViewController = [[[self class] alloc] init]; 70 | detailTableViewController.showPushDetail = YES; 71 | detailTableViewController.title = @"Detail"; 72 | [self.navigationController pushViewController:detailTableViewController animated:YES]; 73 | } 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | ${PRODUCT_NAME} 9 | CFBundleExecutable 10 | ${EXECUTABLE_NAME} 11 | CFBundleIdentifier 12 | com.HUAJIE.${PRODUCT_NAME:rfc1034identifier} 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | ${PRODUCT_NAME} 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1.0 25 | LSRequiresIPhoneOS 26 | 27 | UIMainStoryboardFile 28 | Main_iPhone 29 | UIMainStoryboardFile~ipad 30 | Main_iPad 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UISupportedInterfaceOrientations~ipad 42 | 43 | UIInterfaceOrientationPortrait 44 | UIInterfaceOrientationPortraitUpsideDown 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample-Prefix.pch: -------------------------------------------------------------------------------- 1 | // 2 | // Prefix header 3 | // 4 | // The contents of this file are implicitly included at the beginning of every source file. 5 | // 6 | 7 | #import 8 | 9 | #ifndef __IPHONE_5_0 10 | #warning "This project uses features only available in iOS SDK 5.0 and later." 11 | #endif 12 | 13 | #ifdef __OBJC__ 14 | #import 15 | #import 16 | #endif 17 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExample/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // XHTwitterPaggingViewerStoryboradExample 4 | // 5 | // Created by 曾 宪华 on 14-7-2. 6 | // Copyright (c) 2014年 嗨,我是曾宪华(@xhzengAIB),曾加入YY Inc.担任高级移动开发工程师,拍立秀App联合创始人,热衷于简洁、而富有理性的事物 QQ:543413507 主页:http://zengxianhua.com All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | #import "AppDelegate.h" 12 | 13 | int main(int argc, char * argv[]) 14 | { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExampleTests/XHTwitterPaggingViewerStoryboradExampleTests-Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | ${EXECUTABLE_NAME} 9 | CFBundleIdentifier 10 | com.HUAJIE.${PRODUCT_NAME:rfc1034identifier} 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundlePackageType 14 | BNDL 15 | CFBundleShortVersionString 16 | 1.0 17 | CFBundleSignature 18 | ???? 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExampleTests/XHTwitterPaggingViewerStoryboradExampleTests.m: -------------------------------------------------------------------------------- 1 | // 2 | // XHTwitterPaggingViewerStoryboradExampleTests.m 3 | // XHTwitterPaggingViewerStoryboradExampleTests 4 | // 5 | // Created by 曾 宪华 on 14-7-2. 6 | // Copyright (c) 2014年 嗨,我是曾宪华(@xhzengAIB),曾加入YY Inc.担任高级移动开发工程师,拍立秀App联合创始人,热衷于简洁、而富有理性的事物 QQ:543413507 主页:http://zengxianhua.com All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface XHTwitterPaggingViewerStoryboradExampleTests : XCTestCase 12 | 13 | @end 14 | 15 | @implementation XHTwitterPaggingViewerStoryboradExampleTests 16 | 17 | - (void)setUp 18 | { 19 | [super setUp]; 20 | // Put setup code here. This method is called before the invocation of each test method in the class. 21 | } 22 | 23 | - (void)tearDown 24 | { 25 | // Put teardown code here. This method is called after the invocation of each test method in the class. 26 | [super tearDown]; 27 | } 28 | 29 | - (void)testExample 30 | { 31 | XCTFail(@"No implementation for \"%s\"", __PRETTY_FUNCTION__); 32 | } 33 | 34 | @end 35 | -------------------------------------------------------------------------------- /Example/XHTwitterPaggingViewerStoryboradExample/XHTwitterPaggingViewerStoryboradExampleTests/en.lproj/InfoPlist.strings: -------------------------------------------------------------------------------- 1 | /* Localized versions of Info.plist keys */ 2 | 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2014 Jack 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![image](https://github.com/xhzengAIB/LearnEnglish/raw/master/Screenshots/XHTwitterPaggingViewer.gif) 2 | 3 | TwitterPaggingViewer 4 | ==================== 5 | 6 | A twitter like navigation bar, page viewer. 7 | 8 | 有某些业务中,并不是在NavigationController的rootViewController上使用,那么该怎么去改进这个库去适应呢? 9 | 还在考虑解决方案中........... 10 | 11 | ## 组件要求 Requirements 12 | 13 | * iOS 6.0+ 14 | * ARC 15 | 16 | ## Podfile 17 | 18 | [CocosPods](http://cocosPods.org) is the recommended method to install TwitterPaggingViewer, just add the following line to `Podfile` 19 | 20 | ``` 21 | pod 'XHTwitterPaggingViewer' 22 | ``` 23 | 24 | and run `pod install`, then you're all done! 25 | 26 | 27 | ## How to use 28 | Easy to drop into your project. 类似UITabBarController的用法,非常方便 29 | ```objc 30 | 31 | XHTwitterPaggingViewer *twitterPaggingViewer = [[XHTwitterPaggingViewer alloc] init]; 32 | 33 | NSMutableArray *viewControllers = [[NSMutableArray alloc] initWithCapacity:7]; 34 | 35 | NSArray *titles = @[@"Home", @"Friend", @"曾宪华", @"News", @"Viewer", @"Framework", @"Pagging"]; 36 | 37 | [titles enumerateObjectsUsingBlock:^(NSString *title, NSUInteger idx, BOOL *stop) { 38 | XHTableViewController *tableViewController = [[XHTableViewController alloc] init]; 39 | tableViewController.title = title; 40 | [viewControllers addObject:tableViewController]; 41 | }]; 42 | 43 | twitterPaggingViewer.viewControllers = viewControllers; 44 | 45 | twitterPaggingViewer.didChangedPageCompleted = ^(NSInteger cuurentPage, NSString *title) { 46 | NSLog(@"cuurentPage : %ld on title : %@", (long)cuurentPage, title); 47 | }; 48 | 49 | self.window.rootViewController = [[UINavigationController alloc] initWithRootViewController:twitterPaggingViewer]; 50 | 51 | 52 | ``` 53 | 54 | ## License 55 | 56 | 中文: TwitterPaggingViewer 是在MIT协议下使用的,可以在LICENSE文件里面找到相关的使用协议信息。 57 | 58 | English: TwitterPaggingViewer is available under the MIT license, see the LICENSE file for more information. 59 | -------------------------------------------------------------------------------- /XHTwitterPaggingViewer.podspec: -------------------------------------------------------------------------------- 1 | Pod::Spec.new do |s| 2 | s.name = "XHTwitterPaggingViewer" 3 | s.version = "0.7" 4 | s.summary = "A twitter like navigation bar, page viewer." 5 | s.homepage = "https://github.com/xhzengAIB/TwitterPaggingViewer" 6 | s.license = "MIT" 7 | s.authors = { "Jack" => "xhzengAIB@gmail.com" } 8 | s.source = { :git => "https://github.com/xhzengAIB/TwitterPaggingViewer.git", :tag => "v0.7" } 9 | s.frameworks = 'Foundation', 'CoreGraphics', 'UIKit' 10 | s.platform = :ios, '6.0' 11 | s.source_files = 'XHTwitterPaggingViewer/*/*.{h,m}' 12 | s.resources = 'XHTwitterPaggingViewer/Assets' 13 | s.requires_arc = true 14 | end 15 | -------------------------------------------------------------------------------- /XHTwitterPaggingViewer/Assets/thumbnail_normal@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xhzengAIB/XHTwitterPaggingViewer/71175a69887137a5a159b74f3468368feab91937/XHTwitterPaggingViewer/Assets/thumbnail_normal@2x.png -------------------------------------------------------------------------------- /XHTwitterPaggingViewer/Assets/thumbnail_selected@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xhzengAIB/XHTwitterPaggingViewer/71175a69887137a5a159b74f3468368feab91937/XHTwitterPaggingViewer/Assets/thumbnail_selected@2x.png -------------------------------------------------------------------------------- /XHTwitterPaggingViewer/Controllers/XHTwitterPaggingViewer.h: -------------------------------------------------------------------------------- 1 | // 2 | // XHTwitterPaggingViewer.h 3 | // XHTwitterPagging 4 | // 5 | // Created by 曾 宪华 on 14-6-20. 6 | // Copyright (c) 2014年 嗨,我是曾宪华(@xhzengAIB),曾加入YY Inc.担任高级移动开发工程师,拍立秀App联合创始人,热衷于简洁、而富有理性的事物 QQ:543413507 主页:http://zengxianhua.com All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | typedef void(^XHDidChangedPageBlock)(NSInteger currentPage, NSString *title); 12 | 13 | @interface XHTwitterPaggingViewer : UIViewController 14 | 15 | /** 16 | * 改变页码的回调 17 | */ 18 | @property (nonatomic, copy) XHDidChangedPageBlock didChangedPageCompleted; 19 | 20 | /** 21 | * 对于iOS的Cocotouch的设计,UITabbarController,最做支持5个控制器,多余的会以more来代替,可以见的5个是比较正常的内存管理方案,所以这里提倡最大5个控制器的使用 22 | */ 23 | @property (nonatomic, strong) NSArray *viewControllers; 24 | 25 | /*************************以下初始化方法都不使用的话,那讲初始化一个没有滑动菜单的Viewer控制器*************/ 26 | /** 27 | * 初始化带有左边滑动菜单的Viewer控制器 28 | * 29 | * @param leftViewController 目标左边菜单控制器对象 30 | * 31 | * @return 返回Viewer控制器对象 32 | */ 33 | - (instancetype)initWithLeftViewController:(UIViewController *)leftViewController; 34 | 35 | /** 36 | * 初始化带有右边滑动菜单的Viewer控制器 37 | * 38 | * @param rightViewController 目标右边菜单控制器对象 39 | * 40 | * @return 返回Viewer控制器对象 41 | */ 42 | - (instancetype)initWithRightViewController:(UIViewController *)rightViewController; 43 | 44 | /** 45 | * 初始化带有左右滑动菜单的Viewer控制器 46 | * 47 | * @param leftViewController 目标左边菜单控制器对象 48 | * @param rightViewController 目标右边菜单控制器对象 49 | * 50 | * @return 返回Viewer控制对象 51 | */ 52 | - (instancetype)initWithLeftViewController:(UIViewController *)leftViewController rightViewController:(UIViewController *)rightViewController; 53 | /********************************************************************************************/ 54 | 55 | /** 56 | * 获取当前页码 57 | * 58 | * @return 返回当前页码 59 | */ 60 | - (NSInteger)getCurrentPageIndex; 61 | 62 | /** 63 | * 设置当前页面为你想要的页码 64 | * 65 | * @param currentPage 目标页码 66 | * @param animated 是否动画的设置 67 | */ 68 | - (void)setCurrentPage:(NSInteger)currentPage animated:(BOOL)animated; 69 | 70 | /** 71 | * 设置控制器数据源,进行reload的方法 72 | */ 73 | - (void)reloadData; 74 | 75 | @end 76 | -------------------------------------------------------------------------------- /XHTwitterPaggingViewer/Controllers/XHTwitterPaggingViewer.m: -------------------------------------------------------------------------------- 1 | // 2 | // XHTwitterPaggingViewer.m 3 | // XHTwitterPagging 4 | // 5 | // Created by 曾 宪华 on 14-6-20. 6 | // Copyright (c) 2014年 嗨,我是曾宪华(@xhzengAIB),曾加入YY Inc.担任高级移动开发工程师,拍立秀App联合创始人,热衷于简洁、而富有理性的事物 QQ:543413507 主页:http://zengxianhua.com All rights reserved. 7 | // 8 | 9 | #import "XHTwitterPaggingViewer.h" 10 | 11 | #import "XHPaggingNavbar.h" 12 | 13 | typedef NS_ENUM(NSInteger, XHSlideType) { 14 | XHSlideTypeLeft = 0, 15 | XHSlideTypeRight = 1, 16 | }; 17 | 18 | @interface XHTwitterPaggingViewer () 19 | 20 | /** 21 | * 显示内容的容器 22 | */ 23 | @property (nonatomic, strong) UIView *centerContainerView; 24 | @property (nonatomic, strong) UIScrollView *paggingScrollView; 25 | 26 | /** 27 | * 显示title集合的容器 28 | */ 29 | @property (nonatomic, strong) XHPaggingNavbar *paggingNavbar; 30 | 31 | /** 32 | * 标识当前页码 33 | */ 34 | @property (nonatomic, assign) NSInteger currentPage; 35 | @property (nonatomic, assign) NSInteger lastPage; 36 | 37 | @property (nonatomic, strong) UIViewController *leftViewController; 38 | 39 | @property (nonatomic, strong) UIViewController *rightViewController; 40 | 41 | @end 42 | 43 | @implementation XHTwitterPaggingViewer 44 | 45 | #pragma mark - Action 46 | 47 | 48 | 49 | #pragma mark - DataSource 50 | 51 | - (NSInteger)getCurrentPageIndex { 52 | return self.currentPage; 53 | } 54 | 55 | - (void)setCurrentPage:(NSInteger)currentPage animated:(BOOL)animated { 56 | self.paggingNavbar.currentPage = currentPage; 57 | self.currentPage = currentPage; 58 | 59 | CGFloat pageWidth = CGRectGetWidth(self.paggingScrollView.frame); 60 | 61 | CGPoint contentOffset = self.paggingScrollView.contentOffset; 62 | contentOffset.x = currentPage * pageWidth; 63 | [self.paggingScrollView setContentOffset:contentOffset animated:animated]; 64 | } 65 | 66 | - (void)reloadData { 67 | if (!self.viewControllers.count) { 68 | return; 69 | } 70 | 71 | [self.paggingScrollView.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; 72 | 73 | [self.viewControllers enumerateObjectsUsingBlock:^(UIViewController *viewController, NSUInteger idx, BOOL *stop) { 74 | [self addChildViewController:viewController]; 75 | [self.paggingScrollView addSubview:viewController.view]; 76 | CGRect contentViewFrame = viewController.view.bounds; 77 | contentViewFrame.origin.y = 0; 78 | contentViewFrame.origin.x = idx * CGRectGetWidth(self.view.bounds); 79 | contentViewFrame.size.width = CGRectGetWidth(self.view.bounds); 80 | contentViewFrame.size.height = CGRectGetHeight(self.view.bounds); 81 | viewController.view.frame = contentViewFrame; 82 | }]; 83 | 84 | [self.paggingScrollView setContentSize:CGSizeMake(CGRectGetWidth(self.view.bounds) * self.viewControllers.count, 0)]; 85 | 86 | self.paggingNavbar.titles = [self.viewControllers valueForKey:@"title"]; 87 | [self.paggingNavbar reloadData]; 88 | 89 | [self setupScrollToTop]; 90 | 91 | [self callBackChangedPage]; 92 | } 93 | 94 | #pragma mark - Propertys 95 | 96 | - (UIView *)centerContainerView { 97 | if (!_centerContainerView) { 98 | _centerContainerView = [[UIView alloc] initWithFrame:self.view.bounds]; 99 | _centerContainerView.backgroundColor = self.view.backgroundColor; 100 | 101 | [_centerContainerView addSubview:self.paggingScrollView]; 102 | [self.paggingScrollView.panGestureRecognizer addTarget:self action:@selector(panGestureRecognizerHandle:)]; 103 | } 104 | return _centerContainerView; 105 | } 106 | 107 | - (UIScrollView *)paggingScrollView { 108 | if (!_paggingScrollView) { 109 | _paggingScrollView = [[UIScrollView alloc] initWithFrame:self.view.bounds]; 110 | _paggingScrollView.bounces = NO; 111 | _paggingScrollView.pagingEnabled = YES; 112 | [_paggingScrollView setScrollsToTop:NO]; 113 | _paggingScrollView.delegate = self; 114 | _paggingScrollView.showsVerticalScrollIndicator = NO; 115 | _paggingScrollView.showsHorizontalScrollIndicator = NO; 116 | } 117 | return _paggingScrollView; 118 | } 119 | 120 | - (XHPaggingNavbar *)paggingNavbar { 121 | if (!_paggingNavbar) { 122 | _paggingNavbar = [[XHPaggingNavbar alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.bounds) / 2.0, 44)]; 123 | _paggingNavbar.backgroundColor = [UIColor clearColor]; 124 | 125 | __weak typeof(self) weakSelf = self; 126 | _paggingNavbar.didChangedIndex = ^(NSInteger index) { 127 | [weakSelf setCurrentPage:index animated:YES]; 128 | }; 129 | } 130 | return _paggingNavbar; 131 | } 132 | 133 | - (UIViewController *)getPageViewControllerAtIndex:(NSInteger)index { 134 | if (index < self.viewControllers.count) { 135 | return self.viewControllers[index]; 136 | } else { 137 | return nil; 138 | } 139 | } 140 | 141 | - (void)setCurrentPage:(NSInteger)currentPage { 142 | if (_currentPage == currentPage) 143 | return; 144 | _lastPage = _currentPage; 145 | _currentPage = currentPage; 146 | 147 | self.paggingNavbar.currentPage = currentPage; 148 | 149 | [self setupScrollToTop]; 150 | [self callBackChangedPage]; 151 | } 152 | 153 | #pragma mark - Life Cycle 154 | 155 | - (void)setupTargetViewController:(UIViewController *)targetViewController withSlideType:(XHSlideType)slideType { 156 | if (!targetViewController) 157 | return; 158 | 159 | [self addChildViewController:targetViewController]; 160 | CGRect targetViewFrame = targetViewController.view.frame; 161 | switch (slideType) { 162 | case XHSlideTypeLeft: { 163 | targetViewFrame.origin.x = -CGRectGetWidth(self.view.bounds); 164 | break; 165 | } 166 | case XHSlideTypeRight: { 167 | targetViewFrame.origin.x = CGRectGetWidth(self.view.bounds) * 2; 168 | break; 169 | } 170 | default: 171 | break; 172 | } 173 | targetViewController.view.frame = targetViewFrame; 174 | [self.view insertSubview:targetViewController.view atIndex:0]; 175 | [targetViewController didMoveToParentViewController:self]; 176 | } 177 | 178 | - (instancetype)initWithLeftViewController:(UIViewController *)leftViewController { 179 | return [self initWithLeftViewController:leftViewController rightViewController:nil]; 180 | } 181 | 182 | - (instancetype)initWithRightViewController:(UIViewController *)rightViewController { 183 | return [self initWithLeftViewController:nil rightViewController:rightViewController]; 184 | } 185 | 186 | - (instancetype)initWithLeftViewController:(UIViewController *)leftViewController rightViewController:(UIViewController *)rightViewController { 187 | self = [super init]; 188 | if (self) { 189 | self.leftViewController = leftViewController; 190 | 191 | self.rightViewController = rightViewController; 192 | } 193 | return self; 194 | } 195 | 196 | - (void)viewWillAppear:(BOOL)animated { 197 | [super viewWillAppear:animated]; 198 | 199 | // Ensure that the paggingScrollView is the correct height. 200 | // This facilitates situations where the XHTwitterPaggingViewer is shown within 201 | // a UITabBarController. 202 | CGRect scrollViewFrame = self.paggingScrollView.frame; 203 | scrollViewFrame.size.height = self.view.frame.size.height; 204 | self.paggingScrollView.frame = scrollViewFrame; 205 | } 206 | 207 | - (void)viewDidLoad { 208 | [super viewDidLoad]; 209 | // Do any additional setup after loading the view. 210 | 211 | [self setupNavigationBarForTitleView]; 212 | 213 | [self setupViews]; 214 | 215 | [self reloadData]; 216 | } 217 | 218 | - (void)setupNavigationBarForTitleView { 219 | self.navigationItem.titleView = self.paggingNavbar; 220 | } 221 | 222 | - (void)setupViews { 223 | [self.view addSubview:self.centerContainerView]; 224 | 225 | [self setupTargetViewController:self.leftViewController withSlideType:XHSlideTypeLeft]; 226 | [self setupTargetViewController:self.rightViewController withSlideType:XHSlideTypeRight]; 227 | } 228 | 229 | - (void)didReceiveMemoryWarning { 230 | [super didReceiveMemoryWarning]; 231 | // Dispose of any resources that can be recreated. 232 | } 233 | 234 | - (void)dealloc { 235 | self.paggingScrollView.delegate = nil; 236 | self.paggingScrollView = nil; 237 | 238 | self.paggingNavbar = nil; 239 | 240 | self.viewControllers = nil; 241 | 242 | self.didChangedPageCompleted = nil; 243 | } 244 | 245 | #pragma mark - PanGesture Handle Method 246 | 247 | - (void)panGestureRecognizerHandle:(UIPanGestureRecognizer *)panGestureRecognizer { 248 | /* 249 | CGPoint contentOffset = self.paggingScrollView.contentOffset; 250 | 251 | CGSize contentSize = self.paggingScrollView.contentSize; 252 | 253 | CGFloat baseWidth = CGRectGetWidth(self.paggingScrollView.bounds); 254 | 255 | switch (panGestureRecognizer.state) { 256 | case UIGestureRecognizerStateBegan: 257 | 258 | break; 259 | case UIGestureRecognizerStateChanged: { 260 | CGPoint translationPoint = [panGestureRecognizer translationInView:panGestureRecognizer.view]; 261 | if (contentOffset.x <= 0) { 262 | // 滑动到最左边 263 | 264 | CGRect centerContainerViewFrame = self.centerContainerView.frame; 265 | centerContainerViewFrame.origin.x += translationPoint.x; 266 | self.centerContainerView.frame = centerContainerViewFrame; 267 | 268 | CGRect leftMenuViewFrame = self.leftViewController.view.frame; 269 | leftMenuViewFrame.origin.x += translationPoint.x; 270 | self.leftViewController.view.frame = leftMenuViewFrame; 271 | 272 | [panGestureRecognizer setTranslation:CGPointZero inView:panGestureRecognizer.view]; 273 | } else if (contentOffset.x >= contentSize.width - baseWidth) { 274 | // 滑动到最右边 275 | [panGestureRecognizer setTranslation:CGPointZero inView:panGestureRecognizer.view]; 276 | } 277 | break; 278 | } 279 | case UIGestureRecognizerStateFailed: 280 | case UIGestureRecognizerStateEnded: 281 | case UIGestureRecognizerStateCancelled: { 282 | // 判断是否打开或关闭Menu 283 | break; 284 | } 285 | default: 286 | break; 287 | } 288 | */ 289 | } 290 | 291 | #pragma mark - Block Call Back Method 292 | 293 | - (void)callBackChangedPage { 294 | UIViewController *fromViewController = [self.viewControllers objectAtIndex:self.lastPage]; 295 | UIViewController *toViewController = [self.viewControllers objectAtIndex:self.currentPage]; 296 | 297 | [fromViewController viewWillDisappear: true]; 298 | [fromViewController viewDidDisappear: true]; 299 | [toViewController viewWillAppear: true]; 300 | [toViewController viewDidAppear: true]; 301 | 302 | if (self.didChangedPageCompleted) { 303 | self.didChangedPageCompleted(self.currentPage, [[self.viewControllers valueForKey:@"title"] objectAtIndex:self.currentPage]); 304 | } 305 | } 306 | 307 | #pragma mark - TableView Helper Method 308 | 309 | - (void)setupScrollToTop { 310 | for (int i = 0; i < self.viewControllers.count; i ++) { 311 | UITableView *tableView = (UITableView *)[self subviewWithClass:[UITableView class] onView:[self getPageViewControllerAtIndex:i].view]; 312 | if (tableView) { 313 | if (self.currentPage == i) { 314 | [tableView setScrollsToTop:YES]; 315 | } else { 316 | [tableView setScrollsToTop:NO]; 317 | } 318 | } 319 | } 320 | } 321 | 322 | #pragma mark - View Helper Method 323 | 324 | - (UIView *)subviewWithClass:(Class)cuurentClass onView:(UIView *)view { 325 | for (UIView *subView in view.subviews) { 326 | if ([subView isKindOfClass:cuurentClass]) { 327 | return subView; 328 | } 329 | } 330 | return nil; 331 | } 332 | 333 | #pragma mark - UIScrollView Delegate 334 | 335 | - (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView { 336 | 337 | } 338 | 339 | - (void)scrollViewDidScroll:(UIScrollView *)scrollView { 340 | self.paggingNavbar.contentOffset = scrollView.contentOffset; 341 | } 342 | 343 | - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { 344 | // 得到每页宽度 345 | CGFloat pageWidth = CGRectGetWidth(self.paggingScrollView.frame); 346 | 347 | // 根据当前的x坐标和页宽度计算出当前页数 348 | self.currentPage = floor((scrollView.contentOffset.x - pageWidth / 2) / pageWidth) + 1; 349 | } 350 | 351 | #pragma mark - KVO 352 | 353 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { 354 | 355 | } 356 | 357 | @end 358 | -------------------------------------------------------------------------------- /XHTwitterPaggingViewer/Views/XHPageControl.h: -------------------------------------------------------------------------------- 1 | // 2 | // XHPageControl.h 3 | // XHTwitterPaggingViewerExample 4 | // 5 | // Created by dw_iOS on 14-8-14. 6 | // Copyright (c) 2014年 嗨,我是曾宪华(@xhzengAIB),曾加入YY Inc.担任高级移动开发工程师,拍立秀App联合创始人,热衷于简洁、而富有理性的事物 QQ:543413507 主页:http://zengxianhua.com All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface XHPageControl : UIControl 12 | 13 | @property (nonatomic, assign) NSInteger currentPage; 14 | @property (nonatomic, assign) NSInteger numberOfPages; 15 | 16 | @property (nonatomic, assign) BOOL hidesForSinglePage; 17 | 18 | @property (nonatomic, assign) NSInteger gapWidth; 19 | @property (nonatomic, assign) NSInteger strokeWidth; 20 | @property (nonatomic, assign) NSInteger diameter; 21 | 22 | @property (nonatomic) UIImage *thumbImage; 23 | 24 | @property (nonatomic) UIImage *selectedThumbImage; 25 | 26 | @property (nonatomic) NSMutableDictionary *thumbImageForIndex; 27 | 28 | @property (nonatomic) NSMutableDictionary *selectedThumbImageForIndex; 29 | 30 | - (void)setThumbImage:(UIImage *)aThumbImage 31 | forIndex:(NSInteger)index; 32 | 33 | - (UIImage *)thumbImageForIndex:(NSInteger)index; 34 | 35 | - (void)setSelectedThumbImage:(UIImage *)selectedThumbImage 36 | forIndex:(NSInteger)index; 37 | 38 | - (UIImage *)selectedThumbImageForIndex:(NSInteger)index; 39 | 40 | @end 41 | -------------------------------------------------------------------------------- /XHTwitterPaggingViewer/Views/XHPageControl.m: -------------------------------------------------------------------------------- 1 | // 2 | // XHPageControl.m 3 | // XHTwitterPaggingViewerExample 4 | // 5 | // Created by dw_iOS on 14-8-14. 6 | // Copyright (c) 2014年 嗨,我是曾宪华(@xhzengAIB),曾加入YY Inc.担任高级移动开发工程师,拍立秀App联合创始人,热衷于简洁、而富有理性的事物 QQ:543413507 主页:http://zengxianhua.com All rights reserved. 7 | // 8 | 9 | #import "XHPageControl.h" 10 | 11 | @implementation XHPageControl 12 | 13 | - (id)initWithFrame:(CGRect)frame { 14 | self = [super initWithFrame:frame]; 15 | if (self) { 16 | [self setup]; 17 | } 18 | return self; 19 | } 20 | 21 | - (id)initWithCoder:(NSCoder *)aDecoder { 22 | self = [super initWithCoder:aDecoder]; 23 | if (self) { 24 | [self setup]; 25 | } 26 | return self; 27 | } 28 | 29 | - (void)setup { 30 | [self setBackgroundColor:[UIColor clearColor]]; 31 | 32 | _strokeWidth = 2; 33 | _gapWidth = 1.5; 34 | _diameter = 12; 35 | 36 | UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onTapped:)]; 37 | [self addGestureRecognizer:tapGestureRecognizer]; 38 | } 39 | 40 | - (void)onTapped:(UITapGestureRecognizer*)gesture { 41 | CGPoint touchPoint = [gesture locationInView:[gesture view]]; 42 | 43 | if (touchPoint.x < self.frame.size.width / 2.0) { 44 | // move left 45 | if (self.currentPage > 0) { 46 | if (touchPoint.x <= 22) { 47 | self.currentPage = 0; 48 | } else { 49 | self.currentPage -= 1; 50 | } 51 | } 52 | 53 | } else { 54 | // move right 55 | if (self.currentPage < self.numberOfPages - 1) { 56 | if (touchPoint.x >= (CGRectGetWidth(self.bounds) - 22)) { 57 | self.currentPage = self.numberOfPages-1; 58 | } else { 59 | self.currentPage += 1; 60 | } 61 | } 62 | } 63 | [self setNeedsDisplay]; 64 | [self sendActionsForControlEvents:UIControlEventValueChanged]; 65 | } 66 | 67 | 68 | - (void)drawRect:(CGRect)rect { 69 | // Drawing code 70 | if (self.hidesForSinglePage && self.numberOfPages==1) 71 | { 72 | return; 73 | } 74 | 75 | NSInteger gap = self.gapWidth; 76 | float diameter = self.diameter - 2*self.strokeWidth; 77 | 78 | if (self.thumbImage && self.selectedThumbImage) 79 | { 80 | diameter = self.thumbImage.size.width; 81 | } 82 | 83 | int total_width = self.numberOfPages*diameter + (self.numberOfPages-1)*gap; 84 | 85 | if (total_width>self.frame.size.width) 86 | { 87 | while (total_width>self.frame.size.width) 88 | { 89 | diameter -= 2; 90 | gap = diameter + 2; 91 | while (total_width>self.frame.size.width) 92 | { 93 | gap -= 1; 94 | total_width = self.numberOfPages*diameter + (self.numberOfPages-1)*gap; 95 | 96 | if (gap==2) 97 | { 98 | break; 99 | total_width = self.numberOfPages*diameter + (self.numberOfPages-1)*gap; 100 | } 101 | } 102 | 103 | if (diameter==2) 104 | { 105 | break; 106 | total_width = self.numberOfPages*diameter + (self.numberOfPages-1)*gap; 107 | } 108 | } 109 | 110 | 111 | } 112 | 113 | int i; 114 | for (i=0; i 10 | 11 | @interface XHPaggingNavbar : UIView 12 | 13 | /** 14 | * 显示在导航条上的title集合 15 | */ 16 | @property (nonatomic, strong) NSArray *titles; 17 | 18 | /** 19 | * 当前页码 20 | */ 21 | @property (nonatomic, assign) NSInteger currentPage; 22 | 23 | /** 24 | * 外部设置滑动页面的距离 25 | */ 26 | @property (nonatomic, assign) CGPoint contentOffset; 27 | 28 | @property (nonatomic, copy) void (^didChangedIndex)(NSInteger index); 29 | 30 | /** 31 | * 设置title集合数据源后,进行reload的方法 32 | */ 33 | - (void)reloadData; 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /XHTwitterPaggingViewer/Views/XHPaggingNavbar.m: -------------------------------------------------------------------------------- 1 | // 2 | // XHPaggingNavbar.m 3 | // XHTwitterPagging 4 | // 5 | // Created by 曾 宪华 on 14-6-20. 6 | // Copyright (c) 2014年 嗨,我是曾宪华(@xhzengAIB),曾加入YY Inc.担任高级移动开发工程师,拍立秀App联合创始人,热衷于简洁、而富有理性的事物 QQ:543413507 主页:http://zengxianhua.com All rights reserved. 7 | // 8 | 9 | #import "XHPaggingNavbar.h" 10 | 11 | #import "XHPageControl.h" 12 | 13 | #define kXHiPad ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) 14 | 15 | #define kXHLabelBaseTag 1000 16 | 17 | #define kXHRadie 3.2 18 | 19 | @interface XHPaggingNavbar () { 20 | CGFloat _mainScreenWidth; 21 | } 22 | 23 | /** 24 | * 分页指示器 25 | */ 26 | @property (nonatomic, strong) XHPageControl *pageControl; 27 | 28 | /** 29 | * title label 集合 30 | */ 31 | @property (nonatomic, strong) NSMutableArray *titleLabels; 32 | 33 | @end 34 | 35 | @implementation XHPaggingNavbar 36 | 37 | #pragma mark - DataSource 38 | 39 | - (void)reloadData { 40 | if (!self.titles.count) { 41 | return; 42 | } 43 | 44 | [self.titleLabels enumerateObjectsUsingBlock:^(UILabel *label, NSUInteger idx, BOOL *stop) { 45 | label.hidden = YES; 46 | }]; 47 | 48 | [self.titles enumerateObjectsUsingBlock:^(NSString *title, NSUInteger idx, BOOL *stop) { 49 | CGRect titleLabelFrame = CGRectMake((idx * (kXHiPad ? 240 : _mainScreenWidth / kXHRadie)), 8, CGRectGetWidth(self.bounds), 20); 50 | NSInteger tag = kXHLabelBaseTag + idx; 51 | UILabel *titleLabel = (UILabel *)[self viewWithTag: tag]; 52 | if (!titleLabel) { 53 | titleLabel = [[UILabel alloc] init]; 54 | titleLabel.tag = tag; 55 | [self addSubview:titleLabel]; 56 | [self.titleLabels addObject:titleLabel]; 57 | } 58 | titleLabel.hidden = NO; 59 | titleLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin; 60 | titleLabel.font = [[UINavigationBar appearance].titleTextAttributes objectForKey:NSFontAttributeName]; 61 | titleLabel.textAlignment = NSTextAlignmentCenter; 62 | titleLabel.textColor = [UINavigationBar appearance].tintColor; 63 | titleLabel.backgroundColor = [UIColor clearColor]; 64 | titleLabel.text = title; 65 | titleLabel.frame = titleLabelFrame; 66 | if (self.currentPage == idx) { 67 | titleLabel.alpha = 1.0; 68 | } else { 69 | titleLabel.alpha = 0.0; 70 | } 71 | }]; 72 | 73 | self.pageControl.numberOfPages = self.titles.count; 74 | } 75 | 76 | - (void)pageControlValueChanged:(XHPageControl *)pageControl { 77 | if (self.didChangedIndex) { 78 | self.didChangedIndex(pageControl.currentPage); 79 | } 80 | } 81 | 82 | #pragma mark - Propertys 83 | 84 | - (void)setCurrentPage:(NSInteger)currentPage { 85 | _currentPage = currentPage; 86 | self.pageControl.currentPage = currentPage; 87 | } 88 | 89 | - (void)setContentOffset:(CGPoint)contentOffset { 90 | _contentOffset = contentOffset; 91 | 92 | CGFloat xOffset = contentOffset.x; 93 | 94 | CGFloat normalWidth = CGRectGetWidth([[UIScreen mainScreen] bounds]); 95 | 96 | [self.titleLabels enumerateObjectsUsingBlock:^(UILabel *titleLabel, NSUInteger idx, BOOL *stop) { 97 | if ([titleLabel isKindOfClass:[UILabel class]]) { 98 | 99 | // frame 100 | CGRect titleLabelFrame = titleLabel.frame; 101 | titleLabelFrame.origin.x = (idx * (kXHiPad ? 240 : _mainScreenWidth / kXHRadie)) - xOffset / kXHRadie; 102 | titleLabel.frame = titleLabelFrame; 103 | 104 | // alpha 105 | CGFloat alpha; 106 | if(xOffset < normalWidth * idx) { 107 | alpha = (xOffset - normalWidth * (idx - 1)) / normalWidth; 108 | }else{ 109 | alpha = 1 - ((xOffset - normalWidth * idx) / normalWidth); 110 | } 111 | titleLabel.alpha = alpha; 112 | } 113 | }]; 114 | } 115 | 116 | - (XHPageControl *)pageControl { 117 | if (!_pageControl) { 118 | _pageControl = [[XHPageControl alloc] init]; 119 | _pageControl.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin; 120 | _pageControl.frame = (CGRect){0, 25, CGRectGetWidth(self.bounds), 20}; 121 | [_pageControl addTarget:self action:@selector(pageControlValueChanged:) forControlEvents:UIControlEventValueChanged]; 122 | _pageControl.hidesForSinglePage = YES; 123 | _pageControl.currentPage = self.currentPage; 124 | [_pageControl setThumbImage:[UIImage imageNamed:@"thumbnail_normal"]]; 125 | [_pageControl setSelectedThumbImage:[UIImage imageNamed:@"thumbnail_selected"]]; 126 | } 127 | return _pageControl; 128 | } 129 | 130 | - (NSMutableArray *)titleLabels { 131 | if (!_titleLabels) { 132 | _titleLabels = [[NSMutableArray alloc] initWithCapacity:0]; 133 | } 134 | return _titleLabels; 135 | } 136 | 137 | #pragma mark - Life Cycle 138 | 139 | - (id)initWithFrame:(CGRect)frame { 140 | self = [super initWithFrame:frame]; 141 | if (self) { 142 | // Initialization code 143 | self.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; 144 | _mainScreenWidth = [[UIScreen mainScreen] bounds].size.width; 145 | 146 | [self addSubview:self.pageControl]; 147 | } 148 | return self; 149 | } 150 | 151 | - (void)dealloc { 152 | self.pageControl = nil; 153 | self.titleLabels = nil; 154 | } 155 | 156 | @end 157 | --------------------------------------------------------------------------------