Pass variable value between class

In send header-file

@interface CVPulldownMenuViewController : UIViewController <uitableviewdelegate, uitableviewdatasource,=”” cvbasemenutreetableviewcelldelegate=””>

@property (nonatomic, strong) UITableView *treeTableView;

@property (nonatomic, strong) NSMutableArray *treeItems;

@property (nonatomic, strong) NSMutableArray *selectedTreeItems;

@property (nonatomic, strong) NSMutableArray *treeArray;

@property (nonatomic, strong) CVBaseMenuTreeItem *tmptreeItem;

@property (nonatomic, unsafe_unretained) id delegate;

@property (nonatomic, assign) BOOL *showExtensionButton;

in send m-file:

#import “CVBaseMenuTreeTableViewCell.h”

– (id)initWithMenuItems:(NSArray*)menuArray {

if (self = [super init]) {

_treeArray = [NSMutableArray array];

_tempPath=@”/”;

        _showExtensionButton=YES;

[self builtMenuTreeWithDataSource:menuArray];

}

return self;

}

In received header file:

@class CVBaseMenuTreeTableViewCell;

@class CVBaseMenuTreeItem;

@protocol CVBaseMenuTreeTableViewCellDelegate  <NSObject>

– (void)treeTableViewCell:(CVBaseMenuTreeTableViewCell *)cell didTapIconWithTreeItem:(CVBaseMenuTreeItem *)treeItem;

@end

@interface CVBaseMenuTreeTableViewCell : UITableViewCell

@property (nonatomic, strong) UIButton *iconButton;

@property (nonatomic, strong) UITextField *titleTextField;

@property (nonatomic, strong) UILabel *countLabel;

@property (nonatomic, strong) UIImageView *downArrowImage;

@property (nonatomic, assign) id <CVBaseMenuTreeTableViewCellDelegate> delegate;

@property (nonatomic, strong) CVBaseMenuTreeItem *treeItem;

@property(nonatomic, assign) BOOL *showExtensionButton;

– (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier showbutton:(BOOL *)show;

– (void)setLevel:(NSInteger)pixels;

@end

– (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier showbutton:(BOOL *)show{

self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];

_showExtensionButton=show;

if (self) {

// Initialization code

//backgroundImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@”copymove-cell-bg”]];

//[backgroundImageView setContentMode:UIViewContentModeTopRight];

//[self setBackgroundView:backgroundImageView];

//[self setSelectionStyle:UITableViewCellSelectionStyleNone];

        if (_showExtensionButton) {

iconButton = [UIButton buttonWithType:UIButtonTypeCustom];

[iconButton setFrame:CGRectMake(0, 20, 100, 180)];

[iconButton setAdjustsImageWhenHighlighted:NO];

[iconButton addTarget:self action:@selector(iconButtonAction:) forControlEvents:UIControlEventTouchUpInside];

}

[self.contentView addSubview:iconButton];

titleTextField = [[UITextField alloc] init];

[titleTextField setFont:KOFONT_FILES_TITLE];

[titleTextField setTextColor:KOCOLOR_FILES_TITLE];

[titleTextField setUserInteractionEnabled:NO];

[titleTextField setBackgroundColor:[UIColor clearColor]];

[titleTextField sizeToFit];

[titleTextField setFrame:CGRectMake(108, 10, titleTextField.frame.size.width, titleTextField.frame.size.height)];

//        [titleTextField addTarget:self action:@selector(titleTextFieldfilterAction:) forControlEvents:UIControlEventTouchUpInside];

[self.contentView addSubview:titleTextField];

[self.layer setMasksToBounds:YES];

downArrowImage = [[UIImageView alloc] initWithFrame:CGRectMake(686, 38, 25, 20)];

[self setAccessoryView:downArrowImage];

[self.accessoryView setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin|UIViewAutoresizingFlexibleBottomMargin];

}

return self;

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s