ボーダーのオブジェクトを変更できることを知っています
item.layer.cornerRadius = floatValue;
item.layer.borderWidth = intValue;
item.layer.borderColor = colorValue;
しかし、どうすれば上、左、右の境界線だけを変更できますか?
アドバイスありがとうございます。
直接はできないと思います。
この質問には、問題を解決するオープン ソース コードへのリンクなど、役立つ回答がいくつかあります。
別のレイヤーを使用して、見たくないコーナーをマスクすることができます. これには、次のような欠点があります。
それでよろしければ、ここにサンプル コードを示します。
CGFloat borderWidth = 4.0;
[[myView layer] setBorderWidth:borderWidth];
CALayer *mask = [CALayer layer];
// The mask needs to be filled to mask
[mask setBackgroundColor:[[UIColor blackColor] CGColor]];
// Make the masks frame smaller in height
CGRect maskFrame = CGRectInset([myView bounds], 0, borderWidth);
// Move the maskFrame to the top
maskFrame.origin.y = 0;
[mask setFrame:maskFrame];
[[myView layer] setMask:mask];