FBGraphObjectPickerViewController.h 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /*
  2. * Copyright 2010-present Facebook.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import "FBGraphObject.h"
  17. #import "FBSession.h"
  18. #import "FBViewController.h"
  19. @protocol FBGraphObjectPickerDelegate;
  20. /*!
  21. @class FBGraphObjectPickerViewController
  22. @abstract
  23. The `FBGraphObjectPickerViewController` class is an abstract controller object that
  24. manages the user interface for displaying and selecting a collection of graph objects.
  25. @discussion
  26. When the `FBGraphObjectPickerViewController` view loads it creates a `UITableView`
  27. object where the graph objects defined by a concrete subclass will be displayed. You
  28. can access this view through the `tableView` property.
  29. The `delegate` property may be set to an object that conforms to the <FBGraphObjectPickerDelegate>
  30. protocol. The `delegate` object will receive updates related to object selection and
  31. data changes. The delegate can also be used to filter the objects to display in the
  32. picker.
  33. */
  34. @interface FBGraphObjectPickerViewController : FBViewController
  35. /*!
  36. @abstract
  37. Returns an outlet for the spinner used in the view controller.
  38. */
  39. @property (nonatomic, retain) IBOutlet UIActivityIndicatorView *spinner;
  40. /*!
  41. @abstract
  42. Returns an outlet for the table view managed by the view controller.
  43. */
  44. @property (nonatomic, retain) IBOutlet UITableView *tableView;
  45. /*!
  46. @abstract
  47. Addtional fields to fetch when making the Graph API call to get graph object data.
  48. */
  49. @property (nonatomic, copy) NSSet *fieldsForRequest;
  50. /*!
  51. @abstract
  52. A Boolean value that indicates whether pictures representing the graph object are displayed.
  53. Defaults to YES.
  54. */
  55. @property (nonatomic) BOOL itemPicturesEnabled;
  56. /*!
  57. @abstract
  58. The session that is used in the request for the graph object data.
  59. */
  60. @property (nonatomic, retain) FBSession *session;
  61. /*!
  62. @abstract
  63. Clears the current selection, so the picker is ready for a fresh use.
  64. */
  65. - (void)clearSelection;
  66. /*!
  67. @abstract
  68. Initiates a query to get the graph object data.
  69. @discussion
  70. A cached copy will be returned if available. The cached view is temporary until a fresh copy is
  71. retrieved from the server. It is legal to call this more than once.
  72. */
  73. - (void)loadData;
  74. /*!
  75. @abstract
  76. Updates the view locally without fetching data from the server or from cache.
  77. @discussion
  78. Use this if the filter or sort (if applicable) properties change. This may affect the
  79. order or display of information.
  80. */
  81. - (void)updateView;
  82. @end
  83. /*!
  84. @protocol
  85. @abstract
  86. The `FBGraphObjectPickerDelegate` protocol defines the methods used to receive event
  87. notifications and allow for deeper control of the <FBGraphObjectPickerViewController>
  88. view.
  89. */
  90. @protocol FBGraphObjectPickerDelegate <FBViewControllerDelegate>
  91. @optional
  92. /*!
  93. @abstract
  94. Tells the delegate that data has been loaded.
  95. @discussion
  96. The <FBGraphObjectPickerViewController> object's `tableView` property is automatically
  97. reloaded when this happens. However, if another table view, for example the
  98. `UISearchBar` is showing data, then it may also need to be reloaded.
  99. @param graphObjectPicker The graph object picker view controller whose data changed.
  100. */
  101. - (void)graphObjectPickerViewControllerDataDidChange:(FBGraphObjectPickerViewController *)graphObjectPicker;
  102. /*!
  103. @abstract
  104. Tells the delegate that the selection has changed.
  105. @param graphObjectPicker The graph object picker view controller whose selection changed.
  106. */
  107. - (void)graphObjectPickerViewControllerSelectionDidChange:(FBGraphObjectPickerViewController *)graphObjectPicker;
  108. /*!
  109. @abstract
  110. Asks the delegate whether to include a graph object in the list.
  111. @discussion
  112. This can be used to implement a search bar that filters the graph object list.
  113. @param graphObjectPicker The graph object picker view controller that is requesting this information.
  114. @param object An <FBGraphObject> object
  115. */
  116. - (BOOL)graphObjectPickerViewController:(FBGraphObjectPickerViewController *)graphObjectPicker
  117. shouldIncludeGraphObject:(id<FBGraphObject>)object;
  118. /*!
  119. @abstract
  120. Called if there is a communication error.
  121. @param graphObjectPicker The graph object picker view controller that encountered the error.
  122. @param error An error object containing details of the error.
  123. */
  124. - (void)graphObjectPickerViewController:(FBGraphObjectPickerViewController *)graphObjectPicker
  125. handleError:(NSError *)error;
  126. @end