你好,歡迎來到IOS教程網

 Ios教程網 >> IOS訊息 >> 關於IOS >> UIScrollView全部API學習。

UIScrollView全部API學習。

編輯:關於IOS
//1.設定滾定條的樣式

typedef
NS_ENUM(NSInteger, UIScrollViewIndicatorStyle) {

UIScrollViewIndicatorStyleDefault,     // black with white border. good against any background
黑白邊框

UIScrollViewIndicatorStyleBlack,       // black only. smaller. good against a white background
純黑邊框

UIScrollViewIndicatorStyleWhite        // white only. smaller. good against a black background
純白邊框

};

//2.在UIScrollView中鍵盤的消失方式

typedef
NS_ENUM(NSInteger, UIScrollViewKeyboardDismissMode) {

UIScrollViewKeyboardDismissModeNone,
默認樣式

UIScrollViewKeyboardDismissModeOnDrag,
// dismisses the keyboard when a drag begins
設定鍵盤的消失方式為拖拉頁面

UIScrollViewKeyboardDismissModeInteractive,
// the keyboard follows the dragging touch off screen, and may be pulled upward again to cancel the dismiss
設定鍵盤消失方式為拖拉並點擊頁面

} NS_ENUM_AVAILABLE_IOS(7_0);

//3.這個參數可以設置減速的速率

UIKIT_EXTERN
const CGFloat UIScrollViewDecelerationRateNormal
NS_AVAILABLE_IOS(3_0);

//4.這個參數可以設置減速的速率

UIKIT_EXTERN
const CGFloat UIScrollViewDecelerationRateFast
NS_AVAILABLE_IOS(3_0);

//5.從內容視圖的原點偏移的一個點

@property(nonatomic)
CGPoint                      contentOffset;
//6.內容視圖的大小

@property(nonatomic)
CGSize                       contentSize;

//7.內容視圖的距離,是從封閉的滾動視圖插圖

@property(nonatomic)
UIEdgeInsets                 contentInset;
around content

//8.滾動視圖的代理

@property(nonatomic,assign)
id<UIScrollViewDelegate>      delegate;

//9.一個bool值,用來決定是否在某一特定方向禁用滾動

@property(nonatomic,getter=isDirectionalLockEnabled)
BOOL directionalLockEnabled;

//10.控制滾動視圖是否反彈過去內容的邊緣,然後再返回一個布爾值

@property(nonatomic)
BOOL                         bounces;

//11.如果這個屬性被設置成YES而且bounces的值是YES,垂直拖動是允許的內容,即使小魚滾動視圖的邊界,默認是NO

@property(nonatomic)
BOOL                         alwaysBounceVertical;

//12.一個布爾值,決定是否反彈總是發生在垂直滾動到達結束內容,默認值是NO

@property(nonatomic)
BOOL                         alwaysBounceHorizontal;

//13.一個布爾值
決定是否棄用分頁滾動視圖

@property(nonatomic,getter=isPagingEnabled)
BOOL          pagingEnabled;

//14.決定是否棄用滾動

@property(nonatomic,getter=isScrollEnabled)
BOOL          scrollEnabled;

//15.控制水平滾動指標是否可見的

@property(nonatomic)
BOOL                         showsHorizontalScrollIndicator;

//16.控制垂直滾動指標是否是可見的

@property(nonatomic)
BOOL                         showsVerticalScrollIndicator;

//17.滾動指標點到滾動視圖的邊緣的距離

@property(nonatomic)
UIEdgeInsets                 scrollIndicatorInsets;     
//18.指示器的風格設置

@property(nonatomic)
UIScrollViewIndicatorStyle   indicatorStyle;

//19.默認減速率

@property(nonatomic)
CGFloat                      decelerationRate
NS_AVAILABLE_IOS(3_0);

//20.設置從內容原點偏移到指定點的方法

- (void)setContentOffset:(CGPoint)contentOffset animated:(BOOL)animated;
//21.滾動一個特定區域的內容以便它在接受是可見的

- (void)scrollRectToVisible:(CGRect)rect animated:(BOOL)animated;
//22.暫時顯示滾動指標

- (void)flashScrollIndicators;

//23.返回判斷是否用戶碰觸內容觸發滾動(只讀)

@property(nonatomic,readonly,getter=isTracking)
BOOL tracking;

//24.一個布爾值
知識用戶是否已經開始滾動內容

@property(nonatomic,readonly,getter=isDragging)
BOOL dragging;

//25.返回的內容是否在滾動視圖後,用戶接觸他們的手指(只讀)

@property(nonatomic,readonly,getter=isDecelerating)
BOOL decelerating;

//26.一個布爾值,決定是否推遲滾動視圖觸摸手勢的處理

@property(nonatomic)
BOOL delaysContentTouches;

//27.如果這個值設置為YES,那麼當你在UIScrollView上面放置任何子視圖的時候,當你在子視圖上移動的時候,UIScrollView會給子視圖發送touchCancel消息,而如果該屬性設置為NO,ScollView本身不處理這個消息,全部交給子視圖處理

@property(nonatomic)
BOOL canCancelContentTouches;

//28.自定義默認行為,當手指觸摸在顯示的內容由子類重寫

- (BOOL)touchesShouldBegin:(NSSet *)touches withEvent:(UIEvent *)event inContentView:(UIView
*)view;

//29.它開始發送跟蹤郵件的內容視圖後動視圖調用此方法。如果它從這種方法受到NO便停止拖動和轉發觸摸時間的內容子視圖。

- (BOOL)touchesShouldCancelInContentView:(UIView *)view;

//30.浮點值
指定可應用於滾動視圖的內容的最低比例因子

@property(nonatomic)
CGFloat minimumZoomScale;

//31.一個浮點值指定可用於滾動視圖的內容的最大規模的因素

@property(nonatomic)
CGFloat maximumZoomScale;

//32.一個浮點值
指定目前用於滾動視圖的內容的比例因子

@property(nonatomic)
CGFloat zoomScale
NS_AVAILABLE_IOS(3_0);            //33.一個浮點數指定當前的縮放比例

- (void)setZoomScale:(CGFloat)scale animated:(BOOL)animated
NS_AVAILABLE_IOS(3_0);

//34.縮小到特定區域的內容,所以它是在接收器中可見

- (void)zoomToRect:(CGRect)rect animated:(BOOL)animated
NS_AVAILABLE_IOS(3_0);

//35.一個布爾值,決定當當縮放超過上限或是下限時是否滾動視圖推動內容縮放

@property(nonatomic)
BOOL  bouncesZoom;

//36.一個布爾值
指示內容是否認為正在方法或者縮小(只讀)

@property(nonatomic,readonly,getter=isZooming)
BOOL zooming;

//37.一個布爾值
指示縮放已超過指定的接受范圍

@property(nonatomic,readonly,getter=isZoomBouncing)
BOOL zoomBouncing;

//38.一個布爾值
控制是否滾動到頂部的姿態是有效地

@property(nonatomic)
BOOL  scrollsToTop;

//39.拖動手勢(只讀)

@property(nonatomic,
readonly) UIPanGestureRecognizer *panGestureRecognizer
NS_AVAILABLE_IOS(5_0);

//40.向裡向外捏用於縮放

@property(nonatomic,
readonly) UIPinchGestureRecognizer *pinchGestureRecognizer
NS_AVAILABLE_IOS(5_0);

//41.設置見哦按的小事樣式

@property(nonatomic)
UIScrollViewKeyboardDismissMode keyboardDismissMode
NS_AVAILABLE_IOS(7_0);

@end

@protocol UIScrollViewDelegate<NSObject>

@optional

//42.scrollView正在滾動的時候調用

- (void)scrollViewDidScroll:(UIScrollView *)scrollView;

//43.scrollView正在被拖動的時候調用

- (void)scrollViewDidZoom:(UIScrollView *)scrollView
NS_AVAILABLE_IOS(3_2);

//44. scrollView開始拖拽的時候調用

- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView;

//45. scrollView將要結束拖拽的時候調用

- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity
targetContentOffset:(inout
CGPoint *)targetContentOffset NS_AVAILABLE_IOS(5_0);

//46. scrollView完成拖拽的時候調用

- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate;

//47. scrollView將開始降速的時候調用

- (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView;

//48. scrollView在減速停止了時候執行,手觸摸時候執行

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView;

//49. 滾動動畫停止時執行代碼改變時觸發,也就是setContentOffset改變的時候

- (void)scrollViewDidEndScrollingAnimation:(UIScrollView *)scrollView;

//50.返回一個放大或者縮小的視圖

- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView;

//51.開始放大或者縮小時候調用

- (void)scrollViewWillBeginZooming:(UIScrollView *)scrollView withView:(UIView
*)view NS_AVAILABLE_IOS(3_2);

//52.縮放結束時候調用

- (void)scrollViewDidEndZooming:(UIScrollView *)scrollView withView:(UIView
*)view atScale:(CGFloat)scale;

//53.是否支持滾動至頂部

- (BOOL)scrollViewShouldScrollToTop:(UIScrollView *)scrollView;

//54.滾動頂部時候調用該方法

- (void)scrollViewDidScrollToTop:(UIScrollView *)scrollView;

@end
  1. 上一頁:
  2. 下一頁:
蘋果刷機越獄教程| IOS教程問題解答| IOS技巧綜合| IOS7技巧| IOS8教程
Copyright © Ios教程網 All Rights Reserved