I'm using xcode and I have a tabbarcontroller with multiple views.
I just added admob and added the ads to each view (in - (void)viewDidLoad) using this code:
AdViewController *myAdsVC = [[AdViewController alloc] init];
[self.view addSubview: myAdsVC.view];
AdViewController is the admob view.
The problem is, when the ad shows up, half the screen can't be used. The app runs fine, but the middle of the screen can't click, scroll, or do anything. I can scroll above and below the space.
i've attached an image showing the space that is frozen.
http://i.imgur.com/fN95g.png
You should try setting the frame of the myAdsVC to something like:
myAdsVC.view.frame = CGRectMake(0, 0, 320, 50);
Related
Summary
If the contents of a Frame spill over the edge and if the frame has a border, the frame's border draw on top of the contents on iOS, but below the contents on Android. Is it possible to make the iOS border draw below the contents?
Details
I suspect this may be a bug in Xamarin.Forms, or maybe even the expected behavior on iOS, but nonetheless it is causing problems in my application visuals so I'd like to fix it if possible.
The following code reproduces the problem:
var frameInstance = new Frame();
var grid = new Grid();
AbsoluteLayout.SetLayoutBounds(frameInstance, new Rectangle(58f, 103f, 222f, 304f));
AbsoluteLayout.SetLayoutFlags(frameInstance, AbsoluteLayoutFlags.None);
frameInstance.WidthRequest = 222f;
frameInstance.HeightRequest = 304f;
frameInstance.IsClippedToBounds = false;
frameInstance.HasShadow = false;
frameInstance.CornerRadius = 10;
frameInstance.BorderColor = Color.Gray;
absoluteLayout.Children.Add(frameInstance);
grid.HeightRequest = 42f;
grid.Margin = new Thickness(-32, -32, 0, 0);
grid.HorizontalOptions = LayoutOptions.Fill;
grid.VerticalOptions = LayoutOptions.Start;
grid.BackgroundColor = Color.Red;
frameInstance.Content = grid;
Notice that the frame is hosted in an AbsoluteLayout, but this is not necessary, it can be hosted in any top-level layout object in the page. The important thing is that the frame is offset from the top-left of the page so the contents of the frame can spill over and be seen clearly.
When running On iOS, the code above produces the following image:
If the code is run on Android, it produces the following image:
Is it possible to somehow suppress the rendering of the iOS frame on top of the contents, perhaps through a renderer?
The reason I need to solve this is because my app's login page has an icon which sits halfway over a frame, as shown in the following image (on iOS):
ive attached rough draft images of what im trying to do. basically push that menu button, the menu (yellow) appears, push it again and it goes away. but it just jumps out, and i would like it to slide out and in, in an animated fashion. all the libraries and resources i've found on this tend to use swift. any way to do this using IOS that is recommendable?
You can use the library CoreAnimation.Change Frame of menu in some seconds.Refer the following code
push out the menu
UIView.Animate(0.8, () =>
{
CGRect outRect= new CGRect(0, menuView.Frame.Y, menuView.Frame.Width, menuView.Frame.Height);
menuView.Frame = pushRect;
});
push in the menu
UIView.Animate(0.8, () =>
{
CGRect inRect = new CGRect(20- menuView.Frame.Width, menuView.Frame.Y, menuView.Frame.Width, menuView.Frame.Height);
menuView.Frame = inRect;
});
0.8 in the durtaion of the Animation.
I use this code as mentioned in document of play services for Unity3d.
BannerView bannerView = new BannerView(adUnitId, adSize, AdPosition.Bottom);
The code works, but here is the problem:
For Samsung phones I do not have any problem because, back-home buttons are not on screen. But I have another physical device for testing: LG
For Lg, I got a problem. Back, home etc buttons on screen, so when I use AdPosition.Bottom, It deploys it in bottom but make a space for buttons. So it is not appear in exact bottom.
Do you have suggestions?
I'm trying to test a swipe across an image gallery on a responsive website. On a mobile device it would be a finger swipe, using a desktop browser it functions the same with a mouse click/hold/drag. It's the desktop browser functionality I'm trying to replicate.
The code I have is:
Driver.Navigate().GoToUrl(Properties.Settings.Default.TestPage);
var mainImage = Driver.FindElement(By.CssSelector(".main-image"));
var imageAcross = (mainImage.Size.Width / 4 ) * 3;
var imageDown = mainImage.Size.Height/2;
var builder = new Actions(Driver);
builder.MoveToElement(mainImage, imageAcross, imageDown).ClickAndHold().Build().Perform();
TakeScreenshot(TestContext.CurrentContext.Test.Name);
builder.MoveByOffset(-imageDown, 0).Release().Build().Perform();
TakeScreenshot(TestContext.CurrentContext.Test.Name);
The TakeScreenshot function, as the name suggests, saves a screenshot. I take one before and after the move.
The first builder.MoveToElement places the cursor where I would expect and after the builder.MoveByOffset the cursor has moved as expected. However the swipe didn't change the gallery image. It's as if the ClickAndHold was ignored.
The CSS element .main-image is a div tag that has Javascript attached that changes an image within it on the swipe. The browser I'm using for testing is PhantomJS.
Is there something I am doing wrong? Or any suggestions on how to get the swipe to work?
I have a user control with a WPF MediaElement and an Image control. This user control is again used in a few more user control which uses this in two differnt layouts. The application is supposed to show a list of videos and images for a long period of time in loops. Each user control will be loaded for a particular time period and after that time, this will be unloaded and the next control will be loaded. When the videos are running every now and then the position of the video is changed to show a particular part of the video.
XAML Code. The MediaElement is inside a Grid with one column and one row.
<MediaElement Volume="0" Name="m1" Stretch="Fill" Visibility="Hidden" LoadedBehavior="Manual" UnloadedBehavior="Manual" />
C# Code, setting source
this.mediaElement.Source = item.Path;
this.mediaElement.Position = new TimeSpan(0, 0, 0);
this.mediaElement.Play();
C# Code changing position. This position change is done using a DispatcherTimer
t = TimeSpan.FromMilliseconds(Position);
mediaElement.Position = t;
C# Code disposing the MediaElement. I use this code to dispose the MediaElement because previously I found out after playing for a while the MediaElement was using too much memory and becomes frozen after a while.. The below code fixed that issue.
mediaElement.Close();
mediaElement = null;
GC.Collect();
GC.WaitForPendingFinalizers();
The application works fine, but the problem is after some time (like 20 mins) the WPF MediaElement disappears. The application works smoothly (It doesn't get frozen), the images are shown, but the MediaElement is gone.
When this problem occurred, I did some debugging and found these.
The WPF MediaElement visibility is Visible. The Source has correct filenames. The MediaElement is not hidden behind any other controls.
However the actual width and actual height are shown as 0.
I checked all the code to find out where the height and width becomes zero. But could not find any. So I decided to try and override the Height and Width evey millisecond using a DispatcherTimer (Just to check if it was possible). But even then the 0 in actual height and width remained the same.
Also, the application doesn't seem to use excessive memory and everything else seems to be fine.
Does anyone got a clue as to why this is happening? Any solutions or workarounds? Thanks