デリゲートの厄介なのは元クラスのリファレンスにはメソッドの一覧がなく、デリゲートのリファレンスを開かないとわからないことです。加えて画面遷移・表示にかかわるオブジェクトの多くにデリゲートがあるため、行いたいことによって元オブジェクトが変わってきます。そこで、画面遷移・表示にかかわるオブジェクトをまとめてみました。
- UINavigationControllerDelegate
- UINavigationBarDelegate
- UIScrollViewDelegate
- UITableViewDelegate
- UITabBarDelegate
- UIWebViewDelegate
- UITextViewDelegate
UITextFieldを使う場合は編集、キーボード操作のためにそのデリゲートが加わります。
デリゲートではありませんが、プログラムでインスタンスを作る、あるいはサブクラスを作りカスタマイズすることがあるクラスです。
全部を網羅していませんが、主だったメソッドが呼ばれる順序です。
UIViewController +initialize (クラスイニシャライザー)
UIWebView -initWithCoder (Stroryboardからインスタンスを作成した場合)
UIViewContoller -loadView
UIViewContoller -viewDidLoad
UIWebView -loadData
UIViewContoller -viewWillAppear
UIViewContoller -shouldAutorotateToInterfaceOrientation
UIViewContoller -viewWillLayoutSubviews
UIViewContoller -viewDidLayoutSubviews
UIViewContoller -viewDidAppear
UIWebView -webViewDidFinishLoad
UIViewContoller -viewWillLayoutSubviews
UIViewContoller -viewDidLayoutSubviews
・ DOT.NETのデリゲートとの比較を追加しました。
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
API一覧(depricatedされているものは省いてあります)
△UINavigationControllerDelegate
Customizing Behavior
– navigationController:willShowViewController:animated:
– navigationController:didShowViewController:animated:
– navigationController:willShowViewController:animated:
– navigationController:didShowViewController:animated:
△ UINavigationBarDelegate
Pushing Items
– navigationBar:shouldPushItem:
– navigationBar:didPushItem:
Popping Items
– navigationBar:shouldPopItem:
– navigationBar:didPopItem:
– navigationBar:shouldPushItem:
– navigationBar:didPushItem:
Popping Items
– navigationBar:shouldPopItem:
– navigationBar:didPopItem:
△ UIScrollViewDelegate
Responding to Scrolling and Dragging
– scrollViewDidScroll:
– scrollViewWillBeginDragging:
– scrollViewWillEndDragging:withVelocity:targetContentOffset:
– scrollViewDidEndDragging:willDecelerate:
– scrollViewShouldScrollToTop:
– scrollViewDidScrollToTop:
– scrollViewWillBeginDecelerating:
– scrollViewDidEndDecelerating:
Managing Zooming
– viewForZoomingInScrollView:
– scrollViewWillBeginZooming:withView:
– scrollViewDidEndZooming:withView:atScale:
– scrollViewDidZoom:
Responding to Scrolling Animations
– scrollViewDidEndScrollingAnimation:
– scrollViewDidScroll:
– scrollViewWillBeginDragging:
– scrollViewWillEndDragging:withVelocity:targetContentOffset:
– scrollViewDidEndDragging:willDecelerate:
– scrollViewShouldScrollToTop:
– scrollViewDidScrollToTop:
– scrollViewWillBeginDecelerating:
– scrollViewDidEndDecelerating:
Managing Zooming
– viewForZoomingInScrollView:
– scrollViewWillBeginZooming:withView:
– scrollViewDidEndZooming:withView:atScale:
– scrollViewDidZoom:
Responding to Scrolling Animations
– scrollViewDidEndScrollingAnimation:
△ UITableViewDelegate
Configuring Rows for the Table View
– tableView:heightForRowAtIndexPath:
– tableView:indentationLevelForRowAtIndexPath:
– tableView:willDisplayCell:forRowAtIndexPath:
Managing Accessory Views
– tableView:accessoryButtonTappedForRowWithIndexPath:
Managing Selections
– tableView:willSelectRowAtIndexPath:
– tableView:didSelectRowAtIndexPath:
– tableView:willDeselectRowAtIndexPath:
– tableView:didDeselectRowAtIndexPath:
Modifying the Header and Footer of Sections
– tableView:viewForHeaderInSection:
– tableView:viewForFooterInSection:
– tableView:heightForHeaderInSection:
– tableView:heightForFooterInSection:
Editing Table Rows
– tableView:willBeginEditingRowAtIndexPath:
– tableView:didEndEditingRowAtIndexPath:
– tableView:editingStyleForRowAtIndexPath:
– tableView:titleForDeleteConfirmationButtonForRowAtIndexPath:
– tableView:shouldIndentWhileEditingRowAtIndexPath:
Reordering Table Rows
– tableView:targetIndexPathForMoveFromRowAtIndexPath:toProposedIndexPath:
Copying and Pasting Row Content
– tableView:shouldShowMenuForRowAtIndexPath:
– tableView:canPerformAction:forRowAtIndexPath:withSender:
– tableView:performAction:forRowAtIndexPath:withSender:
– tableView:heightForRowAtIndexPath:
– tableView:indentationLevelForRowAtIndexPath:
– tableView:willDisplayCell:forRowAtIndexPath:
Managing Accessory Views
– tableView:accessoryButtonTappedForRowWithIndexPath:
Managing Selections
– tableView:willSelectRowAtIndexPath:
– tableView:didSelectRowAtIndexPath:
– tableView:willDeselectRowAtIndexPath:
– tableView:didDeselectRowAtIndexPath:
Modifying the Header and Footer of Sections
– tableView:viewForHeaderInSection:
– tableView:viewForFooterInSection:
– tableView:heightForHeaderInSection:
– tableView:heightForFooterInSection:
Editing Table Rows
– tableView:willBeginEditingRowAtIndexPath:
– tableView:didEndEditingRowAtIndexPath:
– tableView:editingStyleForRowAtIndexPath:
– tableView:titleForDeleteConfirmationButtonForRowAtIndexPath:
– tableView:shouldIndentWhileEditingRowAtIndexPath:
Reordering Table Rows
– tableView:targetIndexPathForMoveFromRowAtIndexPath:toProposedIndexPath:
Copying and Pasting Row Content
– tableView:shouldShowMenuForRowAtIndexPath:
– tableView:canPerformAction:forRowAtIndexPath:withSender:
– tableView:performAction:forRowAtIndexPath:withSender:
△ UITabBarDelegate
Customizing Tab Bars
– tabBar:willBeginCustomizingItems:
– tabBar:didBeginCustomizingItems:
– tabBar:willEndCustomizingItems:changed:
– tabBar:didEndCustomizingItems:changed:
– tabBar:didSelectItem: required method;
– tabBar:willBeginCustomizingItems:
– tabBar:didBeginCustomizingItems:
– tabBar:willEndCustomizingItems:changed:
– tabBar:didEndCustomizingItems:changed:
– tabBar:didSelectItem: required method;
△ UIWebViewDelegate
Loading Content
– webView:shouldStartLoadWithRequest:navigationType:
– webViewDidStartLoad:
– webViewDidFinishLoad:
– webView:didFailLoadWithError:
– webView:shouldStartLoadWithRequest:navigationType:
– webViewDidStartLoad:
– webViewDidFinishLoad:
– webView:didFailLoadWithError:
△ UIActionSheetDelegate
UIActionSheetDelegate
Responding to Actions
– actionSheet:clickedButtonAtIndex:
Customizing Behavior
– willPresentActionSheet:
– didPresentActionSheet:
– actionSheet:willDismissWithButtonIndex:
– actionSheet:didDismissWithButtonIndex:
Canceling
– actionSheetCancel:
△ UITextFieldDelegate
Managing Editing
– textFieldShouldBeginEditing:
– textFieldDidBeginEditing:
– textFieldShouldEndEditing:
– textFieldDidEndEditing:
Editing the Text Field’s Text
– textField:shouldChangeCharactersInRange:replacementString:
– textFieldShouldClear:
– textFieldShouldReturn:
– textFieldShouldBeginEditing:
– textFieldDidBeginEditing:
– textFieldShouldEndEditing:
– textFieldDidEndEditing:
Editing the Text Field’s Text
– textField:shouldChangeCharactersInRange:replacementString:
– textFieldShouldClear:
– textFieldShouldReturn:
△ UINavigationItem
Initializing an Item
– initWithTitle:
Getting and Setting Properties
title property
prompt property
backBarButtonItem property
hidesBackButton property
– setHidesBackButton:animated:
leftItemsSupplementBackButton property
Customizing Views
titleView property
leftBarButtonItems property
leftBarButtonItem property
rightBarButtonItems property
rightBarButtonItem property
– setLeftBarButtonItems:animated:
– setLeftBarButtonItem:animated:
– setRightBarButtonItems:animated:
– setRightBarButtonItem:animated:
– initWithTitle:
Getting and Setting Properties
title property
prompt property
backBarButtonItem property
hidesBackButton property
– setHidesBackButton:animated:
leftItemsSupplementBackButton property
Customizing Views
titleView property
leftBarButtonItems property
leftBarButtonItem property
rightBarButtonItems property
rightBarButtonItem property
– setLeftBarButtonItems:animated:
– setLeftBarButtonItem:animated:
– setRightBarButtonItems:animated:
– setRightBarButtonItem:animated:
△ UIBarButtonItem
Initializing an Item
– initWithBarButtonSystemItem:target:action:
– initWithCustomView:
– initWithImage:style:target:action:
– initWithTitle:style:target:action:
– initWithImage:landscapeImagePhone:style:target:action:
Getting and Setting Properties
target property
action property
style property
possibleTitles property
width property
customView property
Customizing Appearance
tintColor property
– backButtonBackgroundImageForState:barMetrics:
– setBackButtonBackgroundImage:forState:barMetrics:
– backButtonTitlePositionAdjustmentForBarMetrics:
– setBackButtonTitlePositionAdjustment:forBarMetrics:
– backButtonBackgroundVerticalPositionAdjustmentForBarMetrics:
– setBackButtonBackgroundVerticalPositionAdjustment:forBarMetrics:
– backgroundVerticalPositionAdjustmentForBarMetrics:
– setBackgroundVerticalPositionAdjustment:forBarMetrics:
– backgroundImageForState:barMetrics:
– setBackgroundImage:forState:barMetrics:
– titlePositionAdjustmentForBarMetrics:
– setTitlePositionAdjustment:forBarMetrics:
– initWithBarButtonSystemItem:target:action:
– initWithCustomView:
– initWithImage:style:target:action:
– initWithTitle:style:target:action:
– initWithImage:landscapeImagePhone:style:target:action:
Getting and Setting Properties
target property
action property
style property
possibleTitles property
width property
customView property
Customizing Appearance
tintColor property
– backButtonBackgroundImageForState:barMetrics:
– setBackButtonBackgroundImage:forState:barMetrics:
– backButtonTitlePositionAdjustmentForBarMetrics:
– setBackButtonTitlePositionAdjustment:forBarMetrics:
– backButtonBackgroundVerticalPositionAdjustmentForBarMetrics:
– setBackButtonBackgroundVerticalPositionAdjustment:forBarMetrics:
– backgroundVerticalPositionAdjustmentForBarMetrics:
– setBackgroundVerticalPositionAdjustment:forBarMetrics:
– backgroundImageForState:barMetrics:
– setBackgroundImage:forState:barMetrics:
– titlePositionAdjustmentForBarMetrics:
– setTitlePositionAdjustment:forBarMetrics:
Initializing a UITableViewCell Object
– initWithStyle:reuseIdentifier:
Reusing Cells
reuseIdentifier property
– prepareForReuse
Managing Text as Cell Content
textLabel property
detailTextLabel property
Managing Images as Cell Content
imageView property
Accessing Views of the Cell Object
contentView property
backgroundView property
selectedBackgroundView property
multipleSelectionBackgroundView property
Managing Accessory Views
accessoryType property
accessoryView property
editingAccessoryType property
editingAccessoryView property
Managing Cell Selection and Highlighting
selected property
selectionStyle property
– setSelected:animated:
highlighted property
– setHighlighted:animated:
Editing the Cell
editing property
– setEditing:animated:
editingStyle property
showingDeleteConfirmation property
showsReorderControl property
Adjusting to State Transitions
– willTransitionToState:
– didTransitionToState:
Managing Content Indentation
indentationLevel property
indentationWidth property
– initWithStyle:reuseIdentifier:
Reusing Cells
reuseIdentifier property
– prepareForReuse
Managing Text as Cell Content
textLabel property
detailTextLabel property
Managing Images as Cell Content
imageView property
Accessing Views of the Cell Object
contentView property
backgroundView property
selectedBackgroundView property
multipleSelectionBackgroundView property
Managing Accessory Views
accessoryType property
accessoryView property
editingAccessoryType property
editingAccessoryView property
Managing Cell Selection and Highlighting
selected property
selectionStyle property
– setSelected:animated:
highlighted property
– setHighlighted:animated:
Editing the Cell
editing property
– setEditing:animated:
editingStyle property
showingDeleteConfirmation property
showsReorderControl property
Adjusting to State Transitions
– willTransitionToState:
– didTransitionToState:
Managing Content Indentation
indentationLevel property
indentationWidth property
shouldIndentWhileEditing
property
UITextViewDelegate
Responding to Editing Notifications
– textViewShouldBeginEditing:
– textViewDidBeginEditing:
– textViewShouldEndEditing:
– textViewDidEndEditing:
Responding to Text Change
– textView:shouldChangeTextInRange:replacementText:
– textViewDidChange:
Responding to Selection Change
– textViewDidChangeSelection:
0 件のコメント:
コメントを投稿