nib

If you have an IBOutlet, but not a property, is it retained or not?

折月煮酒 提交于 2019-11-27 20:47:41
问题 I find the documentation on this issue to be unclear: Say you are working with iOS (NOT the Mac case, no need to mention the differences). Say it is strictly 4.0+ (no need to mention differences in old OS). Say we are loading the NIB strictly automatically. Say you have a UIViewController, BigView. Say there are a dozen so-called "top-level" items in the NIB file...could be custom controls, images, or anything else. Say you are definitely going to explicitly create and then get rid of BigView

What's up with the .NIB -> .XIB?

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 20:10:51
问题 What's up with the NIB->XIB change somewhere between XCode 3.0 to 3.1? Is there any difference with this name change that I should know while I go through tutorials that mention nothing but the .nib file? 回答1: XIB's are very cool. they are basically an un-compiled NIB (in XML format if memory serves me) during the build process they are converted to NIB's to be deployed in the final product. 回答2: As I understand it, xib files are x ml n ib files. xib files are compiled into nibs when the

“First Responder” - Did I get that right?

别来无恙 提交于 2019-11-27 17:51:24
Let me summarize this shortly: A "First Responder" in a nib file is an object, which represents the UI control element that has the user's focus. So if the user clicks on a control, the nib sets that clicked UI control as First Responder. In my app I could make an outlet to that "First Responder" from the nib, so that I could for example send a message "make red font color" to whatever the user has activated by clicking. And then, if this First Responder UI control does not understand that message, the message gets passed up in the responder chain, until a parent element or grandparent (and so

What is the File's Owner (in Interface builder)?

那年仲夏 提交于 2019-11-27 17:13:20
I am new to Cocoa and I don't understand the concept of File's Owner of a .nib file. Here is the way I would see things : Consider a file myNibFile.nib file that describes how a window looks. Now, I want to connect an actual window to this .nib file. So, I create a class myWindow , which is a subclass of NSWindowController . And, to do this connection, I change the init method like this: -(id)init { [super initWithWindowNibName:@"myNibFile"]; return self; } So, I understand that when I create an instance of myWindow , the "system" will go and look at the .nib file and create the adequate

Checking if a .nib or .xib file exists

£可爱£侵袭症+ 提交于 2019-11-27 12:49:27
问题 What's the best way to check if a Nib or Xib file exists before trying to load it using initWithNibName:bundle: or similar? 回答1: Macro #define AssertFileExists(path) NSAssert([[NSFileManager defaultManager] fileExistsAtPath:path], @"Cannot find the file: %@", path) #define AssertNibExists(file_name_string) AssertFileExists([[NSBundle mainBundle] pathForResource:file_name_string ofType:@"nib"]) Here are a set of macros that you can call before you try an load a .xib or .nib , they will help

wrong frame size in viewDidLoad [duplicate]

感情迁移 提交于 2019-11-27 12:37:59
Possible Duplicate: Why am I having to manually set my view’s frame in viewDidLoad? I have universal app for iphone and ipad, two storyboards, if I run my app on the iphone simulator in viewDidLoad every frame of each element in nib is correct. But if I do it for ipad (simulator) in frame is nil, but the screen looks correct. Could you please advise me smth? Thanks. foundry It's a very similar question to ios setContentOffset not working on iPad ... And my answer is the same as there: "You should not initialise UI geometry-related things in viewDidLoad , because the geometry of your view is

Using XCode storyboard to instantiate view controller that uses XIB for its design

自作多情 提交于 2019-11-27 10:33:18
问题 I have a UIViewController subclass that I created previously that had its controls laid out in a XIB file. I'd like to use this view controller in a storyboard now, but it seems although I can indicate a view controller's classname in the storyboard, I can't tell it to load the XIB. I'd rather not move everything from the XIB to the storyboard but keep it in its separate XIB. How can I get this UIViewController in the storyboard to load my XIB? 回答1: Delete the View contained by the view

Objective-C all instances for UI is nil

时光总嘲笑我的痴心妄想 提交于 2019-11-27 08:56:35
问题 I'm trying to do my first project in Objective-C/Xcode for Mac. So far, I have just copied an example from GitHub (https://github.com/phae-girl/multi-view-controllers-xibs). It is an example of how to have 2 subviews inside a main window. The example works great, but when I add a button inside one of the views, the "- (IBAction)newButton:(id)sender{}" method for the new button shows both subviews as "nil". I'm confident it is a problem with access as textfields keep their value between

Why won't my awakeFromNib fire?

北慕城南 提交于 2019-11-27 08:55:36
I am starting to move more of my view hierarchy construction to IB. I have a nib file called "AlignmentViewController.xib" in which I set up my view hierarchy with AlignmentViewController as the files owner. This works fine. One of the methods I remain fuzzy on is awakeFromNib. In the follow code snippet of AlignmentViewController I add the single additional method awakeFromNib. However, it does NOT get called: - (void)awakeFromNib { NSLog(@"AlignmentViewController - awakeFromNib"); [super awakeFromNib]; } - (id)initWithChromosomeName:(NSString *)chromosomeName basepairStart:(NSUInteger

How to convert a NIB-based project to a Storyboard-based? [closed]

点点圈 提交于 2019-11-27 04:39:35
I'm using storyboard (this is completely new!). How do I import my existing xib files and integrate them onto a single file, using the storyboard option? T.J. There is not a 1-click way to do this. According to "Sams Teach Yourself Core Data for Mac and iOS in 24 Hours" by Jesse Feiler, storyboards are different enough in their developer interfaces that it makes sense not to convert existing nib but to use them for new projects. One of the larger differences the way view transitions are handled. However, I did take the plunge and feel it was worth it because I was still near the beginning of a