メインコントローラーからデータセルコントローラーファイルにcountの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];
// SubViewクラスであるdataColumnを呼び出しており、その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;
}
データセルクラスで、セル番号と列番号に応じて異なる画像を割り当てたいので、現在どの列にいるのかを知りたい