[英]FBLoginView button with sharp corners
I'm using FBLoginView in an IOS app. 我在IOS应用中使用FBLoginView。
Can I change the button of FBLoginView to have sharp instead of round corners? 我可以将FBLoginView的按钮更改为具有尖角而不是圆角吗?
我认为您可以尝试遵循以下代码( 快速3 )以使拐角看起来更尖锐( 请参见结果 )。
loginButton.backgroundColor = UIColor(red:0.25, green:0.36, blue:0.68, alpha:1.0)
You'd have to use a custom button for that, you get FBLoginView
from a third party library, and would have to work within the constraints set by the third party library. 您必须为此使用自定义按钮,才能从第三方库获取
FBLoginView
,并且必须在第三方库设置的约束内工作。
Nevertheless, in case FBLoginView
uses a layer's cornerRadius
to round itself internally, you could inspect the view hierarchy and set the corner radius of the offending view to 0.0
to get sharp edges. 但是,如果
FBLoginView
使用图层的cornerRadius
在内部进行自身圆化,则可以检查视图层次结构,并将有问题的视图的拐角半径设置为0.0
以获得清晰的边缘。
Apparently, the corners in FBLoginView are from the background image of the button, so although this is a hack - changing it solves the problem: 显然,FBLoginView中的角来自按钮的背景图像,因此,尽管这是一个技巧,但更改它可以解决问题:
FBLoginView *loginView = [[FBLoginView alloc] init];
loginView.frame = CGRectMake(21, 108, 279, 37);
for (UIView *subview in loginView.subviews)
{
if ([subview isKindOfClass:[UIButton class]])
{
UIButton *FBButton = (UIButton *)subview;
[FBButton setBackgroundImage:[UIImage imageNamed:@"blue_rect.png"] forState:UIControlStateNormal];
}
}
loginView.delegate = self;
[self.view addSubview:loginView];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.