UICollectionViewDataSource クラス

定義

UICollectionViewのデータ ソース。

[Foundation.Model]
[Foundation.Protocol]
[Foundation.Register("Microsoft_iOS__UIKit_UICollectionViewDataSource", false)]
public abstract class UICollectionViewDataSource : Foundation.NSObject, IDisposable, UIKit.IUICollectionViewDataSource
[Foundation.Model]
[Foundation.Protocol]
[Foundation.Register("Microsoft_MacCatalyst__UIKit_UICollectionViewDataSource", false)]
public abstract class UICollectionViewDataSource : Foundation.NSObject, IDisposable, UIKit.IUICollectionViewDataSource
[Foundation.Model]
[Foundation.Protocol]
[Foundation.Register("Microsoft_tvOS__UIKit_UICollectionViewDataSource", false)]
public abstract class UICollectionViewDataSource : Foundation.NSObject, IDisposable, UIKit.IUICollectionViewDataSource
[<Foundation.Model>]
[<Foundation.Protocol>]
[<Foundation.Register("Microsoft_iOS__UIKit_UICollectionViewDataSource", false)>]
type UICollectionViewDataSource = class
    inherit NSObject
    interface IUICollectionViewDataSource
    interface INativeObject
    interface IDisposable
[<Foundation.Model>]
[<Foundation.Protocol>]
[<Foundation.Register("Microsoft_MacCatalyst__UIKit_UICollectionViewDataSource", false)>]
type UICollectionViewDataSource = class
    inherit NSObject
    interface IUICollectionViewDataSource
    interface INativeObject
    interface IDisposable
[<Foundation.Model>]
[<Foundation.Protocol>]
[<Foundation.Register("Microsoft_tvOS__UIKit_UICollectionViewDataSource", false)>]
type UICollectionViewDataSource = class
    inherit NSObject
    interface IUICollectionViewDataSource
    interface INativeObject
    interface IDisposable
継承
UICollectionViewDataSource
属性
実装

注釈

UITableViewMKMapViewなど、iOS の他の部分と同様に、UICollectionViewは、UICollectionViewDataSource クラスを介して MonoTouch で公開されているデータ ソースからデータを取得します。 このクラスは、次のようなコンテンツを UICollectionView に提供する役割を担います。

UICollectionViewは再利用キューを維持し、必要以上に割り当てや割り当てを解除することなく、UICollectionReusableViewを効率的に再利用します。 GetCell(UICollectionView, NSIndexPath)GetViewForSupplementaryElement(UICollectionView, NSString, NSIndexPath)は、コンポーネント ビューの値UICollectionReusableView変更する関数です。 これらのメソッドはスクロール中に頻繁に呼び出される可能性があるため (特に GetCell(UICollectionView, NSIndexPath))、アプリケーション開発者は不要な計算を避ける必要があります。

「コレクション ビューの概要」から取得した次のコードは、単純な UICollectionViewDataSource 実装を示しています。 モデル データを表す 3 つのセクションと大きな animal 配列があります。 セクションあたりの項目数は、 animals 配列の合計サイズの 1/3 です。 AnimalCell型はUICollectionViewCellのサブタイプであり、UIImageImage プロパティを持つものとして定義されます。GetCell(UICollectionView, NSIndexPath) メソッドは、必要に応じて、animals データから再利用されるanimalCellでこのプロパティを設定します。 同様に、UICollectionViewDataSourceは、プロジェクトで定義されているHeader型のText プロパティを設定します。

protected const int SectionCount = 3;

public override int NumberOfSections (UICollectionView collectionView)
{
  return SectionCount;
}

public override int GetItemsCount (UICollectionView collectionView, int section)
{
  return animals.Count / SectionCount;
}

public override UICollectionViewCell GetCell (UICollectionView collectionView, Foundation.NSIndexPath indexPath)
{
  var animalCell = (AnimalCell)collectionView.DequeueReusableCell (animalCellId, indexPath);

  var animal = animals [indexPath.Section * (animals.Count / SectionCount) + indexPath.Row];

  animalCell.Image = animal.Image;

  return animalCell;
}

public override UICollectionReusableView GetViewForSupplementaryElement (UICollectionView collectionView, NSString elementKind, NSIndexPath indexPath)
{
  var headerView = (Header)collectionView.DequeueReusableSupplementaryView (elementKind, headerId, indexPath);
  headerView.Text = "Supplementary View Section " + indexPath.Section.ToString ();
  return headerView;
}

UICollectionViewSourceは、UICollectionViewDataSource API と UICollectionViewDelegate API を 1 つの便利なクラスに結合します。 DataSourceプロパティとDelegate プロパティに割り当てる 2 つのクラスを作成するのではなく、1 つのUICollectionViewSourceを作成してSource プロパティに割り当てることができます。

コンストラクター

名前 説明
UICollectionViewDataSource()

既定値を使用して新しい UICollectionViewDataSource を作成します。

UICollectionViewDataSource(NativeHandle)

アンマネージ オブジェクトのマネージド表現を作成するときに使用されるコンストラクター。 ランタイムによって呼び出されます。

UICollectionViewDataSource(NSObjectFlag)

初期化をスキップし、単にオブジェクトを割り当てるために派生クラスを呼び出すコンストラクター。

プロパティ

名前 説明
AccessibilityAttributedUserInputLabels

UICollectionViewのデータ ソース。

(継承元 NSObject)
AccessibilityRespondsToUserInteraction

UICollectionViewのデータ ソース。

(継承元 NSObject)
AccessibilityTextualContext

UICollectionViewのデータ ソース。

(継承元 NSObject)
AccessibilityUserInputLabels

UICollectionViewのデータ ソース。

(継承元 NSObject)
Class

UICollectionViewのデータ ソース。

(継承元 NSObject)
ClassHandle

このクラスの Objective-C クラス ハンドル。

(継承元 NSObject)
DebugDescription

UICollectionViewのデータ ソース。

(継承元 NSObject)
Description

UICollectionViewのデータ ソース。

(継承元 NSObject)
Handle

アンマネージ オブジェクト表現へのハンドル (ポインター)。

(継承元 NSObject)
IsDirectBinding

このインスタンスが直接 Objective-C バインドを使用するかどうかを示す値を取得または設定します。

(継承元 NSObject)
IsProxy

UICollectionViewのデータ ソース。

(継承元 NSObject)
RetainCount

UICollectionViewのデータ ソース。

(継承元 NSObject)
Self

UICollectionViewのデータ ソース。

(継承元 NSObject)
Superclass

UICollectionViewのデータ ソース。

(継承元 NSObject)
SuperHandle

この NSObjectの基底クラスのメソッドを表すために使用されるハンドル。

(継承元 NSObject)
Zone

UICollectionViewのデータ ソース。

(継承元 NSObject)

メソッド

名前 説明
AddObserver(NSObject, NSString, NSKeyValueObservingOptions, IntPtr)

UICollectionViewのデータ ソース。

(継承元 NSObject)
AddObserver(NSObject, String, NSKeyValueObservingOptions, IntPtr)

UICollectionViewのデータ ソース。

(継承元 NSObject)
AddObserver(NSString, NSKeyValueObservingOptions, Action<NSObservedChange>)

任意のメソッドを使用して外部で観察されるオブジェクトを登録します。

(継承元 NSObject)
AddObserver(String, NSKeyValueObservingOptions, Action<NSObservedChange>)

任意のメソッドを使用して外部で観察されるオブジェクトを登録します。

(継承元 NSObject)
AwakeFromNib()

UICollectionViewのデータ ソース。

(継承元 NSObject)
BeginInvokeOnMainThread(Action)

メイン UI スレッドで、指定したアクションを非同期的に呼び出します。

(継承元 NSObject)
BeginInvokeOnMainThread(Selector, NSObject)

メイン UI スレッドで指定したコードを非同期的に呼び出します。

(継承元 NSObject)
CanMoveItem(UICollectionView, NSIndexPath)

UICollectionViewのデータ ソース。

ConformsToProtocol(NativeHandle)

UICollectionViewのデータ ソース。

(継承元 NSObject)
Copy()

UICollectionViewのデータ ソース。

(継承元 NSObject)
DangerousAutorelease()

このオブジェクトの 'autorelease' セレクターを呼び出します。

(継承元 NSObject)
DangerousRelease()

このオブジェクトの 'release' セレクターを呼び出します。

(継承元 NSObject)
DangerousRetain()

このオブジェクトで 'retain' セレクターを呼び出します。

(継承元 NSObject)
DidChange(NSKeyValueChange, NSIndexSet, NSString)

UICollectionViewのデータ ソース。

(継承元 NSObject)
DidChange(NSString, NSKeyValueSetMutationKind, NSSet)

UICollectionViewのデータ ソース。

(継承元 NSObject)
DidChangeValue(String)

UICollectionViewのデータ ソース。

(継承元 NSObject)
Dispose()

NSObject オブジェクトによって使用されるリソースを解放します。

(継承元 NSObject)
Dispose(Boolean)

このオブジェクトで使用されるリソースを解放します。

(継承元 NSObject)
DoesNotRecognizeSelector(Selector)

UICollectionViewのデータ ソース。

(継承元 NSObject)
Equals(NSObject)

指定した NSObject が現在の NSObjectと等しいかどうかを判断します。

(継承元 NSObject)
Equals(Object)

指定したオブジェクトが現在の NSObjectと等しいかどうかを判断します。

(継承元 NSObject)
GetCell(UICollectionView, NSIndexPath)

セルを取得します。

GetDictionaryOfValuesFromKeys(NSString[])

UICollectionViewのデータ ソース。

(継承元 NSObject)
GetHashCode()

現在のインスタンスのハッシュ コードを生成します。

(継承元 NSObject)
GetIndexPath(UICollectionView, String, IntPtr)

指定したタイトルを持つ指定したインデックス位置にあるコレクション ビュー内の項目のインデックス パスを要求します。

GetIndexTitles(UICollectionView)

指定したコレクション ビュー内の項目のインデックス タイトルを要求します。

GetItemsCount(UICollectionView, IntPtr)

指定したセクション内の項目数を返します。

GetMethodForSelector(Selector)

UICollectionViewのデータ ソース。

(継承元 NSObject)
GetNativeHash()

UICollectionViewのデータ ソース。

(継承元 NSObject)
GetViewForSupplementaryElement(UICollectionView, NSString, NSIndexPath)

指定した indexPath の補助要素に使用される再利用可能なビュー。

Init()

Objective-C init メソッドを呼び出してオブジェクトを初期化します。

(継承元 NSObject)
InitializeHandle(NativeHandle, String)

UICollectionViewのデータ ソース。

(継承元 NSObject)
InitializeHandle(NativeHandle)

UICollectionViewのデータ ソース。

(継承元 NSObject)
Invoke(Action, Double)

指定した遅延の後に、指定したアクションを呼び出します。

(継承元 NSObject)
Invoke(Action, TimeSpan)

指定した遅延の後に、指定したアクションを呼び出します。

(継承元 NSObject)
InvokeOnMainThread(Action)

メイン UI スレッドで、指定したアクションを同期的に呼び出します。

(継承元 NSObject)
InvokeOnMainThread(Selector, NSObject)

メイン UI スレッドで、指定したコードを同期的に呼び出します。

(継承元 NSObject)
IsEqual(NSObject)

UICollectionViewのデータ ソース。

(継承元 NSObject)
IsKindOfClass(Class)

UICollectionViewのデータ ソース。

(継承元 NSObject)
IsMemberOfClass(Class)

UICollectionViewのデータ ソース。

(継承元 NSObject)
MarkDirty()

通常のピア オブジェクト (IsDirectBinding が true) を toggleref オブジェクトに昇格させます。

(継承元 NSObject)
MoveItem(UICollectionView, NSIndexPath, NSIndexPath)

UICollectionViewのデータ ソース。

MutableCopy()

UICollectionViewのデータ ソース。

(継承元 NSObject)
NumberOfSections(UICollectionView)

この UICollectionViewDataSource 内のセクションの数。

ObserveValue(NSString, NSObject, NSDictionary, IntPtr)

UICollectionViewのデータ ソース。

(継承元 NSObject)
PerformSelector(Selector, NSObject, Double, NSString[])

UICollectionViewのデータ ソース。

(継承元 NSObject)
PerformSelector(Selector, NSObject, Double)

UICollectionViewのデータ ソース。

(継承元 NSObject)
PerformSelector(Selector, NSObject, NSObject)

UICollectionViewのデータ ソース。

(継承元 NSObject)
PerformSelector(Selector, NSObject)

UICollectionViewのデータ ソース。

(継承元 NSObject)
PerformSelector(Selector, NSThread, NSObject, Boolean, NSString[])

UICollectionViewのデータ ソース。

(継承元 NSObject)
PerformSelector(Selector, NSThread, NSObject, Boolean)

UICollectionViewのデータ ソース。

(継承元 NSObject)
PerformSelector(Selector)

UICollectionViewのデータ ソース。

(継承元 NSObject)
PrepareForInterfaceBuilder()

UICollectionViewのデータ ソース。

(継承元 NSObject)
RemoveObserver(NSObject, NSString, IntPtr)

UICollectionViewのデータ ソース。

(継承元 NSObject)
RemoveObserver(NSObject, NSString)

UICollectionViewのデータ ソース。

(継承元 NSObject)
RemoveObserver(NSObject, String, IntPtr)

UICollectionViewのデータ ソース。

(継承元 NSObject)
RemoveObserver(NSObject, String)

UICollectionViewのデータ ソース。

(継承元 NSObject)
RespondsToSelector(Selector)

UICollectionViewのデータ ソース。

(継承元 NSObject)
SetNilValueForKey(NSString)

UICollectionViewのデータ ソース。

(継承元 NSObject)
SetValueForKey(NSObject, NSString)

UICollectionViewのデータ ソース。

(継承元 NSObject)
SetValueForKeyPath(NativeHandle, NSString)

特定のキー パスによって識別されるプロパティの値を、指定された値に設定します。

(継承元 NSObject)
SetValueForKeyPath(NSObject, NSString)

UICollectionViewのデータ ソース。

(継承元 NSObject)
SetValueForUndefinedKey(NSObject, NSString)

UICollectionViewのデータ ソース。

(継承元 NSObject)
SetValuesForKeysWithDictionary(NSDictionary)

UICollectionViewのデータ ソース。

(継承元 NSObject)
ToString()

現在のインスタンスの値の文字列形式を返します。

(継承元 NSObject)
ValueForKey(NSString)

UICollectionViewのデータ ソース。

(継承元 NSObject)
ValueForKeyPath(NSString)

UICollectionViewのデータ ソース。

(継承元 NSObject)
ValueForUndefinedKey(NSString)

UICollectionViewのデータ ソース。

(継承元 NSObject)
WillChange(NSKeyValueChange, NSIndexSet, NSString)

UICollectionViewのデータ ソース。

(継承元 NSObject)
WillChange(NSString, NSKeyValueSetMutationKind, NSSet)

UICollectionViewのデータ ソース。

(継承元 NSObject)
WillChangeValue(String)

UICollectionViewのデータ ソース。

(継承元 NSObject)

拡張メソッド

名前 説明
AccessibilityHitTest(NSObject, CGPoint, UIEvent)

UICollectionViewのデータ ソース。

BrowserAccessibilityDeleteTextAtCursor(NSObject, IntPtr)

UICollectionViewのデータ ソース。

BrowserAccessibilityInsertTextAtCursor(NSObject, String)

UICollectionViewのデータ ソース。

CanMoveItem(IUICollectionViewDataSource, UICollectionView, NSIndexPath)

UICollectionViewのデータ ソース。

GetAccessibilityCustomRotors(NSObject)

オブジェクトに適 UIAccessibilityCustomRotor オブジェクトの配列 this 取得します。

GetAccessibilityLineEndPositionFromCurrentSelection(NSObject)

UICollectionViewのデータ ソース。

GetAccessibilityLineRangeForPosition(NSObject, IntPtr)

UICollectionViewのデータ ソース。

GetAccessibilityLineStartPositionFromCurrentSelection(NSObject)

UICollectionViewのデータ ソース。

GetAccessibilityNextTextNavigationElement(NSObject)

UICollectionViewのデータ ソース。

GetAccessibilityNextTextNavigationElementBlock(NSObject)

UICollectionViewのデータ ソース。

GetAccessibilityPreviousTextNavigationElement(NSObject)

UICollectionViewのデータ ソース。

GetAccessibilityPreviousTextNavigationElementBlock(NSObject)

UICollectionViewのデータ ソース。

GetAccessibilityTextInputResponder(NSObject)

UICollectionViewのデータ ソース。

GetAccessibilityTextInputResponderHandler(NSObject)

UICollectionViewのデータ ソース。

GetBrowserAccessibilityAttributedValue(NSObject, NSRange)

UICollectionViewのデータ ソース。

GetBrowserAccessibilityContainerType(NSObject)

UICollectionViewのデータ ソース。

GetBrowserAccessibilityCurrentStatus(NSObject)

UICollectionViewのデータ ソース。

GetBrowserAccessibilityHasDomFocus(NSObject)

UICollectionViewのデータ ソース。

GetBrowserAccessibilityIsRequired(NSObject)

UICollectionViewのデータ ソース。

GetBrowserAccessibilityPressedState(NSObject)

UICollectionViewのデータ ソース。

GetBrowserAccessibilityRoleDescription(NSObject)

UICollectionViewのデータ ソース。

GetBrowserAccessibilitySelectedTextRange(NSObject)

UICollectionViewのデータ ソース。

GetBrowserAccessibilitySortDirection(NSObject)

UICollectionViewのデータ ソース。

GetBrowserAccessibilityValue(NSObject, NSRange)

UICollectionViewのデータ ソース。

GetDebugDescription(INSObjectProtocol)

UICollectionViewのデータ ソース。

GetHandle(INativeObject)

UICollectionViewのデータ ソース。

GetIndexPath(IUICollectionViewDataSource, UICollectionView, String, IntPtr)

指定したタイトルを持つ指定したインデックス位置にあるコレクション ビュー内の項目のインデックス パスを要求します。

GetIndexTitles(IUICollectionViewDataSource, UICollectionView)

指定したコレクション ビュー内の項目のインデックス タイトルを要求します。

GetNonNullHandle(INativeObject, String)

UICollectionViewのデータ ソース。

GetViewForSupplementaryElement(IUICollectionViewDataSource, UICollectionView, NSString, NSIndexPath)

指定した indexPath の補助要素に使用される再利用可能なビュー。

MoveItem(IUICollectionViewDataSource, UICollectionView, NSIndexPath, NSIndexPath)

UICollectionViewのデータ ソース。

NumberOfSections(IUICollectionViewDataSource, UICollectionView)

この UICollectionViewDataSource 内のセクションの数。

ProvideImageData(NSObject, IntPtr, UIntPtr, UIntPtr, UIntPtr, UIntPtr, UIntPtr, NSObject)

UICollectionViewのデータ ソース。

ProvideImageToMTLTexture(NSObject, IMTLTexture, IMTLCommandBuffer, UIntPtr, UIntPtr, UIntPtr, UIntPtr, NSObject)

UICollectionViewのデータ ソース。

SetAccessibilityCustomRotors(NSObject, UIAccessibilityCustomRotor[])

オブジェクトに適 UIAccessibilityCustomRotor オブジェクトの配列 this 設定します。

SetAccessibilityNextTextNavigationElement(NSObject, NSObject)

UICollectionViewのデータ ソース。

SetAccessibilityNextTextNavigationElementBlock(NSObject, AXObjectReturnBlock)

UICollectionViewのデータ ソース。

SetAccessibilityPreviousTextNavigationElement(NSObject, NSObject)

UICollectionViewのデータ ソース。

SetAccessibilityPreviousTextNavigationElementBlock(NSObject, AXObjectReturnBlock)

UICollectionViewのデータ ソース。

SetAccessibilityTextInputResponder(NSObject, IUITextInput)

UICollectionViewのデータ ソース。

SetAccessibilityTextInputResponderHandler(NSObject, UITextInputReturnHandler)

UICollectionViewのデータ ソース。

SetBrowserAccessibilityContainerType(NSObject, BEAccessibilityContainerType)

UICollectionViewのデータ ソース。

SetBrowserAccessibilityCurrentStatus(NSObject, String)

UICollectionViewのデータ ソース。

SetBrowserAccessibilityHasDomFocus(NSObject, Boolean)

UICollectionViewのデータ ソース。

SetBrowserAccessibilityIsRequired(NSObject, Boolean)

UICollectionViewのデータ ソース。

SetBrowserAccessibilityPressedState(NSObject, BEAccessibilityPressedState)

UICollectionViewのデータ ソース。

SetBrowserAccessibilityRoleDescription(NSObject, String)

UICollectionViewのデータ ソース。

SetBrowserAccessibilitySelectedTextRange(NSObject, NSRange)

UICollectionViewのデータ ソース。

SetBrowserAccessibilitySortDirection(NSObject, String)

UICollectionViewのデータ ソース。

SetSharedObservers(NSObject, NSKeyValueSharedObserversSnapshot)

UICollectionViewのデータ ソース。

適用対象

こちらもご覧ください