objective c - Setting NSBox's setContentView with NSImageView not working -
i have nsbox set in main view accepts drag , drop. store url str. load image , add content view of nsbox.
imageview = [[nsimageview alloc] initwithframe:cgrectmake(0, 0, 390, 150)]; nsurl *imageurl = [nsurl urlwithstring:str]; nsimage *image = [[nsimage alloc] initbyreferencingurl:imageurl]; [imageview setimage:image]; [self setcontentview:imageview];
however, doesn't anything. image not displayed in nsbox.
another oddity. @ first trying add nsimageview via interface builder, image container had ikimageview... odd? isn't nsimageview more ubiquitous? develop on ios, have version ios developer site.
any thoughts?
edit: should add, when using ikimageview in ib, image show up. edit2: i've tried taking initwithframe out , replacing init, no go.
the problem was using initbyreferencingurl nsimage. doesn't work local files, instead used initbyreferencingfile , worked out well!
Comments
Post a Comment