FBProfilePictureView.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 <UIKit/UIKit.h>
  17. /*!
  18. @typedef FBProfilePictureCropping enum
  19. @abstract
  20. Type used to specify the cropping treatment of the profile picture.
  21. @discussion
  22. */
  23. typedef NS_ENUM(NSUInteger, FBProfilePictureCropping) {
  24. /*! Square (default) - the square version that the Facebook user defined. */
  25. FBProfilePictureCroppingSquare = 0,
  26. /*! Original - the original profile picture, as uploaded. */
  27. FBProfilePictureCroppingOriginal = 1
  28. };
  29. /*!
  30. @class
  31. @abstract
  32. An instance of `FBProfilePictureView` is used to display a profile picture.
  33. The default behavior of this control is to center the profile picture
  34. in the view and shrinks it, if necessary, to the view's bounds, preserving the aspect ratio. The smallest
  35. possible image is downloaded to ensure that scaling up never happens. Resizing the view may result in
  36. a different size of the image being loaded. Canonical image sizes are documented in the "Pictures" section
  37. of https://developers.facebook.com/docs/reference/api.
  38. */
  39. @interface FBProfilePictureView : UIView
  40. /*!
  41. @abstract
  42. The Facebook ID of the user, place or object for which a picture should be fetched and displayed.
  43. */
  44. @property (copy, nonatomic) NSString *profileID;
  45. /*!
  46. @abstract
  47. The cropping to use for the profile picture.
  48. */
  49. @property (nonatomic) FBProfilePictureCropping pictureCropping;
  50. /*!
  51. @abstract
  52. Initializes and returns a profile view object.
  53. */
  54. - (instancetype)init;
  55. /*!
  56. @abstract
  57. Initializes and returns a profile view object for the given Facebook ID and cropping.
  58. @param profileID The Facebook ID of the user, place or object for which a picture should be fetched and displayed.
  59. @param pictureCropping The cropping to use for the profile picture.
  60. */
  61. - (instancetype)initWithProfileID:(NSString *)profileID
  62. pictureCropping:(FBProfilePictureCropping)pictureCropping;
  63. @end