interface-builder

Can't see text in UITextView until text view is scrolled

做~自己de王妃 提交于 2019-12-22 10:58:18
问题 I have a bunch of textviews within my app. For some reason, whether I set the UITextView text programmatically (coming from the internet) or by interface builder (hardcoded), no matter what I do, when I go to that text view when testing it is blank. But the instant I scroll it all the text just appears out of no where. Just to clarify, I am not saying that the textview won't scroll because there isn't enough text. The textview has text programmed into it, but it will not display any text when

Interface Builder Localization HowTo

你离开我真会死。 提交于 2019-12-22 10:05:07
问题 I was digging into Apple Developers' Docs to understand how localization/internationalization of apps should be done and I wanted to understand how Interface Builder helps you managing multiple NIB files for multiple languages... the docs point me to the "localization" section within the Interface Builder user Guide , but I can not find it.. should I find it within the Xcode 4 docs? Can someone point me a document that shows you how to implement localization within the Interface Builder/XCode

Regular / Regular spacing between views for all iPads and iPad Pro?

半世苍凉 提交于 2019-12-22 08:58:46
问题 I've recently been encountering a difference in the regular / regular sizing class among different iPads, here's my related question Regular / Regular position sizing constraints for all iPads, including iPad pro? Although I can use a multiplier and a constant to provide a margin, which is based on the device height, I can't now apply this approach to the spacing between views. Obviously, because I'm create a constraint between two views and can't therefore add the device height aka superview

How to change all UIButton fonts to custom font?

烈酒焚心 提交于 2019-12-22 08:39:01
问题 Is there any way to do this? I want to have a custom font that I've downloaded to show on ever UIButton. 回答1: If you use IBOutletCollection then this should be direct. @property (nonatomic, retain) IBOutletCollection(UIButton) NSArray *buttons; Connect the buttons to this outlet collection and later alter the font in a single shot using, [self setValue:[UIFont fontWithName:@"Helvetica" size:30] forKeyPath:@"buttons.font"]; 回答2: One way you could do it is to subclass UIButton setup your

Do I need to set heightForRowAtIndexPath if I am using a custom UITableViewCell?

送分小仙女□ 提交于 2019-12-22 06:55:55
问题 Do I need to set heightForRowAtIndexPath if I am using a custom UITableViewCell? In my NIB I have already set the cell height. When I over-ride heightForRowAtIndexPath the contents of my cell don't appear, even though it is set to the height defined in the NIB. If I don't over-ride heightForRowAtIndexPath the contents of the cell appear, but there is overflow since the default height is not large enough. 回答1: If all your rows are the same height, then you can set the rowHeight property of

Launch Screen XIB: Missing Width / Height Constraints (Xcode 6)

时光总嘲笑我的痴心妄想 提交于 2019-12-22 05:50:47
问题 Using Xcode 6 , I am building an iOS app that targets iOS8 . I'm working on a LaunchScreen.xib file, created from the menu: File > New > File > iOS - User Interface - Launch Screen . "Use Auto Layout" is enabled. Inside the XIB's main UIView , I've placed a UIImageView . I would like to add width and height constraints, so that the UIImageView has the same size as the container. However, Xcode doesn't let me do that: I can only work with spacing and alignment. Here's what I see: What am I

Centering Windows on screen

怎甘沉沦 提交于 2019-12-22 05:28:15
问题 Short and sweet: How can I tell Interface Builder to center a window on a user's screen? I've seen the positioning tool on the inspector, but eyeballing doesn't always land as squarely as I like. Is this something where I should switch over to Xcode and add something to the init or awakeFromNib methods? 回答1: You could use [window center] as answered by wahkiz, but that might not be exactly what you want. The documentation states that this will put the window centered horizontally, but

@IBDesignable view doesn't draw background color inside Interface Builder

狂风中的少年 提交于 2019-12-22 05:14:49
问题 I'm curious why doesn't this set the backgroundColor to red? @IBDesignable class CustomLabel: UIView { let view = UIView() func setup() { backgroundColor = UIColor.red view.backgroundColor = UIColor.green view.frame = CGRect(x: 0, y: 0, width: 50, height: 50) addSubview(view) } override init(frame: CGRect) { super.init(frame: frame) setup() } required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) setup() } } This is the result. And this is what I expect it to look like. 回答1:

Xcode: Is there a way to change line spacing (UI Label) in interface builder?

故事扮演 提交于 2019-12-22 05:00:32
问题 I've got several UILabels with multiple lines of text, but the line spacing is larger than I would prefer. Is there any way to change this? 回答1: Since iOS 6, Apple added NSAttributedString to UIKit , making it possible to use NSParagraphStyle to change the line spacing. To actually change it from NIB, please see souvickcse's answer. 回答2: hi this is a late reply but it may help some one line height can be change change the text from plain to attribute 回答3: Because I friggin hate using

Creating Launch Screen.xib for iOS8 ( … iOS11, Swift 4 and LaunchScreen.storyboard )

倾然丶 夕夏残阳落幕 提交于 2019-12-22 04:19:48
问题 I've just found out that in order to be able to have the description for your app in the app store say "This app is optimized for iPhone 6, and iPhone 6 Plus." you need to use a launch XIB or storyboard file for your launch images (per [Apple][1]). So, I've created a new Launch Screen xib and now I'm a little but since I usually do everything in code and don't use interface builder. I've deleted the default label that is inserted and dropped a UIImageView into the view. Now I'm wondering how