Questions tagged [loadnibnamed]
62 questions
24
votes
3 answers
iOS loadNibNamed confusion, what is best practice?
I'm familiar with most of the process of creating an XIB for my own UIView subclass, but not everything is working properly for me - it's mostly to do with the IBOutlets linking up. I can get them to work in what seems like a roundabout way.
My…

Cloov
- 538
- 1
- 3
- 15
12
votes
2 answers
How does loadNibNamed work? UIView outlets not initializing using loadNibNamed
I know this is quite straight forward but after too much hair-pulling I am nowhere near solution.
I have seen tutorials explaining how to create view using XIB and all. But none of them address the situation that I have here.
I have an XIB file, a…

Nirav Bhatt
- 6,940
- 5
- 45
- 89
8
votes
3 answers
Take a snapshot of view without adding it to the screen
I'm trying to load a view from a nib, configure it, and take a snapshot of it, without adding it to the screen:
+ (void)composeFromNibWithImage:(UIImage*)catImage completion:(CompletionBlock)completion {
NSArray *nibContents = [[NSBundle…

soleil
- 12,133
- 33
- 112
- 183
8
votes
1 answer
Difference in performance: loadNibNamed vs. programmatically
I have a viewcontroller, that contains many custom UIViews. The custom UIView I tried to define it using InterfaceBuilder (IB), and load it within initWithFrame using this code:
NSArray *xib=[[NSBundle mainBundle] loadNibNamed:@"DayView" owner:self…

kjoelbro
- 6,296
- 4
- 21
- 18
7
votes
2 answers
Objective C : loadNibNamed method: how does it work?
I would know how loadNibNamed of NSBundle class works; In some document I find something like
[[NSBundle mainBundle] loadNibNamed:@"mynib" owner:self options:NULL];
without return value; just called inside a method (e.g. cellForRowAtIndexPath if I…

volperossa
- 1,339
- 20
- 33
6
votes
1 answer
Having trouble loading custom view from xib in another xib
Apologies because I see people have asked questions like this before. However, I haven't had much luck following the instructions. I'm interested in creating a custom view with a xib file and reusing it in another view controller's xib…

user1328114
- 71
- 5
5
votes
1 answer
What's the meaning of owner when using loadNibNamed?
Apple Doc says One of the most important objects in a nib file is the File’s Owner object , but it seems that's the File's owner in nib file , not the one set by LoadNibName method. I wonder what's the difference between them?
Here is an example:
I…

johnMa
- 3,291
- 24
- 37
5
votes
0 answers
Can someone explain File Owner in iOS
Apologies in advance for this question, though it's been discussed at length since iOS came out. But I still don't get it, despite my best efforts. The closest image I can picture is "frozen and dried object graph", which is fine, but that doesn't…

Alex
- 1,581
- 1
- 11
- 27
4
votes
1 answer
loadNibName method is too slow - how to make it quicker?
I have a scroll view, which contains about 40-50 objects of different types. The object's types are defined in function of the object's location (for ex. if is the 5th object in the scroll view-> is's Object1, if it is the 11th object in the scroll…

MMMM
- 1,319
- 1
- 14
- 32
3
votes
1 answer
UIView.addSubview using a NIB-loaded view does only add root UIView
I externalized a component in a XIB file so I can reuse it in several different views.
Now in my view controller I load the XIB-based UIView and add it to the current view through :
NSArray *views = [[NSBundle mainBundle]…

Christophe Fondacci
- 718
- 12
- 14
3
votes
1 answer
How to load xib and display window of custom framework from a application
I created a framework and added a xib file named "MyXibFile". I created a separate application and added this framework to it. I want to load this .xib file to display the window from it.
I am using the following code snippet which is not working…

Akbar
- 1,509
- 1
- 16
- 32
2
votes
3 answers
How to setenv (set environment variable) using mainmenu nib (xib) file in Cocoa or Xcode programming?
I am new to both Cocoa programming and Xcode. I am wondering how I can setenv (or set environment variable) using MainMenu.nib (or .xib) file. I have someone else's code in the main function like this:
[NSApplication sharedApplication];
[NSBundle…

Sangcheol Choi
- 841
- 1
- 12
- 19
2
votes
2 answers
Objective C - Loading a UIView from nib?
I have a base class that initializes itself from a nib file.
How can I inherit from this class.
Every time I init a subclass of it it creates an object of the base class instead of the actual class I am trying to create
Base Class
@implementation…

aryaxt
- 76,198
- 92
- 293
- 442
2
votes
3 answers
Why "loadNibNamed" methods return array?
When we use the loadNibNamed method to get nib file, why will return a array, is not a nib file name corresponds to a nib file? I try to print this array's count, I found it always return 1. I hope you can help me to explain, thank you every much!…

fly_basket
- 49
- 7
2
votes
3 answers
Possible crash when loadNibNamed on jailbreak devices [UIDeviceRGBColor superview]: unrecognized selector
My code looks like this:
CGRect screenRect = [[UIScreen mainScreen] bounds];
SomeView *infoView;
if(screenRect.size.height != 568.0){
// iPhone 5/5s users crash in the next line
infoView = [[[NSBundle mainBundle] loadNibNamed:@"SomeViews"…

benck
- 2,034
- 1
- 22
- 31