[splitview] updated for iOS5.1

specifically this 'bug'
https://bugzilla.xamarin.com/show_bug.cgi?id=3803
This commit is contained in:
Craig Dunn 2012-07-09 10:55:54 +10:00
Родитель 69d05bafbf
Коммит ca2e892391
3 изменённых файлов: 28 добавлений и 5 удалений

Просмотреть файл

@ -2,18 +2,24 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDisplayName</key>
<string>SplitView</string>
<key>CFBundleIconFiles</key>
<array>
<string>Images/Icons/72_icon.png</string>
<string>Images/Icons/50_icon.png</string>
<string>Images/Icons/29_icon.png</string>
<string>Images/Icons/512_icon.png</string>
</array>
<key>CFBundleIdentifier</key>
<string>com.xamarin.samples.splitview</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>MinimumOSVersion</key>
<string>4.0</string>
<key>UIDeviceFamily</key>
<array>
<string>2</string>
<integer>2</integer>
</array>
<key>UISupportedInterfaceOrientations</key>
<array>

Просмотреть файл

@ -15,9 +15,7 @@ namespace Example_SplitView.Screens.MainSplitView
masterView = new Screens.MasterView.MasterTableView ();
detailView = new Screens.DetailView.DetailViewScreen ();
// create an array of controllers from them and then assign it to the
// controllers property
ViewControllers = new UIViewController[] { masterView, detailView };
// in this example, i expose an event on the master view called RowClicked, and i listen
// for it in here, and then call a method on the detail view to update. this class thereby
@ -37,6 +35,19 @@ namespace Example_SplitView.Screens.MainSplitView
this.WillShowViewController += (object sender, UISplitViewShowEventArgs e) => {
detailView.RemoveContentsButton ();
};
// this method was introduced in iOS5
// return true to hide the master list (can still be 'dragged out') or false to force it to show
this.ShouldHideViewController = (svc, vc, orientation) => {
return orientation == UIInterfaceOrientation.Portrait || orientation == UIInterfaceOrientation.PortraitUpsideDown;
};
// ALWAYS SET THIS LAST (since iOS5.1)
// https://bugzilla.xamarin.com/show_bug.cgi?id=3803
// http://spouliot.wordpress.com/2012/03/26/events-vs-objective-c-delegates/
// create an array of controllers from them and then assign it to the
// controllers property
ViewControllers = new UIViewController[] { masterView, detailView };
}
}
}

Просмотреть файл

@ -23,6 +23,7 @@
<ConsolePause>false</ConsolePause>
<MtouchLink>None</MtouchLink>
<MtouchI18n />
<MtouchArch>ARMv7</MtouchArch>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
<DebugType>none</DebugType>
@ -46,6 +47,9 @@
<ConsolePause>false</ConsolePause>
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchI18n />
<MtouchArch>ARMv7</MtouchArch>
<IpaPackageName />
<CrashReportingApiKey />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
<DebugType>none</DebugType>
@ -98,10 +102,12 @@
<Content Include="Images\Icons\58_icon.png" />
<Content Include="Images\Icons\72_icon.png" />
<Content Include="Images\Icons\114_icon.png" />
<Content Include="Images\Icons\512_icon.png" />
<Content Include="Default-Landscape~ipad.png" />
<Content Include="Default-Portrait~ipad.png" />
<Content Include="Default.png" />
<Content Include="Default%402x.png" />
</ItemGroup>
<ItemGroup>
<ITunesArtwork Include="Images\Icons\512_icon.png" />
</ItemGroup>
</Project>