.h 文件
/*
* Copyright (c) 2013年 北京欧乐吧技术有限公司. All rights reserved.
* LandTipItem.h
* GNThumb4IPhone
* Created by crossmo/fulijun on 2013-1-29.
*/
#import <Foundation/Foundation.h>
@interface LandTipItem : NSObject
//common
@property (nonatomic,assign) NSInteger catid; //id
@property (nonatomic,copy) NSString* key; //key
@property (nonatomic,copy) NSString* name; //name
@property (nonatomic,copy) NSString* desc; //decription
@property (nonatomic,assign) NSInteger order; //order
@property (nonatomic,copy) NSString* icon; //icon ,normal
@property (nonatomic,copy) NSString* icon_t; //icon, touch
@property (nonatomic,copy) NSString* icon_s; //icon,selected
@property (nonatomic,assign) NSInteger tiptype; //tip type
@property (nonatomic,assign) NSInteger tipcount; //tip count
//only for show in view
@property (nonatomic,assign) BOOL modify; //can be modifed
@property (nonatomic,assign) BOOL selected; //select state
/**
*reference:sort by order
*parameters:inObject(LandTipItem instance)
*return:NSOrderedAscending = -1L, NSOrderedSame, NSOrderedDescending
*/
- (NSComparisonResult)compareByOrder:(id)inObject;
@end
.m文件
/*
* Copyright (c) 2013年 北京欧乐吧技术有限公司. All rights reserved.
* LandTipItem.m
* GNThumb4IPhone
* Created by crossmo/fulijun on 2013-1-29.
*/
#import "LandTipItem.h"
@implementation LandTipItem
@synthesize catid;
@synthesize key;
@synthesize name;
@synthesize desc;
@synthesize order;
@synthesize icon;
@synthesize icon_t;
@synthesize icon_s;
@synthesize modify;
@synthesize selected;
@synthesize tiptype;
@synthesize tipcount;
- (void)dealloc
{
[key release];
[name release];
[desc release];
[icon release];
[icon_t release];
[icon_s release];
[super dealloc];
}
/**
*reference:sort by order
*parameters:inObject(LandTipItem instance)
*return:NSOrderedAscending = -1L, NSOrderedSame, NSOrderedDescending
*/
- (NSComparisonResult)compareByOrder:(id)inObject
{
LandTipItem* temp = (LandTipItem*)inObject;
if (temp.order <= self.order) {
return NSOrderedDescending;
}else{
return NSOrderedAscending;
}
}
@end