Skip to content
This repository was archived by the owner on Apr 29, 2024. It is now read-only.

Commit 1f424db

Browse files
committed
GrowRowTable Sample
Added sample project for Auto-Sizing Row Height example for GitHub defect #682.
1 parent 71c1145 commit 1f424db

34 files changed

+961
-0
lines changed

GrowRowTable/GrowRowTable.sln

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 2012
4+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GrowRowTable", "GrowRowTable\GrowRowTable.csproj", "{CDE770F2-026E-4F7B-B8EC-ADAC4AB8C932}"
5+
EndProject
6+
Global
7+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8+
Debug|iPhoneSimulator = Debug|iPhoneSimulator
9+
Release|iPhone = Release|iPhone
10+
Release|iPhoneSimulator = Release|iPhoneSimulator
11+
Debug|iPhone = Debug|iPhone
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{CDE770F2-026E-4F7B-B8EC-ADAC4AB8C932}.Debug|iPhone.ActiveCfg = Debug|iPhone
15+
{CDE770F2-026E-4F7B-B8EC-ADAC4AB8C932}.Debug|iPhone.Build.0 = Debug|iPhone
16+
{CDE770F2-026E-4F7B-B8EC-ADAC4AB8C932}.Debug|iPhoneSimulator.ActiveCfg = Debug|iPhoneSimulator
17+
{CDE770F2-026E-4F7B-B8EC-ADAC4AB8C932}.Debug|iPhoneSimulator.Build.0 = Debug|iPhoneSimulator
18+
{CDE770F2-026E-4F7B-B8EC-ADAC4AB8C932}.Release|iPhone.ActiveCfg = Release|iPhone
19+
{CDE770F2-026E-4F7B-B8EC-ADAC4AB8C932}.Release|iPhone.Build.0 = Release|iPhone
20+
{CDE770F2-026E-4F7B-B8EC-ADAC4AB8C932}.Release|iPhoneSimulator.ActiveCfg = Release|iPhoneSimulator
21+
{CDE770F2-026E-4F7B-B8EC-ADAC4AB8C932}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
22+
EndGlobalSection
23+
EndGlobal
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
using Foundation;
2+
using UIKit;
3+
4+
namespace GrowRowTable
5+
{
6+
// The UIApplicationDelegate for the application. This class is responsible for launching the
7+
// User Interface of the application, as well as listening (and optionally responding) to application events from iOS.
8+
[Register ("AppDelegate")]
9+
public class AppDelegate : UIApplicationDelegate
10+
{
11+
// class-level declarations
12+
13+
public override UIWindow Window {
14+
get;
15+
set;
16+
}
17+
18+
public override bool FinishedLaunching (UIApplication application, NSDictionary launchOptions)
19+
{
20+
// Override point for customization after application launch.
21+
// If not required for your application you can safely delete this method
22+
23+
return true;
24+
}
25+
26+
public override void OnResignActivation (UIApplication application)
27+
{
28+
// Invoked when the application is about to move from active to inactive state.
29+
// This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message)
30+
// or when the user quits the application and it begins the transition to the background state.
31+
// Games should use this method to pause the game.
32+
}
33+
34+
public override void DidEnterBackground (UIApplication application)
35+
{
36+
// Use this method to release shared resources, save user data, invalidate timers and store the application state.
37+
// If your application supports background exection this method is called instead of WillTerminate when the user quits.
38+
}
39+
40+
public override void WillEnterForeground (UIApplication application)
41+
{
42+
// Called as part of the transiton from background to active state.
43+
// Here you can undo many of the changes made on entering the background.
44+
}
45+
46+
public override void OnActivated (UIApplication application)
47+
{
48+
// Restart any tasks that were paused (or not yet started) while the application was inactive.
49+
// If the application was previously in the background, optionally refresh the user interface.
50+
}
51+
52+
public override void WillTerminate (UIApplication application)
53+
{
54+
// Called when the application is about to terminate. Save data, if needed. See also DidEnterBackground.
55+
}
56+
}
57+
}
58+
59+
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
using System;
2+
3+
namespace GrowRowTable
4+
{
5+
public class GrowItem
6+
{
7+
#region Computed Properties
8+
public string ImageName { get; set; } = "";
9+
public string Title { get; set; } = "";
10+
public string Description { get; set; } = "";
11+
#endregion
12+
13+
#region Constructors
14+
public GrowItem ()
15+
{
16+
}
17+
18+
public GrowItem (string imageName, string title, string description)
19+
{
20+
// Initialize
21+
this.ImageName = imageName;
22+
this.Title = title;
23+
this.Description = description;
24+
}
25+
#endregion
26+
27+
}
28+
}
29+
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using UIKit;
4+
5+
namespace GrowRowTable
6+
{
7+
public class GrowRowTableDataSource : UITableViewDataSource
8+
{
9+
#region Private Variables
10+
private GrowRowTableViewController Controller;
11+
#endregion
12+
13+
#region Computed Properties
14+
public List<GrowItem> Items = new List<GrowItem>();
15+
16+
public string CellID {
17+
get { return "GrowCell"; }
18+
}
19+
#endregion
20+
21+
#region Constructors
22+
public GrowRowTableDataSource ()
23+
{
24+
// Initialize
25+
Initialize();
26+
}
27+
28+
public GrowRowTableDataSource (GrowRowTableViewController controller)
29+
{
30+
// Initialize
31+
this.Controller = controller;
32+
Initialize();
33+
}
34+
35+
private void Initialize() {
36+
37+
// Populate database
38+
Items.Add(new GrowItem("Macintosh_128k.png","Macintosh 128K","The Macintosh 128K, originally released as the Apple Macintosh, is the original Apple Macintosh personal computer. Its beige case consisted of a 9 in (23 cm) CRT monitor and came with a keyboard and mouse. A handle built into the top of the case made it easier for the computer to be lifted and carried. It had an initial selling price of $2,495 (equivalent to $5,683 in 2015)."));
39+
Items.Add(new GrowItem("Macintosh_512K.png","Macintosh 512K","The Macintosh 512K Personal Computer is the second of a long line of Apple Macintosh computers, and was the first update to the original Macintosh 128K. It was virtually identical to the previous Mac, differing primarily in the amount of built-in memory (RAM)."));
40+
Items.Add(new GrowItem("Macintosh_Plus.jpg","Macintosh Plus","The Macintosh Plus computer is the third model in the Macintosh line, introduced on January 16, 1986, two years after the original Macintosh and a little more than a year after the Macintosh 512K, with a price tag of US$2599. As an evolutionary improvement over the 512K, it shipped with 1 MB of RAM standard, expandable to 4 MB, and an external SCSI peripheral bus, among smaller improvements."));
41+
Items.Add(new GrowItem("Macintosh_SE.jpg","Macintosh SE","The Macintosh SE is a personal computer manufactured by Apple between March 1987 and October 1990. This computer marked a significant improvement on the Macintosh Plus design and was introduced by Apple at the same time as the Macintosh II. It had a similar case to the original Macintosh computer, but with slight differences in color and styling."));
42+
Items.Add(new GrowItem("MacII.jpg","Macintosh II","The Apple Macintosh II is the first personal computer model of the Macintosh II series in the Apple Macintosh line and the first Macintosh to support a color display. A basic system with 20 MB drive and monitor cost about $5500, A complete color-capable system could cost as much as $10,000 once the cost of the color monitor, video card, hard disk, keyboard and RAM were added. "));
43+
Items.Add(new GrowItem("SE30.jpg","Macintosh SE/30","The Macintosh SE/30 is a personal computer that was designed, manufactured and sold by Apple Computer, Inc. from 1989 until 1991. It was the fastest of the original black-and-white compact Macintosh series."));
44+
Items.Add(new GrowItem("Macintosh_Portable.jpg","Macintosh Portable","The Macintosh Portable was Apple Inc.'s first battery-powered portable Macintosh personal computer. Released on September 20, 1989, it was received with excitement from most critics but consumer sales were quite low. It featured a fast, sharp, and expensive black and white active matrix LCD screen in a hinged design that covered the keyboard when the machine was not in use."));
45+
Items.Add(new GrowItem("Macintosh_Classic.jpg","Macintosh Classic","The Macintosh Classic is a personal computer manufactured by Apple Inc. Introduced on October 15, 1990, it was the first Apple Macintosh to sell for less than US$1,000. Production of the Classic was prompted by the success of the Macintosh Plus and the Macintosh SE. The system specifications of the Classic were very similar to its predecessors, with the same 9-inch (23 cm) monochrome CRT display, 512×342 pixel resolution, and 4 megabyte (MB) memory limit of the older Macintosh computers."));
46+
Items.Add(new GrowItem("Macintosh_LC.jpg","Macintosh LC","The Macintosh LC (meaning low-cost color) is Apple Computer's product family of low-end consumer Macintosh personal computers in the early 1990s. The original Macintosh LC was released in October 1990 and was the first affordable color-capable Macintosh. Due to its affordability and Apple II compatibility the LC was adopted primarily in the education and home markets."));
47+
Items.Add(new GrowItem("Powerbook_150.jpg","Powerbook","The PowerBook (known as Macintosh PowerBook before 1997) is a line of Macintosh laptop computers that was designed, manufactured and sold by Apple Computer, Inc. from 1991 to 2006. During its lifetime, the PowerBook went through several major revisions and redesigns, often being the first to incorporate features that would later become standard in competing laptops."));
48+
Items.Add(new GrowItem("Macintosh_Classic_2.jpg","Macintosh Classic II","The Apple Macintosh Classic II (also known as the Performa 200) replaced the Macintosh SE/30 in the compact Macintosh line in 1991. Like the SE/30, the Classic II was powered by a 16 MHz Motorola 68030 CPU and 40 or 80 MB hard disk, but in contrast to its predecessor, it was limited by a 16-bit data bus (the SE/30 had a 32-bit data bus) and a 10 MB memory ceiling."));
49+
Items.Add(new GrowItem("Macintosh_Color_Classic.jpg","Macintosh Color Classic","The Macintosh Color Classic, released on February 10, 1993, is the first color compact Apple Macintosh computer. It has an integrated 10″ Sony Trinitron color display with the same 512×384 pixel resolution as the Macintosh 12″ RGB monitor. It can display 256 colors(Can upgrade to 4096 colors). "));
50+
Items.Add(new GrowItem("Power_Macintosh.jpg","Power Macintosh","Power Macintosh, later Power Mac, is a line of Apple Macintosh workstation-class personal computers based on various models of PowerPC microprocessors that were developed, marketed, and supported by Apple Inc. from March 1994 until August 2006. "));
51+
}
52+
#endregion
53+
54+
#region Override Methods
55+
public override nint NumberOfSections (UITableView tableView)
56+
{
57+
// Hard coded 1 section
58+
return 1;
59+
}
60+
61+
public override nint RowsInSection (UITableView tableView, nint section)
62+
{
63+
return Items.Count;
64+
}
65+
66+
public override UITableViewCell GetCell (UITableView tableView, Foundation.NSIndexPath indexPath)
67+
{
68+
var cell = tableView.DequeueReusableCell (CellID, indexPath) as GrowRowTableCell;
69+
var item = Items [indexPath.Row];
70+
71+
// Setup
72+
cell.Image = UIImage.FromFile(item.ImageName);
73+
cell.Title = item.Title;
74+
cell.Description = item.Description;
75+
76+
return cell;
77+
}
78+
#endregion
79+
}
80+
}
81+
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using System;
2+
using UIKit;
3+
4+
namespace GrowRowTable
5+
{
6+
public class GrowRowTableDelegate : UITableViewDelegate
7+
{
8+
#region Private Variables
9+
private GrowRowTableViewController Controller;
10+
#endregion
11+
12+
#region Constructors
13+
public GrowRowTableDelegate ()
14+
{
15+
}
16+
17+
public GrowRowTableDelegate (GrowRowTableViewController controller)
18+
{
19+
// Initialize
20+
this.Controller = controller;
21+
}
22+
#endregion
23+
24+
#region Override Methods
25+
public override nfloat EstimatedHeight (UITableView tableView, Foundation.NSIndexPath indexPath)
26+
{
27+
return 40f;
28+
}
29+
30+
public override void RowSelected (UITableView tableView, Foundation.NSIndexPath indexPath)
31+
{
32+
// Output selected row
33+
Console.WriteLine("Row selected: {0}",indexPath.Row);
34+
}
35+
#endregion
36+
}
37+
}
38+
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
</dict>
6+
</plist>
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<PropertyGroup>
4+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5+
<Platform Condition=" '$(Platform)' == '' ">iPhoneSimulator</Platform>
6+
<ProjectTypeGuids>{FEACFBD2-3405-455C-9665-78FE426C6842};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
7+
<ProjectGuid>{CDE770F2-026E-4F7B-B8EC-ADAC4AB8C932}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>GrowRowTable</RootNamespace>
10+
<IPhoneResourcePrefix>Resources</IPhoneResourcePrefix>
11+
<AssemblyName>GrowRowTable</AssemblyName>
12+
</PropertyGroup>
13+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhoneSimulator' ">
14+
<DebugSymbols>true</DebugSymbols>
15+
<DebugType>full</DebugType>
16+
<Optimize>false</Optimize>
17+
<OutputPath>bin\iPhoneSimulator\Debug</OutputPath>
18+
<DefineConstants>DEBUG;ENABLE_TEST_CLOUD;</DefineConstants>
19+
<ErrorReport>prompt</ErrorReport>
20+
<WarningLevel>4</WarningLevel>
21+
<ConsolePause>false</ConsolePause>
22+
<MtouchArch>i386</MtouchArch>
23+
<MtouchLink>None</MtouchLink>
24+
<MtouchUseRefCounting>true</MtouchUseRefCounting>
25+
<MtouchUseSGen>true</MtouchUseSGen>
26+
<MtouchFastDev>true</MtouchFastDev>
27+
<MtouchDebug>true</MtouchDebug>
28+
<CodesignKey>iPhone Developer</CodesignKey>
29+
<MtouchProfiling>true</MtouchProfiling>
30+
</PropertyGroup>
31+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
32+
<DebugType>full</DebugType>
33+
<Optimize>true</Optimize>
34+
<OutputPath>bin\iPhone\Release</OutputPath>
35+
<ErrorReport>prompt</ErrorReport>
36+
<WarningLevel>4</WarningLevel>
37+
<ConsolePause>false</ConsolePause>
38+
<MtouchArch>ARMv7, ARM64</MtouchArch>
39+
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
40+
<MtouchFloat32>true</MtouchFloat32>
41+
<MtouchUseSGen>true</MtouchUseSGen>
42+
<CodesignKey>iPhone Developer</CodesignKey>
43+
<MtouchUseRefCounting>true</MtouchUseRefCounting>
44+
</PropertyGroup>
45+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhoneSimulator' ">
46+
<DebugType>full</DebugType>
47+
<Optimize>true</Optimize>
48+
<OutputPath>bin\iPhoneSimulator\Release</OutputPath>
49+
<ErrorReport>prompt</ErrorReport>
50+
<WarningLevel>4</WarningLevel>
51+
<ConsolePause>false</ConsolePause>
52+
<MtouchArch>i386</MtouchArch>
53+
<MtouchLink>None</MtouchLink>
54+
<MtouchUseRefCounting>true</MtouchUseRefCounting>
55+
<CodesignKey>iPhone Developer</CodesignKey>
56+
<MtouchUseSGen>true</MtouchUseSGen>
57+
</PropertyGroup>
58+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|iPhone' ">
59+
<DebugSymbols>true</DebugSymbols>
60+
<DebugType>full</DebugType>
61+
<Optimize>false</Optimize>
62+
<OutputPath>bin\iPhone\Debug</OutputPath>
63+
<DefineConstants>DEBUG;ENABLE_TEST_CLOUD;</DefineConstants>
64+
<ErrorReport>prompt</ErrorReport>
65+
<WarningLevel>4</WarningLevel>
66+
<ConsolePause>false</ConsolePause>
67+
<MtouchArch>ARMv7, ARM64</MtouchArch>
68+
<CodesignEntitlements>Entitlements.plist</CodesignEntitlements>
69+
<MtouchFloat32>true</MtouchFloat32>
70+
<CodesignKey>iPhone Developer</CodesignKey>
71+
<DeviceSpecificBuild>true</DeviceSpecificBuild>
72+
<MtouchDebug>true</MtouchDebug>
73+
<MtouchUseSGen>true</MtouchUseSGen>
74+
<MtouchUseRefCounting>true</MtouchUseRefCounting>
75+
<MtouchProfiling>true</MtouchProfiling>
76+
</PropertyGroup>
77+
<ItemGroup>
78+
<Reference Include="System" />
79+
<Reference Include="System.Xml" />
80+
<Reference Include="System.Core" />
81+
<Reference Include="Xamarin.iOS" />
82+
</ItemGroup>
83+
<ItemGroup>
84+
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\Contents.json" />
85+
</ItemGroup>
86+
<ItemGroup>
87+
<InterfaceDefinition Include="Resources\LaunchScreen.xib" />
88+
<InterfaceDefinition Include="Main.storyboard" />
89+
</ItemGroup>
90+
<ItemGroup>
91+
<None Include="Info.plist" />
92+
<None Include="Entitlements.plist" />
93+
</ItemGroup>
94+
<ItemGroup>
95+
<Compile Include="Main.cs" />
96+
<Compile Include="AppDelegate.cs" />
97+
<Compile Include="GrowRowTableViewController.cs" />
98+
<Compile Include="GrowRowTableViewController.designer.cs">
99+
<DependentUpon>GrowRowTableViewController.cs</DependentUpon>
100+
</Compile>
101+
<Compile Include="GrowRowTableView.cs" />
102+
<Compile Include="GrowRowTableView.designer.cs">
103+
<DependentUpon>GrowRowTableView.cs</DependentUpon>
104+
</Compile>
105+
<Compile Include="GrowRowTableCell.cs" />
106+
<Compile Include="GrowRowTableCell.designer.cs">
107+
<DependentUpon>GrowRowTableCell.cs</DependentUpon>
108+
</Compile>
109+
<Compile Include="Classes\GrowItem.cs" />
110+
<Compile Include="Classes\GrowRowTableDataSource.cs" />
111+
<Compile Include="Classes\GrowRowTableDelegate.cs" />
112+
</ItemGroup>
113+
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
114+
<ItemGroup>
115+
<Folder Include="Classes\" />
116+
</ItemGroup>
117+
<ItemGroup>
118+
<BundleResource Include="Resources\Macintosh_Classic.jpg" />
119+
<BundleResource Include="Resources\MacIntosh_Plus.jpg" />
120+
<BundleResource Include="Resources\Macintosh_512K.png" />
121+
<BundleResource Include="Resources\Macintosh_128k.png" />
122+
<BundleResource Include="Resources\Macintosh_SE.jpg" />
123+
<BundleResource Include="Resources\MacII.jpg" />
124+
<BundleResource Include="Resources\SE30.jpg" />
125+
<BundleResource Include="Resources\Macintosh_Portable.jpg" />
126+
<BundleResource Include="Resources\Macintosh_LC.jpg" />
127+
<BundleResource Include="Resources\Powerbook_150.jpg" />
128+
<BundleResource Include="Resources\Macintosh_Classic_2.jpg" />
129+
<BundleResource Include="Resources\Macintosh_Color_Classic.jpg" />
130+
<BundleResource Include="Resources\Power_Macintosh.jpg" />
131+
</ItemGroup>
132+
</Project>

0 commit comments

Comments
 (0)