Database Reference
In-Depth Information
Next we need to change our entry property type from
NSString
to
CTEntry
.
@property (assign) CTEntry *entry;
The last thing we need to do is change our
configureCellForEntry:withDelegate
method to
first take a
CTEntry
as the first parameter instead of
NSString
. We also want to change the
implementation to reflect the use of the
CTEntry
object.
-(void)configureCellForEntry:(CTEntry *)entry withDelegate:(id<EntryCollectionViewCellDelegate>)
delegate {
if(entry == nil)
return;
_entry = entry;
_delegate = delegate;
if([[_entry metadata] thumbnail])
_imgPhoto.image = [[_entry metadata] thumbnail];
else
_imgPhoto.image = [UIImage imageNamed:@"ImgCellNoImage"];
_lblDisplayName.text = [[_entry metadata] displayName];
}
The main difference here is that we are peeking into the metadata object inside our entry object to
get the thumbnail and the display name.
We are almost done implementing our
CTDocument
. The last thing we need to do is modify
our
FriendDetailViewController
so that we can view and edit the document. Open up
FriendDetailViewController.h
and add the class declaration for
CTDocument
:
@class CTDocument;
Now let's add another property for a
CTDocument
:
@property (strong, nonatomic) CTDocument *document;
Moving over to
FriendDetailViewController.m
we need to add an import statement for
CTDocument.h
.
#import "CTDocument.h"
Next we need to modify
configureView
to now look like this:
- (void)configureView {
_txtFirstName.text = [_document firstName];
_txtLastName.text = [_document lastName];
_txtDisplayName.text = [_document displayName];
_txtFavoriteNumber.text = [[_document favoriteNumber] stringValue];
Search WWH ::
Custom Search