私が直面した同じ問題。直接私はそれを行うことができないので、以下のようにいくつかのトリッキーなロジックを使用して私のために働きました. ヒントを与えるだけです。このロジックが役立つことを願っています。
drawRect メソッドを使用して下線を引いたボタンがあるので、一部の一致ケースではそれを削除する必要があるため、次のようにします。
注: "isRemoveUnderLine" は、カスタム ボタン クラスの Bool プロパティです。
if ([array count] == 2) {
myButton.isRemoveUnderLine = YES;
[myButton setNeedsDisplay]; //it will update your button context and call drawRect method again...
}
// drawRect メソッドのコードは次のとおりです。
- (void)drawRect:(CGRect)rect {
[super drawRect:rect];
CGContextRef context = UIGraphicsGetCurrentContext();
if(_isRemoveUnderLine)
CGContextSetStrokeColorWithColor(context, [UIColor clearColor].CGColor);
else
CGContextSetStrokeColorWithColor(context, self.currentTitleColor.CGColor);
...
...
}
ロジックを修正するためのヒントが得られることを願っています!!!