I am using Flurry in my iOS app, to display banner ads as follows:
self.flurryBanner = [[FlurryAdBanner alloc] initWithSpace:#"FlurryBanner"];
self.flurryBanner.adDelegate = self;
[self.flurryBanner fetchAdForFrame:self.view.frame];
while I can find documentation in AdMob to hide banner (setHidden = YES), I could not find any information on how to do so. Any ideas for a good practice?
You can do it like this
UIView *flurryContainer = [[UIView alloc] initWithFrame:CGRectMake(0, 150, self.view.frame.size.width, 50)];
[self.view addSubview:flurryContainer];
[self.flurryBanner displayAdInView:flurryContainer viewControllerForPresentation:self];
And then flurryContainer.hidden = YES;
Related
This is the code that is provided from FB but this ad is placed on the top banner and I would like it fit to the bottom banner. Is there an easy fix to change the location for the FB ads? Also, the implementation is working and test ads are running.
-(void)viewDidLoad
{
[super viewDidLoad];
FBAdView *adView = [[FBAdView alloc] initWithPlacementID:YOUR_PLACEMENT_ID
adSize:kFBAdSizeHeight50Banner
rootViewController:self];
[adView loadAd];
[self.view addSubview:adView];
}
You can move the banner by changing its frame like this:
FBAdView *adView = [[FBAdView alloc] initWithPlacementID:YOUR_PLACEMENT_ID
adSize:kFBAdSizeHeight50Banner
rootViewController:self];
adView.frame = CGRectMake(0, self.view.frame.size.height-adView.frame.size.height, adView.frame.size.width, adView.frame.size.height);
[adView loadAd];
[self.view addSubview:adView];
On my app, I am trying to initialise and present a UIImagePickerViewController instance of custom size. Basically, I want a square view of size 200x200 to hover over my viewController. I tried out the following code and it still presents the camera overlay in full-screen mode. Any suggestions on how I can achieve a custom frame on my overlay view?
UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.modalPresentationStyle = UIModalPresentationCurrentContext;
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePickerController.delegate = self; imagePickerController.showsCameraControls = NO;
imagePickerController.cameraOverlayView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
[self presentViewController:imagePickerController animated:NO completion:nil];
Any help is appreciated.
You need use cameraOverlayView property. Set to this property your custom view that contains transparent square of size 200x200.
Notice to code that you've provided:
When you create view [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)]; it uses clear (transparent) colour by default. That's why you don't see it after launching.
Change it's background colour and it will become visible over the camera layer:
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 200)];
view.backgroundColor = [UIColor redColor];
imagePickerController.cameraOverlayView = view;
You need to look at Face Detection enabling for ios and its API in Apple developer library.
CoreImageFramework provides the API where on detection you can hover .
CIImageFilter, CIFilter methods are used
for Reference please read Apple Documentation and Check the following sample
Square Cam
Using UIImagePIckerController Its Difficult to overlay and Hover on move , Use AVFoundation framework for better Results
i have added all the required files and frameworks for integrating admob. The problem is that it does not add the subview to the viewcontroller.
My viewcontroller consist of a navigation bar and a UITableView. What i want to achieve is to have a admob in the button of my viewcontroller. How can i achieve this.
At the moment i'm using following code, which is not doing anything and not giving me any errors:
bannerView_.adUnitID = #"Banner Key";
bannerView_.rootViewController = self;
[self.view addSubview:bannerView_];
[bannerView_ loadRequest:[GADRequest request]];
Perhaps you need to set the frame of the banner as well?
1 must set the frame of ad banner so that it can be displayed:
m_bannerView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];
m_bannerView.adUnitID = #"AD Unit ID";
m_bannerView.rootViewController = self;
m_bannerView.delegate = self;
m_bannerView.frame = CGRectMake(0, 64, 320, 50); // 64 = height of navigation bar
GADRequest *request = [GADRequest request];
[self.view addSubview:m_bannerView];
[m_bannerView loadRequest:request];
You can set the origin points of the adBanner like below.
self.adBanner = [[GADBannerView alloc]initWithAdSize:kGADAdSizeBanner
origin:CGPointMake(0,31)];
self.adBanner.adUnitID = #"YOUR_KEY";
self.adBanner.delegate = self;
self.adBanner.rootViewController = self;
[self.view addSubview:self.adBanner];
[self.adBanner loadRequest:[self request]];
I'm trying to integrate AdMob into an app on iOS 7 and I can not seem to get the banner to show. I have read the other questions pertaining to this issue and they don't seem to have any good information. Here is the code I'm using:
AdMob = [[GADBannerView alloc] initWithFrame:CGRectMake(0, self.view.frame.size.height - GAD_SIZE_320x50.height, GAD_SIZE_320x50.width, GAD_SIZE_320x50.height)];
//AdMob.frame = CGRectMake(0, self.view.frame.size.height - GAD_SIZE_320x50.height, GAD_SIZE_320x50.width, GAD_SIZE_320x50.height);
AdMob.adUnitID = #"MYAPPID";
AdMob.rootViewController = self;
AdMob.delegate = self;
[self.view addSubview:AdMob];
GADRequest *r = [[GADRequest alloc] init];
r.testDevices = [NSArray arrayWithObjects:#"MYDEVICEID", nil];
r.testing = YES;
[AdMob loadRequest:r];
I've tested on simulator and on device with no luck.
What I want to achieve is a UISearchBar that moves up and covers the UINavBar, and contains a cancel button on the right of it. All goes well, until I use the following line of code:
searchDC = [[[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self] autorelease];
What ends up happening is the UITableView just won't scroll, but everything else functions as expected. If I remove that line, my nav bar is visible, and the search bar just sits below it, also lacking a cancel button.
Any ideas?
The code for drawing the search bar is:
self.navigationItem.title = #"Search";
searchBar = [[[UISearchBar alloc] initWithFrame:CGRectMake(0.0f, 0.0f, self.view.bounds.size.width, 44.0f)] autorelease];
searchBar.autocorrectionType = UITextAutocorrectionTypeNo;
searchBar.autocapitalizationType = UITextAutocapitalizationTypeNone;
searchBar.keyboardType = UIKeyboardTypeAlphabet;
searchBar.delegate = self;
[searchBar becomeFirstResponder];
tableView.tableHeaderView = searchBar;
tableView.tableHeaderView.frame = CGRectMake(0.f, 0.f, 480.f, 44.f);
searchDC = [[[UISearchDisplayController alloc] initWithSearchBar:searchBar contentsController:self] autorelease];
searchDC.searchResultsDataSource = self;
searchDC.searchResultsDelegate = self;
searchDC.searchResultsTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
searchDC.searchResultsTableView.scrollEnabled = YES;
overlayView.frame = CGRectMake(0, 50, 320, 480);
[self.view addSubview:overlayView];
[self.view bringSubviewToFront:overlayView];
Not enough information to answer this. You need to show the UIViewController or UINavigation Controller code (both the .h and .m) where you are setting up the UISearchDisplayController.
EDIT:
You're implementing this totally wrongly. Apple has a great example on how to implement this http://developer.apple.com/iphone/library/samplecode/TableSearch/Introduction/Intro.html
From Apple's Documentation,
Delegate for the search display controller (delegate), which responds to events such the starting or ending of a search, and the showing or hiding of the search interface.
Set the delegate to your UITableViewController
searchDC.delegate = self;
Also add the searchDC's searchBar to the tableView's headerView
[self.tableView setTableHeaderView:searchDC.searchBar];