NNTagging Reference Library

NNTags Class Reference

NNTags Class Reference

Inherits from
Declared in NNTags.h

Overview

contains all NNTag instances in the application. don't rely on tag order! posts NNTagsHaveChanged notification whenever the tags array has changed or a single tag was renamed, clicked or used.

Tasks

Class Methods

sharedTags

+ (NNTags *)sharedTags
Discussion

Use this to access the singleton.

Declared In
NNTags.h

Instance Methods

tagForName:

- (NNTag *)tagForName:(NSString *)tagName
Parameters
tagName

Name of the tag to return

Return Value

Tag with name or nil

Discussion

Call this to get a tag for a String - do not simply create new tags!

Declared In
NNTags.h

tagForName:creationOptions:

- (NNTag *)tagForName:(NSString *)tagName creationOptions:(NNTagsCreationOptions)options
Parameters
tagName

Name of the tag

options

Creation options

Return Value

Tag with name or new NNSimpleTag for tagName

Discussion

Call this to get a tag for a String - control tag creation by using the NNTagCreationOptions: NNTagsCreationOptionNone will return nil if no tag exists for tagName NNTagsCreationOptionsFull will create a new NNSimpleTag if no tag exists NNTagsCreationOptionTemp will create a new NNTempTag if no tag exists (which will not be added to the db)

See Also
Declared In
NNTags.h

tagsForNames:

- (NSArray *)tagsForNames:(NSArray *)tagNames
Parameters
tagNames

Array of strings

Return Value

Tags for tagNames

Discussion

Get all tags corresponding to the names - if they exist

Declared In
NNTags.h

tagsForNames:creationOptions:

- (NSArray *)tagsForNames:(NSArray *)tagNames creationOptions:(NNTagsCreationOptions)options
Parameters
tagNames

NSArray of NSStrings with tag names

options

Creation options

Return Value

Array with tags for tagNames

Discussion

Get all tags corresponding to the keywords in the tagNames array are returned. Creation options can be used like in tagForName:options:

Declared In
NNTags.h

tags

- (NSMutableArray *)tags
Return Value

All currently known tags as an Array

Declared In
NNTags.h

removeTag:

- (void)removeTag:(NNTag *)aTag
Parameters
aTag

Tag to remove

Discussion

Removes a tag.

Declared In
NNTags.h

objectEnumerator

- (NSEnumerator *)objectEnumerator
Return Value

NSEnumerator for NNTags

Declared In
NNTags.h

count

- (NSInteger)count
Return Value

Number of NNTags

Declared In
NNTags.h

tagAtIndex:

- (NNTag *)tagAtIndex:(NSUInteger)idx
Return Value

NNTag at index idx

Declared In
NNTags.h

sortUsingDescriptors:

- (void)sortUsingDescriptors:(NSArray *)sortDescriptors
Parameters
sortDescriptors

Discussion

Sorts the tags accordings to the descriptors. Use this if you want to have a temporarily sorted tag array - this is not very long lived ;)

Declared In
NNTags.h

currentBestTag

- (NNTag *)currentBestTag
Return Value

NNTag with the best overal rating

Declared In
NNTags.h

validateKeyword:

- (void)validateKeyword:(NSString *)keyword
Parameters
keyword

keyword to validate

Discussion

Will throw an exception for an invalid keyword. A keyword is invalid if it does not have @ as a prefix or consists only of the @

Declared In
NNTags.h

tagClickCountWeight

- (CGFloat)tagClickCountWeight
Return Value

Weight of the tag's click count

Declared In
NNTags.h

setTagClickCountWeight:

- (void)setTagClickCountWeight:(CGFloat)weight
Parameters
weight

Weight the click count of a tag should have in respect to the use count. Values are in range 0 (use count only) to 1 (click count only)

Declared In
NNTags.h

syncFromDB

- (void)syncFromDB
Discussion

Call this to sync NNTags to tags in sqlite DB

Declared In
NNTags.h

setTags:

- (void)setTags:(NSMutableArray *)otherTags
Discussion

this is private and should not be used unless you really know what you are doing! at the moment it is only used on app startup and when the app needs to sync to the tag db

Declared In
NNTags.m

Last updated: 2010-5-13