Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7704535
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T23:42:07+00:00 2026-05-31T23:42:07+00:00

Here’s a piece of code, currently driving me nuts. It’s a UIView, with an

  • 0

Here’s a piece of code, currently driving me nuts. It’s a UIView, with an AVPlayerLayer (as a sublayer) and a UITableView (as a subview). Longpressing on the movie should hide the movie and show the table. Longpressing on the table, again, should hide the table and show the movie back.

playerView3 = [[UIView alloc] init];
[playerView3 addGestureRecognizer:tap3];
[playerView3 addGestureRecognizer:longPress3];
[playerView3 setFrame:CGRectMake(682, 0, 341, 768)];
[self.view addSubview:playerView3];    

[self table3:CGRectMake(682, 0, 341, 768)];
[playerView3 addSubview:table3];
[table3 setHidden:YES]; 
[table3 setTag:3];

NSURL *url3 = [[NSBundle mainBundle] URLForResource:@"3" withExtension:@"MOV"];
AVURLAsset *asset3 = [AVURLAsset URLAssetWithURL:url3 options:nil];
AVPlayerItem *playerItem3 = [AVPlayerItem playerItemWithAsset:asset3];
player3 = [AVPlayer playerWithPlayerItem:playerItem3];
[player3 setActionAtItemEnd:AVPlayerActionAtItemEndNone];
playerLayer3 = [AVPlayerLayer playerLayerWithPlayer:player3];
[playerView3.layer addSublayer:playerLayer3];
playerLayer3.frame = playerView3.layer.bounds;
playerLayer3.videoGravity = AVLayerVideoGravityResizeAspect;

Here’s the action method for longpressing:
if (!(sender.state == UIGestureRecognizerStateBegan))
return;

if([playerLayer3 isHidden])
{    
    [playerLayer3 setHidden:NO];
    [table3 setHidden:YES];
}
else
{
    [playerLayer3 setHidden:YES];
    [table3 setHidden:NO];
}  

Note that I am giving the same frame values for both the table and the movie. But I get them in different areas of the screen! Can someone guide me what’s going wrong?

Here are some screenshots:

The movie, before the longpress, at its expected location of (341, 0, 341, 768)
The movie, before the longpress, at its expected location of (341, 0, 341, 768)

After the longpress, the table is here (at an unexpected location) DESPITE HAVING THE SAME FRAME VALUE as the movie (341, 0, 341, 768)
After the longpress, the table is here (at an unexpected location) DESPITE HAVING THE SAME FRAME VALUE as the movie (341, 0, 341, 768)

Now, If I am having a new frame value of (682, 0, 341, 768) for the movie:
Now, I am having a new frame value of (682, 0, 341, 768)

The table is not even seen for this frame (682, 0, 341, 768) after the longpress:
The table is not even seen for this frame (682, 0, 341, 768) after the longpress

Any help is greatly appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T23:42:09+00:00Added an answer on May 31, 2026 at 11:42 pm

    Frames are with respect to its super view. You have added playerview3 to self.view and table3 to playerview3.

    If you want to keep the frame same, you should add the table to self.view only. It means

    [playerView3 addSubview:table3];
    

    above line should be changed with

    [self.view addSubview:table3];
    

    And if you want to add table3 to playerView3 then, its frame should start with 0,0 and not with 682,0.

    Hope it will help.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here is the piece of code which I use to get the count from
Here is some code I made :) @echo off set source=R:\Contracts\ set destination=R:\Contracts\Sites\ ROBOCOPY
Here my code: $(document).ready(function() { $('#mid_select').live('click', function(e){ $('#middle').load( $(this).attr('href') + ' #middle'); var page
Here is an example: I write html code inside of textarea, then I swap
Here's my code. It tries to load Leaflet library. When I turn crossDomain option
Here is my code...I have two dimensional matrices A,B. I want to develop the
Here is my code sample, let me know if it can be further improved?
Here is my code (Say we have a single button on the page that
here are 2 screen shots when i try to debug my code in visual
Here a simple question : What do you think of code which use try

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.