円形の画像にアーチ型の を作成する必要がありUIButtons
ます (O/p は同心円のように見える必要があります)。
現在、私は 5 つの画像を使用していますが、将来的にはさらに画像を追加する可能性があります。追加した画像で円の画像を動的に塗りつぶす必要があります。
サンプルのコードがあり、O/P は下の画像です
int numberOfSections = 6;
CGFloat angleSize = 2*M_PI/numberOfSections;
for (int j = 0; j < numberOfSections; ++j) {
UIButton *sectionLabel = [[UIButton alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 150.0f, 2.0f)];
sectionLabel.backgroundColor = [UIColor redColor];
sectionLabel.layer.anchorPoint = CGPointMake(1.0f, 0.5f);
sectionLabel.layer.position = CGPointMake(container.bounds.size.width/2.0, container.bounds.size.height/2.0); // places anchorPoint of each label directly in the center of the circle.
sectionLabel.transform = CGAffineTransformMakeRotation(angleSize*j);
[container addSubview:sectionLabel];
}
このコードを試してみましたが、O/P は下の画像です
int numberOfSections = 5;
CGFloat angleSize = 2*M_PI/numberOfSections;
for (int j = 0; j<numberOfSections; ++j) {
UIImage *imageframe = [imagesArray objectAtIndex:j];
OBShapedButton *button = [[OBShapedButton alloc] initWithFrame:CGRectMake(0.0f, 150.0f, 150.0f, 128.0f)];
button.transform = CGAffineTransformMakeRotation(angleSize*j);
[container addSubview:button];
}
下の画像のような出力が必要です
どうすればそれを達成できますか
サラ・ズオのコードで試した後のO/P
同じ幅と高さ
のボタン