tags:

views:

131

answers:

1

hi,i am new to this objective-c i want to load a view using nib file i created when i press a button .without using any view controller..

+4  A: 

This is generally considered a bad idea if you don't know what you're doing, but if you really want to do this then there's 2 places to look, depending on what version of the OS you're developing for.

iOS 4

Look at UINib in the documentation. You can use this to load a nib fairly easily.

iOS 3.2 and earlier

Use NSBundle. There is a category, documented under the name "NSBundle UIKit Additions Reference", that adds a method -loadNibNamed:owner:options:. You can also use this on iOS 4.0 if you so desire.

In both cases, the owner object fills in the role of "File's Owner" in the nib, useful if you have actions or outlets specified on the owner. The method also returns an NSArray of all the top-level objects in the nib. Be careful, if you use this array you need to retain any of the objects that you want to keep, as the array (and all the objects) are returned autoreleased.

Kevin Ballard
k thank you for useful answer
lak in iphone
please accept the answer by clicking the check mark then
iWasRobbed