interface-builder

Custom fonts are working on simulator but NOT rendering in some storyboards

为君一笑 提交于 2019-12-14 03:08:42
问题 Disclaimer : Custom fonts show up in storyboard/ interface builder and not in simulator is a popular question that is asked before ... and not to be confused by this different question. my case is the other way around, the font is working in simulator but not showing in all storyboards... I wonder why it works in some storyboards and not others.. I found no answer online, answer will be attached now, it took me some time to figure this out... 回答1: solution is simple , go to your target copy

Add a subview to a UIImageView that is the view outlet of a UIViewController in IB

女生的网名这么多〃 提交于 2019-12-14 01:19:52
问题 I have a UIViewController object in a .xib file. I add a UIImageView to it, and then try to add a button as a subview of the UIImageView. It instead replaces the UIImageView. It works fine if both are subviews of a UIView. What gives? I thought this would work since UIImageView is a subclass of UIView? 回答1: Only Apple knows. However, look at here for a workaround: Apple Interface Builder: adding subview to UIImageView 回答2: A UIImageView is it's own object and a UIButton is its own object. A

Using IB to add a UISegmentedControl to a NavigationBar

假装没事ソ 提交于 2019-12-13 14:27:17
问题 I'm current creating a UISegmentedControl programmatically in a view controller's viewDidLoad method and adding it to the view controller's navigation bar by assigning it to self.navigationItem.titleView . That's easy enough, but I'd like to be able to do this in Interface Builder as well and so far haven't been able to figure out how. Google hasn't been much help either. Can someone describe how to do this in IB or point to an online example? I'd be much appreciative. Thanks, Howard 回答1: If

NSTextField resigning first responder

给你一囗甜甜゛ 提交于 2019-12-13 13:28:44
问题 I'm trying to have my text field resign first responder when the user is done editing it, like when they hit enter. The delegate method is getting called but what I have now doesn't work, what is the proper way to go about doing this? - (BOOL)control:(NSControl *)control textShouldEndEditing:(NSText *)fieldEditor { [fieldEditor resignFirstResponder]; return YES; } 回答1: From the docs on the -resignFirstResponder method: Use the NSWindow makeFirstResponder: method, not this method, to make an

Interface-Builder: “combine” NSView-class with .xib

时光总嘲笑我的痴心妄想 提交于 2019-12-13 11:37:49
问题 I'd like to set up a custom NSView in Interface-Builder, but I don't get it to work for OSX. In my ViewController's .xib, I added a custom view and set the Class to MyCustomView. I created MyCustomView.h, MyCustomView.m and MyCustomView.xib. In MyCustomView.xib, I set the Class to MyCustomView as well. In MyCustomView.m, - (void)awakeFromNib is called, but - (id)initWithCoder:(NSCoder *)aDecoder and - (id) awakeAfterUsingCoder:(NSCoder*)aDecoder aren't. What I'd like to achieve is that in my

How to pass data between view controllers - not working

南笙酒味 提交于 2019-12-13 10:56:25
问题 Im trying to pass an player score from VC1 to a view that displays the current scores of all players(4). the display view is on a separate view controller than where the player(s) score is defined and stored. I have done the prepare(segue) and im able to pass other variables to the display VC(ThirdViewController). but when I try to assign the player score to the uilabel.text It tells me that I have unwrapped a nil value I have even tried to just set the label text to a static string and still

iPad: how can I create a repeatable UI element using Interface Builder?

痞子三分冷 提交于 2019-12-13 07:42:53
问题 I want to make a panel in Interface Builder with buttons and stuff on it. Then I want to programmatically clone it and reposition the clones with affine transforms. I'm thinking of something like a MovieClip from Flash. And it isn't sufficient to just render the same UI element multiple times. For example, it should be possible to type something different in each text box. Any ideas? 回答1: Create a new NIB file that contains your custom view. Create a UINib instance from that NIB file with +

How to change to a grouped table view in xcode without using Interface Builder

北城以北 提交于 2019-12-13 07:32:06
问题 I have a table that I created within xcode so there is no nib file in this case. I want to make my table into the 'Grouped' style but im not sure how. I think it has somthing to do with the method below, the problem is Im not really sure how to call it, I do understand how methods work I'm just not too sure on where to start with this one: - (id)initWithFrame:(CGRect)frame style:(UITableViewStyle)UITableViewStyleGrouped So could someone tell me how to call it? The problem is that its not a

Can you have two implementations of a ViewController with the same name for differen targets?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 07:20:03
问题 (This is a simplified description of a very large project) I have an XCode project that has two targets. The only difference between the two targets is there is a different implementation of a a viewcontroller for each target. The view controller has a xib and is just a simple view with a UITextView inside. Let's call it TextReportViewController. Implementation "A" has printing, so it has a button that allows you to print the contents of the UITextView. It is in a group called "A".

loading a UINavigation controller from a UIView

你说的曾经没有我的故事 提交于 2019-12-13 06:59:57
问题 i am designing an app that has a login screen. it is a UIView with username/password and a button to submit. once the user authenticated successfully, i want to load a new xib file that holds a navigation controller and a navigation bar. below the bar i want to load a tableView and switch between other views as i move along with the programming of it. what i did is create a new class that inherits from UINavigationController and assembled the xib file to include the navigation controller. i