interface-builder

How to load a XIB with a top-level ViewController?

拈花ヽ惹草 提交于 2019-12-23 08:47:34
问题 I've got a nib with a view controller root element like this: so I can position elements relative to the top and bottom layout guides using auto-layout. When I first tried to load this nib using SearchViewControllerPro* searchViewController = [[SearchViewControllerPro alloc]initWithNibName:@"SearchViewControllerPro" bundle:[NSBundle mainBundle]]; I got the following run-time exception: Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '-[UIViewController

How to scroll in iOS Simulator on mac book air?

对着背影说爱祢 提交于 2019-12-23 07:27:59
问题 I have a scroll view and and an embed UIImageView. Code is right but I can not scroll in the Simulator likely because I have a trackpad, not a mouse. Or can I? 回答1: You can click the trackpad and drag (as other folks have said), or if you have "Three finger drag" enabled in Trackpad preferences, you can scroll with three fingers. Here's a guide to all of the gestures in the simulator: iOS Simulator User Guide 回答2: You need to enable 3 finger drag: From the Apple menu, choose System

Custom font displays in IB but not in simulator

强颜欢笑 提交于 2019-12-23 07:26:14
问题 I have set up a UITextView and a UILabel to use a custom font. (It is a vertically mirrored Mongolian font, but I also included English text so that you can see the effect.) The words display in the Interface Builder, but in the simulator most of the characters in the UITextView are just empty boxes. Strangely, in the characters in the UILabel do display correctly in the simulator. How do I get them to display in the UITextView as well? Notes: I am using Xcode version 6.3.2. From this SO Q&A

want to display multiple lines in custom cell label

让人想犯罪 __ 提交于 2019-12-23 05:32:34
问题 I have a label in a custom cell with 3 labels in a table view. I am trying to display a text message "Updated status one of user" in one of the labels, but it displays only "Updated status" and truncates the rest of the message. What can I tweek to display the whole message in a line or spill it to a second line is necessary? Appreciate your suggestions. 回答1: Well, set the number of lines of your label to 0, and set its lineBreakMode to UILineBreakModeWordWrap if you want the text to wrap to

Best way to change UIViewController view NIB programmatically

房东的猫 提交于 2019-12-23 04:53:36
问题 I have this iPad application with different NIBs and views. Each view has two NIBs, one for potrait orientation and one for landscape, so i'm searching for a method to programmatically switch NIB for a given UIViewController . Right now i have this function that i'm using in the willRotateToInterfaceOrientation method of each controller : void UIHandleRotation( UIViewController *controller, NSString *nibName, UIInterfaceOrientation orientation, BOOL transform ){ double angle = 0.0; if(

WKWebView on macOS cuts off top

天涯浪子 提交于 2019-12-23 04:00:33
问题 I placed a WKWebView inside a NSView with a y coordinate > 0. After loading a page (no matter which one) it either immediately cuts off the top or it shows the top for a second and then jumps down the page (by doing so cutting off the top). What's more is that when I scroll up I get a glimpse of the top portion but it bounces back not allowing me to actually scroll to the very top. No changes have been made to the WKWebView. What I noticed is, that the smaller y the smaller the portion which

View Objects don't connect to the File's Owner

拈花ヽ惹草 提交于 2019-12-23 03:57:27
问题 I am trying to "Connect" my objects in the view to the File's Owner using the interface builder , but the blue line does not 'link' with it. Here is my code: CalculatorViewController.h : #import <UIKit/UIKit.h> #import "CalculatorBrain.h" @interface CalculatorViewController : UIViewController { IBOutlet UILabel *display; IBOutlet UIButton *button; CalculatorBrain *brain; BOOL userIsInTheMiddleOfTypingANumber; } - (IBAction)digitPressed: (UIButton *)sender; - (IBAction)operationPressed:

Reusable bits of interface, designed in IB

纵然是瞬间 提交于 2019-12-23 02:21:30
问题 I'm making an app that includes the same group of buttons in many different contexts. The buttons send their actions to a different object in each context. I'd like to be able to design a single NSView in IB containing the buttons, and then be able to put copies of that view in many places in my nibs, while maintaining the link, so changes propagate. I'd like to connect each of those instances to different objects, and have the buttons send their actions to whatever object their parent view

How can I make an NSOutlineView where some of the entires are buttons?

对着背影说爱祢 提交于 2019-12-22 17:42:20
问题 I want to create an NSOutlineView subclass where some of the entries look like buttons. It would look something like this: + Fruits + Organic - Apples - Bananas [Add Item] + Non-organic - Cherries [Add Item] [Add Item] + Vegetables - Carrots [Add Item] Where all of the "[Add Item]"'s are buttons. I have a feeling this involves using the outlineView:willDisplayCell:forTableColumn:item: delegate method somehow? 回答1: You'll want to implement the outlineView:dataCellForTableColumn:item: method in

Scaling a font on a multilined UIButton depending on a device size

前提是你 提交于 2019-12-22 11:36:03
问题 Current setup: I have a multilined UIButton which is added to its superview (an ordinary UIView ). Button's width is 90% of its superview. So when its superview's size changes, label's width changes accordingly due to Autolayout constraints. Next, inside of viewDidLoad method I did this: //Line break mode and Font size ( are set in Interface Builder myButton.titleLabel?.adjustsFontSizeToFitWidth = true myButton.titleLabel?.minimumScaleFactor = 15.0 myButton.titleLabel?.numberOfLines = 2 So