我想将计数的 int 值从我的主控制器设置为数据单元控制器文件。我现在不想调用那个数据单元控制器文件我想稍后调用那个数据单元 M 控制器文件,但是我想从我的主控制器文件中设置计数整数,这样当我调用我的数据单元文件时它需要计数整数我从我的主控制器设置并使用它。
我的 dataViewController.m
- (void)viewDidLoad {
[super viewDidLoad];
UIView *backgroundCoverView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 1024, 768)];
backgroundCoverView.backgroundColor = [UIColor colorWithWhite:0.0 alpha:0.6];
toggleSwitch1 = [UIButton buttonWithType:UIButtonTypeCustom];
toggleSwitch2 = [UIButton buttonWithType:UIButtonTypeCustom];
[self.view addSubview:backgroundCoverView];
// Add the 6 buttons and columns.
NSMutableArray *columnsMutable = [NSMutableArray arrayWithCapacity:6];
NSMutableArray *buttonsMutable = [NSMutableArray arrayWithCapacity:6];
for (int i=0; i<6; i++) {
DataCell* app = (DataCell*)[[UIApplication sharedApplication] delegate];
[app MysetValue:6];
DataColumn *column = [[DataColumn alloc] initWithFrame:CGRectMake(86+i*124+(i>=3?100:0), 230, 110, 382)];
column.cellsVisible = NO;
if (i>0) {
column.hidden = YES;
}
[self.view addSubview:column];
[columnsMutable addObject:column];
//我正在调用dataColumn,它是SubView类,从那个dataColumn子视图类我调用数据单元类将单元格填充到列中
- (id)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
//self.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"mixBackgroundTile.png"]];
// this commented line is used to display dotted background in percentage slider bar
// Add cells.
NSMutableArray *mutableCells = [NSMutableArray arrayWithCapacity:5];
for (int i=4; i>=0; i--) {
DataCell *cell = [[DataCell alloc] initWithFrame:CGRectMake(100, i*(74+3), 109, 74)]; // data order fix
//VSLDataCell *cell = [[VSLDataCell alloc] initWithFrame:CGRectMake(-90, i*(74+3), 109, 74)]; for left hand side cell
[mutableCells addObject:cell];
[self addSubview:cell];
}
cells = [NSArray arrayWithArray:mutableCells];
}
return self;
}
现在在数据单元类中,我想根据单元格号和列号分配不同的图像,所以我想知道我现在是哪一列