iphone - Trying to base some code off of Apple's Image Zooming App example, missing some simple Interface Builder knowledge -
i'm trying base part of app off of apple's image zooming example, zooming, scrolling, , orientation of images saved app's sandbox.
i have sort of working now, except when scrollview loads, it's blank. code looks this:
@interface photoviewcontroller : uiviewcontroller <uiscrollviewdelegate> { uiscrollview *imagescrollview; uiimageview *imageview; } @property (nonatomic, retain) iboutlet uiscrollview *imagescrollview; @property (nonatomic, retain) uiimageview *imageview; @end @implementation photoviewcontroller @synthesize imageview, imagescrollview; - (void)viewdidload { [super viewdidload]; imagescrollview.bounceszoom = yes; imagescrollview.delegate = self; imagescrollview.clipstobounds = yes; imageview = [[uiimageview alloc] initwithimage:[uiimage imagenamed:@"image1.jpg"]]; imageview.autoresizingmask = uiviewautoresizingflexibleheight | uiviewautoresizingflexiblewidth; imageview.contentmode = uiviewcontentmodescaleaspectfit; imageview.backgroundcolor = [uicolor blackcolor]; imageview.userinteractionenabled = yes; [imagescrollview addsubview:imageview]; imagescrollview.contentsize = [imageview frame].size; }
the xib has photo view controller->scroll view->view structure. have feeling problem is. tried hook outlets identically example, under referencing outlets example has viewcontroller hooked imagezoomingappdelegate. since photoviewcontroller subview, there's not place hook viewcontroller that.
here's how bring photoviewcontroller:
(ibaction) photobuttonpressed: (id) sender { viewcontroller = [[photoviewcontroller alloc] init]; [self.navigationcontroller pushviewcontroller:viewcontroller animated:yes]; }
i know must "this close" having hooked right, don't understand relationship of xib code enough know how debug it. i'm not sure if know enough ask right questions.
try changing viewcontroller = [[photoviewcontroller alloc] init];
to
viewcontroller = [[photoviewcontroller alloc] initwithnibname:@"photoviewcontroller" bundle:nil];
(of course change text string whatever called xib file).
Comments
Post a Comment