A customizable library for displaying a collection of content controllers and customizable accessory views associated with a profile interface. It was designed to address two use cases simultaneously:
- Provide good looking, high quality implementations of familiar profile experiences out of the box. By default a
DBProfileViewController
is styled to look much like a Twitter profile. - Enable quick and easy customization of the user experience via layout attributes which change the appearance and behaviour of the accessory views.
The recommended path for installation is CocoaPods. CocoaPods provides a simple, versioned dependency management system that automates the tedious and error prone aspects of manually configuring libraries and frameworks. You can add DBProfileViewController to your project via CocoaPods by doing the following:
$ sudo gem install cocoapods
$ pod setup
Now create a Podfile
in the root of your project directory and add the following:
pod 'DBProfileViewController'
Complete the installation by executing:
$ pod install
These instructions will setup your local CocoaPods environment and import DBProfileViewController into your project.
- Subclass - Subclass DBProfileViewController
- Implement - The controller declares delegate and data source protocols. Your subclasses must implement these protocols.
- Customize - The controller uses layout attributes to allow for effortless customization of accessory views.
View controllers that you wish too use as content controllers of a DBProfileViewController
must conform to the DBProfileContentPresenting
protocol.
There are 2 types of supported accessory views: DBProfileAccessoryKindAvatar
and DBProfileAccessoryKindHeader
. You must register the class you would like to use for a specfied accessory kind. For covenience, the library includes DBProfileAvatarView
and DBProfileCoverPhotoView
which provide sample implementations for an avatar view and header view, respectively.
[self registerClass:[DBProfileAvatarView class] forAccessoryViewOfKind:DBProfileAccessoryKindAvatar];
[self registerClass:[DBProfileCoverPhotoView class] forAccessoryViewOfKind:DBProfileAccessoryKindHeader];
To customize the appearance and behaviour of accessory views you can change the associated layout attributes for the accessory view. The DBProfileAccessoryViewLayoutAttributes
object manages the layout-related attributes for an accessory view in a profile view controller.
DBProfileHeaderViewLayoutAttributes *layoutAttributes = [self layoutAttributesForAccessoryViewOfKind:DBProfileAccessoryKindHeader];
layoutAttributes.headerStyle = DBProfileHeaderStyleNavigation;
layoutAttributes.headerOptions = DBProfileHeaderOptionStretch;
DBProfileViewController is available under the MIT license. See the LICENSE file for more info.