Thursday, 15 April 2010

How to open a .nib file in a "popup" window , iOS? -



How to open a .nib file in a "popup" window , iOS? -

i have .nib file in application show user "popup" window.

i have result :

here can see empty "popup" window x closing.to accurate mt popup window sadly can load html , not view , .nib file.

does know how create popup window show .nib file or have ready 3rd party solution?

a custom uiview want friend.

so create class has super uiview.

create objective-c class call. illustration phone call mine customview

your header(.h)

#import <uikit/uikit.h> @interface customview : uiview @end

your class(.m) #import "customview.h"

@implementation customview - (id)initwithframe:(cgrect)frame { self = [super initwithframe:frame]; if (self) { // initialization code [self loadnib]; } homecoming self; } - (void) loadnib { nsarray * subviewarray = [[nsbundle mainbundle] loadnibnamed:@"mynib" owner:self options:nil]; uiview * mainview = [subviewarray objectatindex:0]; [self addsubview:mainview]; } - (ibaction)close:(id)sender{ [self removefromsuperview]; } @end

now in viewcontroller phone call , add together custom view. many want in ibaction(button click etc).

cgrect frame = cgrectmake(10,10,300, 460); customview *view = [[customview alloc] initwithframe:frame]; [self.view addsubview:view];

when custom view added main view have loaded nib.

edit:to have x close it. in customview have ibaction , [self removefromsuperview]; may want setup delegate communicating controller on when view on closes etc.

want able tap off custom view close it, create uiview set uitapgesturerecognizer on closes custom view , place underneath custom view , cover whole screen.

hope helps,

booranger

ios popup nib popupwindow

No comments:

Post a Comment