Unity のコールバック メソッドで、UIButton を追加しました
int OpenEAGL_UnityCallback(UIWindow** window, int* screenWidth, int* screenHeight, int* openglesVersion) {
CGRect rect = [[UIScreen mainScreen] bounds];
// Create a full-screen window
_window = [[UIWindow alloc] initWithFrame:rect];
EAGLView* view = [[EAGLView alloc] initWithFrame:rect];
if (wrapperObj == nil)
{
wrapperObj = [[WrapperClass alloc] init];
}
UIImage *buttonImage = [UIImage imageNamed:@"imageButton.png"];
UIButton *backButton = [[UIButton alloc] initWithFrame:CGRectMake(view.bounds.origin.x+35, view.bounds.size.height-72, 36, 39)];
[backButton setImage:buttonImage forState:UIControlStateNormal];
[backButton addTarget:wrapperObj action:@selector(goToPreviousScreen:) forControlEvents:UIControlEventTouchUpInside];
[view addSubview:backButton];
}
Unity3D がインスタンス化されているクラス (MyViewController) のビューにアクセスするにはどうすればよいですか? ビューを変更したい
@implementation MyViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
QCARUnityPlayer::getInstance().QCARInit([orientation UTF8String]);
[self startUnity];
}
return self;
}
@end