切换主视图
hi , 我想改变这个例子程序的主视图,appui代码里,我自己建立了一个view实例,在下面倒数第四行,我改的ActivateLocalViewL( viewSel->Id() );
,但是显示的还是原来的viewMain视图,请问我是不是没改对?
==========================================================================
void CAknExGridAppUi::ConstructL()
{
//BaseConstructL();
BaseConstructL( EAknEnableSkin );
// Create a main view
CAknExGridView* viewMain = CAknExGridView::NewL();
AddViewL( viewMain ); // transfer ownership to CAknViewAppUi
// I Create a view for selection grid
CAknExGridViewAsSelection* viewSel =
CAknExGridViewAsSelection::NewL();
AddViewL( viewSel ); // transfer ownership to CAknViewAppUi
// Show tabs for main views from resources
CEikStatusPane *sp = StatusPane();
// Fetch pointer to the default navi pane control
iNaviPane = (CAknNavigationControlContainer*)sp->ControlL(
TUid::Uid( EEikStatusPaneUidNavi ) );
iDecoratedTabGroup = iNaviPane->ResourceDecorator();
if ( iDecoratedTabGroup )
{
iTabGroup = ( CAknTabGroup* ) iDecoratedTabGroup->DecoratedControl();
}
// set a view
if ( iTabGroup )
{
ActivateLocalViewL( TUid::Uid( iTabGroup->ActiveTabId() ) );
}
else // just in case
{
ActivateLocalViewL( viewSel->Id() );
//ActivateLocalViewL( viewMain->Id() );
}
}
[解决办法]
Try:
if ( iTabGroup )
{
ActivateLocalViewL( viewSel->Id() );
}