nib

Creating a custom view using a xib

流过昼夜 提交于 2019-11-30 14:02:46
Using MonoTouch, I'm trying to make a custom view, so I can reuse this view multiple times in a screen. (it's a bunch of labels and buttons) After reading the answer to this post: How to add a custom view to a XIB file defined view in monotouch I must be getting close, but this only seems to allow me to add a custom view, defined in in myCustomView.CS, but what I'm looking for is a way to use a separate .XIB to design my custom view in the interface builder and only use the corresponding cs-file to add logic. If I try to make a XIB with the same name, the contents won't become visible.

Resetting Storyboard on Logout

三世轮回 提交于 2019-11-30 11:58:36
问题 I am building an IOS 5.1 web client app that uses a storyboard. One of my actions is "logout", during which I want to reset my root view to the initial view created by the root view of the Storyboard. (When you log in, some view items are removed or added based on who you are; when you log out, I want to reset them to their default values, which I've specified in the storyboard.) I realize that I could programmatically reset/re-add all of the elements, but then what good is the storyboard? I

How do I get a view in Interface Builder to load a custom view in another nib?

放肆的年华 提交于 2019-11-30 06:24:33
问题 I am making a custom widget that I would like to use in multiple nibs. So I make a new view nib Screen3, add some buttons, and now want my UIAwesomeSauce widget. If I just add a view and then change the Class Identity, it doesn't get the subelements from the UIAwesomeSauce nib. Same thing if I go to the Library and switch to Classes. It seems only a UIViewController has the field for "Load from nib", which would be beautiful. I know I can load the UIAwesomeSauce nib from code, get the top

Loading UIView from xib, crashes when trying to access IBOutlet

橙三吉。 提交于 2019-11-29 14:42:05
问题 I have a xib-file with a small UIView on it, which in turn contains some labels. Now, I'm trying to load that UIView into an existing UIViewController , and change one of the label-texts. The reason I want to do it this way, is that the UIView will be reused with different label-texts so I figured making a custom class and loading it from a xib would be the best way to go. I have tried several ways of loading it and I've successfully displayed it on my viewcontroller. The problem is, once I

How to add copyright information to a Nib file?

一曲冷凌霜 提交于 2019-11-29 10:46:27
I've just finished a total re-write [1] of one of Apple's example applications and I am going to release my code as source only on GitHub, under a BSD license. Adding the BSD license text to the .h and .m files is easy, and I can add copyright information to the .png assets that I will be including, but I am stumped as to how I can add the requisite license information to the xib files. XCode regenerates the files after an edit, so anything manually added to an xml comment will be stripped off. I'd like to add the license to the nib files for completeness but I am not hung up on doing it - so

Cannot zoom in and out of nib in the new Interface Builder

£可爱£侵袭症+ 提交于 2019-11-29 02:10:38
问题 Have I missed something obvious or is it not possible to zoom freely in and out of an open nib file, within the integrated Interface Builder of Xcode 4? 回答1: I filed a bug report a week or two ago - in short, they're aware of it. I won't paste the email here as it said it was under NDA. Here's hoping for 4.0.3 or similar with some zooming :) 回答2: Xcode 4.2 and no zoom and needed it badly. I have used the OS zoom: - no better alternative 回答3: For those of us who come upon this question because

Loading a UIView subclass from NIB size issues

感情迁移 提交于 2019-11-28 23:33:09
I have a subclass of UIView that needs to calculates it's height according to it's width. When created in code everything works. However when I try to create the view in Interface builder, and although I override all related methods, I can't get the size of the view set in interface builder. - (id)initWithCoder:(NSCoder *)aDecoder { NSLog(@"init with coder before super width %d",super.frame.size.width); // returns 0 self = [super initWithCoder:aDecoder]; NSLog(@"init with coder after super width %d",super.frame.size.width); // still returns 0 } - (void) awakeFromNib { NSLog(@"width of view %d"

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

…衆ロ難τιáo~ 提交于 2019-11-28 20:49:52
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 a number of times during the app's run. So: For one of these top-level items in the NIB, there are

Checking if a .nib or .xib file exists

两盒软妹~` 提交于 2019-11-28 20:16:49
What's the best way to check if a Nib or Xib file exists before trying to load it using initWithNibName:bundle: or similar? 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 identify missing files and spit out useful message about what exactly is missing. Solutions Objective-C : if([

How do I get a view in Interface Builder to load a custom view in another nib?

寵の児 提交于 2019-11-28 17:53:42
I am making a custom widget that I would like to use in multiple nibs. So I make a new view nib Screen3, add some buttons, and now want my UIAwesomeSauce widget. If I just add a view and then change the Class Identity, it doesn't get the subelements from the UIAwesomeSauce nib. Same thing if I go to the Library and switch to Classes. It seems only a UIViewController has the field for "Load from nib", which would be beautiful. I know I can load the UIAwesomeSauce nib from code, get the top level objects, and place it by hand. But the point of IB is so you don't have to place things in code.