I need some suggestion for how to add uibutton
and uiimage
on mpmovieplayercontroller
like vine app.
I try to this concept using mpmovieplayercontroller
but the uibutton
and uiimage
are not displayed. Only video played on this player.
CGRect screenBounds = [[UIScreen mainScreen] bounds];
if (screenBounds.size.height == 568)
{
// code for 4-inch screen
[logotitleimg setFrame:CGRectMake(80, 85, 160, 50)];
twitterloginbtn.frame = CGRectMake(20, 330, 280, 45);
fbloginbtn.frame = CGRectMake(20, 390, 280, 45);
signupbtn.frame = CGRectMake(20, 450, 280, 45);
//signinlbl.frame = CGRectMake(20, 510, 200, 21);
loginbtn.frame = CGRectMake(220, 510, 295, 25);
}
else
{
// code for 3.5-inch screen
[logotitleimg setFrame:CGRectMake(80, 85, 160, 50)];
twitterloginbtn.frame = CGRectMake(20, 240, 280, 45);
fbloginbtn.frame = CGRectMake(20, 300, 280, 45);
signupbtn.frame = CGRectMake(20, 360, 280, 45);
//signinlbl.frame = CGRectMake(20, 430, 200, 21);
loginbtn.frame = CGRectMake(220, 428, 295, 25);
}
NSURL *contentURL = [[NSBundle mainBundle] URLForResource:@"spll" withExtension:@"mp4"];
mc = [[MPMoviePlayerController alloc] initWithContentURL:contentURL];
mc.shouldAutoplay = YES;
mc.controlStyle = MPMovieControlStyleNone;
mc.contentURL = contentURL;
[mc prepareToPlay];
mc.repeatMode=MPMovieRepeatModeOne;
mc.view.frame = self.view.bounds;
[mc setScalingMode:MPMovieScalingModeFill];
[mc play];
[self.view addSubview:mc.view];
/*overlayview=[[UIView alloc] initWithFrame:mc.view.bounds];
[mc.view addSubview:overlayview];*/
logotitleimg=[[UIImageView alloc] init];
[logotitleimg setImage:[UIImage imageNamed:@"nativelogo.png"]];
[mc.view addSubview:logotitleimg]; //[overlayview addSubview:logotitleimg];
twitterloginbtn = [UIButton buttonWithType:UIButtonTypeCustom];
[twitterloginbtn setBackgroundColor:[UIColor clearColor]];
[twitterloginbtn setBackgroundImage:[UIImage imageNamed:@"twitter_signin.png"] forState:UIControlStateNormal];
[twitterloginbtn addTarget:self action:@selector(twitterloginaction:) forControlEvents:UIControlEventTouchUpInside];
[mc.view addSubview:twitterloginbtn];
fbloginbtn = [UIButton buttonWithType:UIButtonTypeCustom];
[fbloginbtn setBackgroundColor:[UIColor clearColor]];
[fbloginbtn setBackgroundImage:[UIImage imageNamed:@"facebook_login native.png"] forState:UIControlStateNormal];
[fbloginbtn addTarget:self action:@selector(fbcalling:) forControlEvents:UIControlEventTouchUpInside];
[mc.view addSubview:fbloginbtn];
signupbtn = [UIButton buttonWithType:UIButtonTypeCustom];
[signupbtn setBackgroundColor:[UIColor clearColor]];
[signupbtn setBackgroundImage:[UIImage imageNamed:@"email_signup.png"] forState:UIControlStateNormal];
[signupbtn addTarget:self action:@selector(signuppage:) forControlEvents:UIControlEventTouchUpInside];
[mc.view addSubview:signupbtn];
loginbtn = [UIButton buttonWithType:UIButtonTypeCustom];
[loginbtn setBackgroundColor:[UIColor clearColor]];
[loginbtn setTitle:@"Already have an acount? Sign in now." forState:UIControlStateNormal];
[loginbtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[loginbtn.titleLabel setFont:[UIFont fontWithName:@"Verdana-Bold" size:10]];
[loginbtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
[loginbtn addTarget:self action:@selector(loginpage:) forControlEvents:UIControlEventTouchUpInside];
[mc.view addSubview:loginbtn];
Try like this:-
UIButton *btn=[[UIButton alloc] intWithFrame...];
UIImageView *img=[[UIImageView alloc]init];
[mc.view addSubView:btn];
[mc.view addSubView:img];