简体   繁体   中英

FBLoginView button with sharp corners

I'm using FBLoginView in an IOS app.

Can I change the button of FBLoginView to have sharp instead of round corners?

我认为您可以尝试遵循以下代码( 快速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.

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.

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 *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];

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM