Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-6721] iOS: Ti.UI.iOS.AdView does not properly support landscape settings

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2012-01-23T16:19:21.000+0000
Affected Version/sRelease 1.8.0.1
Fix Version/sSprint 2011-50, Release 2.0.0, Release 1.8.1
ComponentsiOS
Labelsn/a
ReporterStephen Tramer
AssigneeStephen Tramer
Created2011-12-16T13:23:33.000+0000
Updated2012-03-02T12:26:00.000+0000

Description

It appears that our code for handling iAd size settings is incorrect. We can run the following test to confirm/deny:
// this sets the background color of the master UIView (when there are no windows/tab groups on it)
Titanium.UI.setBackgroundColor('#000');

// create tab group
var tabGroup = Titanium.UI.createTabGroup();

//
// create base UI tab and root window
//
var win1 = Titanium.UI.createWindow({ title:'Tab 1', backgroundColor:'#fff' });
win1.orientationModes = [
	Titanium.UI.LANDSCAPE_RIGHT,
	Titanium.UI.LANDSCAPE_LEFT,
	Titanium.UI.PORTRAIT
];

var tab1 = Titanium.UI.createTab({ icon:'KS_nav_views.png', title:'Tab 1', window:win1 });

var label1 = Titanium.UI.createLabel({
	color:'#999',
	text:'I am Window 1',
	font:{fontSize:20,fontFamily:'Helvetica Neue'},
	textAlign:'center',
	width:'auto'
});

win1.add(label1);
var adView = Ti.UI.iOS.createAdView({ 
	width: 'auto', 
	height: 'auto', 
/*	
	backgroundColor: 'red', 
	backgroundImage: 'none', 
*/
	bottom:0, 
	zIndex:100 
});
adView.addEventListener('load', function(){ alert('iad loaded'); });
win1.add(adView);
adView.show();

//
// create controls tab and root window
//
var win2 = Titanium.UI.createWindow({ title:'Tab 2', backgroundColor:'#fff' });
var tab2 = Titanium.UI.createTab({ icon:'KS_nav_ui.png', title:'Tab 2', window:win2 });

var label2 = Titanium.UI.createLabel({
	color:'#999',
	text:'I am Window 2',
	font:{fontSize:20,fontFamily:'Helvetica Neue'},
	textAlign:'center',
	width:'auto'
});

win2.add(label2);

//
// add tabs
//
tabGroup.addTab(tab1); 
tabGroup.addTab(tab2);

Ti.Gesture.addEventListener('orientationchange', function(e) {
	if (e.orientation == Ti.Gesture.UPSIDE_PORTRAIT ||
		e.orientation == Ti.Gesture.PORTRAIT) {
		
		adView.adSize = Ti.UI.iOS.AD_SIZE_PORTRAIT;
	}
	else if (e.orientation == Ti.Gesture.LANDSCAPE_LEFT ||
			 e.orientation == Ti.Gesture.LANDSCAPE_RIGHT) {
			 
		adView.adSize = Ti.UI.iOS.AD_SIZE_LANDSCAPE;
	}
});

// open tab group
tabGroup.open();

Comments

  1. Michael Pettiford 2012-01-12

    Closing issue Tested with Ti Studio 1.0.8.201201101928 Ti Mob SDK 1.9.0.v20120111233134 OSX Lion iPhone 4S, iPad 2 Expected behavior of iAD rotating and displaying correctly in landscape is shown
  2. Neeraj Gupta 2012-01-23

    Reopening and closing this issue to update label and Fix Version field.

JSON Source