【发布时间】:2016-11-20 20:40:27
【问题描述】:
我想制作我想要制作登录屏幕的应用程序。它有一个名为“Log inn with Facebook”的按钮。我希望 Facebook 的字体大小大于登录方式。如何在主情节提要中设置它?谁能帮帮我?
【问题讨论】:
-
选择要增加字体的文本。并在属性检查器中更改字体大小
标签: ios uibutton storyboard facebook-sdk-4.0
我想制作我想要制作登录屏幕的应用程序。它有一个名为“Log inn with Facebook”的按钮。我希望 Facebook 的字体大小大于登录方式。如何在主情节提要中设置它?谁能帮帮我?
【问题讨论】:
标签: ios uibutton storyboard facebook-sdk-4.0
一种解决方案是使用带有两个不同UILabel 的UIView 作为子视图(您的“登录方式”标签和您的“Facebook”标签)。
然后,在UIView 上方,您可以有一个UIButton,其背景为白色,alpha 等于 0.01,因此按钮可以触摸但不可见。
这个UIButton 将是您用户界面的功能部分。
【讨论】:
NSMutableAttributedString *titleText = [[NSMutableAttributedString alloc] initWithString:@"Login with Facebook"];
[yourbutton.titleLabel setFont:[UIFont boldSystemFontOfSize:14]];
// Set the font to bold from the beginning of the string to the ","
[titleText addAttributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:14] forKey:NSFontAttributeName] range:NSMakeRange(0, 10)];
// Set the attributed string as the buttons' title text
[yourbutton setAttributedTitle:titleText forState:UIControlStateNormal];
而不是创建 NSAttributedString 创建 NSMutableAttributedString 然后你可以像这样设置字符串。
【讨论】: