I have two different UIViews(on View controller's top and bottom) in same Viewcontroller,and i need to show same Ad in both UIViews. Currently i am adding GADBanner view object in both UIView as subview in that case only 2nd View in which added Google ad is display andn ot first one.is there any way to do that?
like there is 2 UIView, viewTop and viewBottom,
i have GADBannerView *adBannerView ;
adBannerView initialization ,give Id and all process.....
Then, i am doing ,
[viewTop addSubview : adBannerView];
[viewBottom addSubview : adBannerView];
but it is adding only in viewBottom and not in viewTop.
Please help me if anyone know about it.
Related
I am trying to figure out how to make/design an app that navigates similar to the appstore where the first row is a set of pictures you swipe horizontally then you have like a list of table value. How would i go about doing this ?
You would use a Container View with a UICollectionViewController, a UITableViewController or implement your own custom UIScrollView
I have been working on a project where I needed to show list of images with zoom / swipe feature as presented view modal. I created custom ImageViewer using ContainerView in which I have added UIPageViewController. And on demand, I added ImageViews over the UIPageViewcontroller's view. When user taps to imageView, the top UINavigation gets shown and hidden on toggle basis.
Everything worked as expected in iOS 7.1 and less. However when I tested the functionality in iOS 8 devices and simulator, the ImageViews were not added to UIPageViewController in TopLeft ( beneath UINavigationBar ). It is added below the NavigationBar as shown in bug_iOS_8.png below.
Once I touch the buggy view, it repositions itself to correct position as in image expected.png below.
I have created and tested the issue in sample project and it seems it is bug in iOS 8 itself with UIPageViewController. I went through couple of questions regarding weird behavior of UIPageViewController too. Please check the sample app here and kindly let me know if anyone has any hints on what is going on.
Thank you for your time and help.
PS: BTW I am using following version of Xcode.
Update 1:
I have tried as per the pin suggestions. However, the problem aligning is with the main view of UIViewController rather than its subview. In below image, Yellow is main View of UIViewController and red one is added subview, I added pin to "red" on in reference to superview "yellow" one. Please check following screen shots.
On startup.
After touch on screen.
Kind Regards,
check in storyboard for particular viewController and make sure Extended Edges >> Under top bars is not selected.
I had a very similar issue and the way i fixed it was select the view being added to the UIPageViewController in the storyboard and selected the pin options. Below in the image you can see the Constrain to margins options, make sure you unselect that. Also when choosing what view to pin it to make sure you select the superview and not the Top Layout Guide.
Curious are you hiding your nav controller like this?
[self.navigationController setNavigationBarHidden:YES];
also if you have multiple Nav controllers, you might need to check you are referencing the correct one.
If you want it to be hidden when you present the ViewController you should move it to
-(void) ViewWillAppear{
}
I am attempting to implement a UIScrollView with a UIPageControl following the guide on this website:
http://www.iosdevnotes.com/2011/03/uiscrollview-paging/
In opposite to the guide, I am implementing this in a storyboard project, and using XCode4.5.2. In addition to the code in the guide, I have added at the beginning of the #interface, and inside the viewDidLoad method in the implementation, I have added scrollView.delegate = self.
With only the code and IB-objects described in the guide added to my app, it doesn't allow me to scroll at all when I test it on my iPhone. The only scrolling i can do is by swiping my finger over the UIPageControl, which makes the "white dot" in the PageControl move one spot towards the direction I was swiping, and with no visible changes in the ScrollView. In the guide we add different colours to the backgrounds of the views in the scrollView -- none of these colours show up at all.
I have tried debugging by putting NSLogs in my code to see what methods are reached by the app. Adding an NSLog (#"View did load"); right after [super viewDidLoad]; in the viewDidLoad method atop the main view controller doesn't output anything to the terminal. Does this mean my app doesn't load up properly?
Thanks in advance!
Do you have multiple pages added to the scrollView? Scrolling is default off if you only have one page worth of content. Ensure that the loadScrollView method is called and also add this:
scrollView.pagingEnabled=YES;
If you are interested I created this class for paging with the scrollview
https://github.com/andrealufino/ALScrollViewPaging
I'd like to know how to manage objects plans.
I explain my issue :
I have a UITextField and a Label, and I'm trying to place the label behind the TextField in the view, but anything to do, the Label stay visible and in front of the TextField, How to change the plan position of object into a view ?
Every visible objects in a UIView is a subclass of UIView and all UIViews have the method brigSubviewtoFront because so:
[self.view bringSubviewToFront:textField];
My app consists of a TabBar and several TableViews. I want to have the AdWhirl-banner fixed just above the TabBar (only in the first TableView), but thus far I have not been succeeding.
Until now, I have implemented the following code into my TableViewController:
AdWhirlView *adWhirlView = [AdWhirlView requestAdWhirlViewWithDelegate:self];
[self.tableView addSubview:adWhirlView];
adWhirlView.center = CGPointMake(160, 342);
And it indeed shows the Ad i want to see, only it is partly covered by a section header (from the TableView), and when scrolling the Ad scrolls along.
How can I achieve that the Ad is both on top (in terms of top view) and at a fixed spot (above the TabBar)?
Any help is greatly appreciated!
You need to add it to the tabBar layer.
Try this:
[self.tabBarController.view addSubview:adWhirlView];
You may need to reposition it do it's not underneath the tabbar.
I also add a footer to the tables so they can be scrolled all the way up without the ad getting in the way.
You will likely need to create your own subclass of UIViewController, adding instances of both the AdWhirlView and UITableView to its view, either programatically, or in the nib file.
Anthoer, hackier way to do this would be to add the AdWhirlView as a header view in the existing table, but I'd opt for the first way. It will give you more control over how you want it to look and behave.
I'd think another alternative here would be to have a container UIView that contains both a UITTabBar which contains a UITableView. If you're on the right tab, you could just request an ad. If the request is successful, just shrink the tabbed view enough to make room for the ad at the top and insert it into the container UIView.