- Home /
UIImageView in native iOS plugin
This is my attempt at adding an image overlay in ios to a plugin I bought from the store. I've never done any native ios stuff, so it's cobbled together from trawling through google. I'm adding it in at the end of the code to set up the display that was in there, and which obviously does work, but didn't use images.
I would appreciate any help in getting it to work. I tried to get the image address from here http://stackoverflow.com/questions/10808632/loading-resources-in-a-native-plugin-unity and the actual image display from this http://stackoverflow.com/questions/7891613/create-uiimageview
My guess is that it is the code to get the file path for the file, stored in the StreamAssetts dir, but I don't know.
Here is my code. (From init_ui in EZCodeScannerViewController.mm)
NSString* bundlePath = [[NSBundle mainBundle] bundlePath];
NSString* streamingAssetsPath = [NSString stringWithFormat:@"%@/Data/Raw/scanner_overlay.png", bundlePath];
UIImage *myImageObj = [[UIImage alloc] initWithContentsOfFile:streamingAssetsPath];
UIImageView *myImageView=[[UIImageView alloc] initWithImage:myImageObj];
[myImageView setFrame:CGRectMake(0,0,screen_width,screen_height)];
[self.view addSubview:myImageView];
Your answer
Follow this Question
Related Questions
Can I code a native plugin for iOS in C/C++? 0 Answers
iOS open docx file from Application.persistentData 2 Answers
Load popup dialog in iOS 0 Answers
UnityPluginLoad never called on iOS, Is it just broken? 1 Answer
IOS native plugin become slow in Unity 0 Answers