xcode-storyboard

How to change uiview's height using auto layout?

☆樱花仙子☆ 提交于 2019-12-04 07:38:26
So I created this scenario in order to understand how views increase in height according to their content. However am still not able to make it happen. This is what I have now: the textview is growing according to content. however the uiview containing it is disappearing. what constraints should I use so that when the uitextview becomes bigger, its parent view also increase in height? ON UITextView make your you unselected These Scrolling Enabled Bounces Bounce Horizontally Bounce Vertically Shows Horizontal Indicator Shows vertical indicator Now Change your auto layout constraints like this.

UILabel subclass appearance in Storyboard

谁都会走 提交于 2019-12-04 07:28:20
I have created a subclass of UILabel called MyUILabel. The only thing changed is the font and font-size. It appears as expected when I run the app. However, the in the Storyboard, the default UILabel is showed. Is there any way to make Storyboards show the font and font-size from my subclass? MyUILabel: public class MyUILabel : UILabel { required public init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) self.font = UIFont(name: Constants.DefaultFont, size: 30) } } You could make it @IBDesignable , and then implement prepareForInterfaceBuilder : @IBDesignable public class MyUILabel:

Prevent Interface Builder from auto creating Constraints?

混江龙づ霸主 提交于 2019-12-04 03:09:14
问题 I created a demo project here. I have a view where I created a ScrollView in a .xib file. In interface builder I did not set any constraints. In my viewDidLoad method I set constraints with SnapKit: scrollView.snp_makeConstraints { (make) -> Void in make.edges.equalTo(self.view) } When I run the code I get the following console output: Unable to simultaneously satisfy constraints. Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each

Use Storyboard References While Retaining Icons & Text for Tab Bar Controller

为君一笑 提交于 2019-12-04 02:49:03
问题 I started refactoring one of my projects to make the code easier to manage and the Tab Bar Controller lost its icons for which tab represents what. Without this I'm a bit lost which tab is what for re-ordering purposes. How do I get the icons to show up again for a tab bar controller when I'm using storyboard references? Refer to my attached image. Notice how the first 3 tabs are 'blank' but the other tabs that I have not refactored yet show with the icons and titles. For those unfamiliar

How to honor Dynamic Type Accessibility Sizes with a custom font in an iOS storyboard

≯℡__Kan透↙ 提交于 2019-12-04 01:32:50
How can I use the dynamic type text style "Title 1" and set the font face to the built-in font Chalkboard SE for a UILabel in a storyboard? I need to honor the Dynamic Type size in iOS (Apple has been encouraging this since iOS 7?) I also need to use the built-in font Chalkboard SE, which is not used by default for the "text styles" fonts. I am currently using a custom font as shown in the image, but need the font to change size in accordance with the user's Dynamic Type / Accessibility Sizes preference just as all the Text Styles fonts do. The best Text Styles option is Title 1 , but the font

applicationDidFinishLaunching not called, using storyboards and swift3

风格不统一 提交于 2019-12-04 01:20:49
问题 The applicationDidFinishLaunching is not being called when I run my app. This is the code of my AppDelegate class: @NSApplicationMain class AppDelegate: NSObject, NSApplicationDelegate { let statusItem = NSStatusBar.system().statusItem(withLength: NSSquareStatusItemLength) func applicationDidFinishLaunching(_ aNotification: Notification) { // Insert code here to initialize your application } func applicationWillTerminate(_ aNotification: Notification) { // Insert code here to tear down your

custom uitableviewcells in storyboard

牧云@^-^@ 提交于 2019-12-03 18:01:53
问题 I think I got all the steps down but I must be missing something because I can't make a connection from the labels in the cell to the code. Here's what I'm doing: set style of cell to custom dragging some labels onto the prototype cell. adding a new file to the project and making it a subclass of UITableViewCell in the identity inspector of the cell im trying to customize, I set its class to the new class I just created. TRY to control drag from the labels on the cell to the headerfile of the

How do you use Interface builder with Swift?

南楼画角 提交于 2019-12-03 17:11:36
问题 When hooking Swift code up to a Storyboard, how do you add the IBAction and IBOutlet tags? 回答1: Add IBAction and IBOutlet attributes to variables and functions so they can be visible in Interface builder. class ViewController: UIViewController { @IBOutlet var label: UILabel? @IBAction func doTap(x:UIButton) { println("Tapped: \(x)") } } 回答2: Below code shows IBOutlet and IBAction format in Swift : class MyViewController: UIViewController { @IBOutlet weak var btnSomeButton: UIButton? @IBOutlet

UITableView cells not nil at initialization

强颜欢笑 提交于 2019-12-03 16:28:33
I am setting up my UITableView using storyboard editor. For creating my cells I am using the standard delegate method: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"SearchResultCell"]; if (cell == nil) { // Do cell setup } // etc return cell; } Except when the cell is dequeued the very first time it's not nil, as it should be. So the code inside the if statement is never executed. People get this error when their reuse identifiers are inconsistent, so I went ahead

Drag/pan gestures on a GMSMapView not getting captured after update to SDK 1.3.1

夙愿已清 提交于 2019-12-03 15:35:41
I'm having a strange problem with capturing drag/pan gestures on a GMSMapView through a Gesture Recognizer. This problem surfaced only after updating from GMS 1.2 to 1.3.1, where (quoting the documentation ), Touches are consumed more agressively by GMSMapView I have a UIViewController holding a GMSMapView under its main view. I found GMSMapDelegate does not provide methods for handling drag/pan gestures, so I added a UIPanGestureRecognizer to the UIViewController, linked it to an IBAction selector, and set referencing outlet and outlet collection, as per the screenshot linked here: http://i