こんにちは、私のアプリケーションの 1 つで、要件が 1 つあります。要件は、実際には 1 つのクラスに 1 つのボタンがあり、その 1 つのテーブルと 1 つのラベルをクリックすると、別のクラス ビューに追加する必要があることです。実際に私はsplitViewcontrollerを使用しています。ここで私が直面しているのは、あるクラスで使用可能なボタンをクリックした場合です。テーブルとラベルが別のクラスに追加されていません。実際には、これらのコンポーネントをプログラムで作成しています。このタイプの状況を処理する方法を教えてください。
ご参考までに:
クラス 1 :
-(void)pressAddButton
{
Class2*classObject=[[Class2 alloc]init];
[customObject addComponents];
}
Class2 で:
-(void)addComponents
{
Label1 = [[UILabel alloc]initWithFrame:CGRectMake(630, 460, 300, 25)];
[Label1 setFont:[UIFont systemFontOfSize:18.0f]];
[Label1 setFont:[UIFont boldSystemFontOfSize:20.0f]];
[Label1 setTextColor:[UIColor whiteColor]];
[Label1 setBackgroundColor:[UIColor clearColor]];
[Label1 setText:@"+ Add-Ons For Consideration"];
[self.view addSubview:Label1];
Table = [[UITableView alloc]initWithFrame:CGRectMake(620, 530, 500, 90)style:UITableViewStylePlain];
Table.delegate=self;
Table.dataSource=self;
[Table setBackgroundColor:[UIColor clearColor]];
[self.view addSubview:Table];
Label2 = [[UILabel alloc]initWithFrame:CGRectMake(635, 660, 60, 25)];
[Label2 setText:@"Total"];
[Label2 setBackgroundColor:[UIColor clearColor]];
Label2.font = [UIFont systemFontOfSize:22];
[Label2 setFont:[UIFont boldSystemFontOfSize:22]];
[Label2 setTextColor:[UIColor whiteColor]];
[self.view addSubview:Label2];
}