interface-builder

AutoLayout with size classes: Different spacing depending on iPhone screen size

烂漫一生 提交于 2020-01-15 17:58:11
问题 I have a UIViewController set up in an UIStoryboard in Interface Builder using size classes. This looks good on an iPhone 5 with the 4" screen, but on the 5.5" screen of the iPhone 6 Plus the elements are too cramped in the top area of the device. I want to increase the constant of the spacing constraints on iPhone 6 and 6 Plus. As far as I was able to see that's not possible with size classes, as there is only one size class for all iPhone displays (no matter if 3.5" or 5.5"). What is the

Trouble with First Responder

[亡魂溺海] 提交于 2020-01-15 12:48:28
问题 I've had some trouble implementing some shortcuts in a document based application (i.e. Bold, Italic etc) available here: Connecting Menu Items in Document Based Applications The issue is that the method described disconnects the actual 'Bold' menu item from the Font Manager, and replaces it with my action I created (in this case, boldIt ). Because there can be only one sent action, it is replaced, not added. How can I overcome this? Very frustrating. If anyone can help me I would greatly

Create custom action in a class for use in Interface Builder

ぃ、小莉子 提交于 2020-01-15 09:31:30
问题 I want to create a custom action connection in a class, which should be visible in Interface Builder. For example - I add action / target properties to NSView class just like this: weak open var object: AnyObject? open var something: Selector? The action is something and the target is object . Now I want in Interface Builder to have 'Send Action' link / connection available for something and to be able to make connection to a @IBAction method to some class (for example the controller of the

how to set horizontal scrolling in UITableView by using interface builder?

我与影子孤独终老i 提交于 2020-01-15 01:23:57
问题 I have UITableView in my app with 2 columns.I can read column 1 and half of column 2.My questions are- can we add horizontal scroll by use of interface builder in uitableview so i can read column 2 for all cells in table? should we have to add some code for that too or its only possible with interface builder? 回答1: First, the row in the UITableView doesn't scrolls itself inside the UITableView . My solution (I know someone will come out with something better) Is to use an UIScrollView and

Interface builder agent crashes when accessing @IBInspectable UIImage

夙愿已清 提交于 2020-01-14 10:33:12
问题 I'm implementing a custom view by subclassing UIView and using @IBInspectable for some of my variables. Two of them are UIImage. If I try to access one of them in the code, the interface builder crashes with the following message: file:///PathToMyProject/MyProject/Pod/Classes/UI/View/MyView.xib: error: IB Designables: Failed to update auto layout status: The agent crashed and file:///PathToMyProject/MyProject/Pod/Classes/UI/View/MyView.xib: error: IB Designables: Failed to render instance of

UISegmentedControl selected index always 0?

给你一囗甜甜゛ 提交于 2020-01-14 09:22:12
问题 I have a UISegmentedControl that has 6 segments which I created in Interface Builder. I am calling the following method on value changed: -(IBAction)segmentedChartButtonChanged:(id)sender { switch (self.segmentedChartButton.selectedSegmentIndex) { case 0: NSLog(@"5d selected. Index: %d", self.segmentedChartButton.selectedSegmentIndex); break; case 1: NSLog(@"3m selected. Index: %d", self.segmentedChartButton.selectedSegmentIndex); break; default: break; } } Whenever I change the segments, the

UIImageView with IBOutlet in Swift to see it in the Interface Builder

拥有回忆 提交于 2020-01-14 06:02:29
问题 When I insert an Image to my View like this it works: func loadSomeImage() { var imageView = UIImageView(frame: CGRectMake(100, 150, 150, 150)) var image = UIImage(named: "myImage.jpg") imageView.image = image self.view.addSubview(imageView) } My problem with this code is, that the ImageView is not shown in the Interface Builder. When I write this code however, I get an error: @IBOutlet weak var imageView: UIImageView func loadSomeImage() { self.imageView = UIImageView(frame: CGRectMake(100,

How to set the font of NSMenu/NSMenuItems?

末鹿安然 提交于 2020-01-13 10:47:10
问题 I can’t figure out how to set the font/styling of my NSMenuItems in my NSMenu. I tried the setFont method on the NSMenu but it doesn’t seem to have any effect on the menu items. NSMenuItem doesn’t seem to have a setFont method. I would like for them all to have the same font/style so I would hope there’s just one property I can set somewhere. 回答1: They can have an attributed title, so you can set an attributed string as title with all it's attributed, font included: NSMutableAttributedString*

What is the exact size of UIModalPresentationFormSheet in iPad

泪湿孤枕 提交于 2020-01-13 08:53:23
问题 I am using following code for displaying a Screen/View Controller. SearchParams *nxt=[[SearchParams alloc] initWithNibName:@"SearchParams" bundle:nil]; UINavigationController *nvc=[[UINavigationController alloc] initWithRootViewController:nxt]; nvc.modalPresentationStyle=UIModalPresentationFormSheet; [self.preLCtr.preCinescape_iPadViewController presentModalViewController:nvc animated:YES]; I am not sure about the size of PesentationSheet. I tried to take screenshots & take dimentions/size.

Choosing between the two - Interface Builder OR creating via code

旧时模样 提交于 2020-01-12 02:34:13
问题 When I started with IPhone development I preferred using Interface builder for creating views in my application. With time I considered the option of creating the application via code which I really feel comfortable working with. Now, when I know both ways to create my user interface, I have doubts which way to follow. I keep thinking where to use IB and where to use code . How can I figure out before starting with my application, which way should I create my UI ? 回答1: There are a number of