Skip to content

Commit 0e88e59

Browse files
authored
Updates to iOS samples issues reported in certification (#259)
1 parent f536fe3 commit 0e88e59

File tree

37 files changed

+475
-291
lines changed

37 files changed

+475
-291
lines changed

src/iOS/Xamarin.iOS/Samples/Data/FeatureLayerQuery/FeatureLayerQuery.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ public override void ViewDidLoad()
6262
public override void ViewDidLayoutSubviews()
6363
{
6464
// Setup the visual frame for the MapView
65-
_myMapView.Frame = new CoreGraphics.CGRect(
66-
0, yPageOffset + 80, View.Bounds.Width, View.Bounds.Height - yPageOffset - 80);
65+
_myMapView.Frame = new CoreGraphics.CGRect(0, 0, View.Bounds.Width, View.Bounds.Height);
6766

6867
// Setup the visual frame for the text field used in query
6968
_queryTextView.Frame = new CoreGraphics.CGRect(0, yPageOffset, View.Bounds.Width, 40);

src/iOS/Xamarin.iOS/Samples/Data/ServiceFeatureTableCache/ServiceFeatureTableCache.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,21 @@ public ServiceFeatureTableCache()
3131
Title = "Service feature table (cache)";
3232
}
3333

34-
public override void ViewDidLayoutSubviews()
34+
public override void ViewDidLoad()
3535
{
36-
base.ViewDidLayoutSubviews();
36+
base.ViewDidLoad();
3737

3838
// Create the UI, setup the control references and execute initialization
3939
CreateLayout();
4040
Initialize();
4141
}
4242

43+
public override void ViewDidLayoutSubviews()
44+
{
45+
// Setup the visual frame for the MapView
46+
_myMapView.Frame = new CoreGraphics.CGRect(0, 0, View.Bounds.Width, View.Bounds.Height);
47+
}
48+
4349
private void Initialize()
4450
{
4551
// Create new Map with basemap
@@ -75,10 +81,6 @@ private void Initialize()
7581

7682
private void CreateLayout()
7783
{
78-
// Setup the visual frame for the MapView
79-
_myMapView.Frame = new CoreGraphics.CGRect(
80-
0, yPageOffset, View.Bounds.Width, View.Bounds.Height - yPageOffset);
81-
8284
// Add MapView to the page
8385
View.AddSubviews(_myMapView);
8486
}

src/iOS/Xamarin.iOS/Samples/Data/ServiceFeatureTableManualCache/ServiceFeatureTableManualCache.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,21 @@ public ServiceFeatureTableManualCache()
3333
Title = "Service feature table (manual cache)";
3434
}
3535

36-
public override void ViewDidLayoutSubviews()
36+
public override void ViewDidLoad()
3737
{
38-
base.ViewDidLayoutSubviews();
38+
base.ViewDidLoad();
3939

4040
// Create the UI, setup the control references and execute initialization
4141
CreateLayout();
4242
Initialize();
4343
}
4444

45+
public override void ViewDidLayoutSubviews()
46+
{
47+
// Setup the visual frame for the MapView
48+
_myMapView.Frame = new CoreGraphics.CGRect(0, 0, View.Bounds.Width, View.Bounds.Height);
49+
}
50+
4551
private void Initialize()
4652
{
4753
// Create new Map with basemap
@@ -96,10 +102,6 @@ private async void OnLoadedPopulateData(object sender, Esri.ArcGISRuntime.LoadSt
96102

97103
private void CreateLayout()
98104
{
99-
// Setup the visual frame for the MapView
100-
_myMapView.Frame = new CoreGraphics.CGRect(
101-
0, yPageOffset, View.Bounds.Width, View.Bounds.Height - yPageOffset);
102-
103105
// Add MapView to the page
104106
View.AddSubviews(_myMapView);
105107
}

src/iOS/Xamarin.iOS/Samples/Data/ServiceFeatureTableNoCache/ServiceFeatureTableNoCache.cs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,21 @@ public ServiceFeatureTableNoCache()
3131
Title = "Service feature table (no cache)";
3232
}
3333

34-
public override void ViewDidLayoutSubviews()
34+
public override void ViewDidLoad()
3535
{
36-
base.ViewDidLayoutSubviews();
36+
base.ViewDidLoad();
3737

3838
// Create the UI, setup the control references and execute initialization
3939
CreateLayout();
4040
Initialize();
4141
}
4242

43+
public override void ViewDidLayoutSubviews()
44+
{
45+
// Setup the visual frame for the MapView
46+
_myMapView.Frame = new CoreGraphics.CGRect(0, 0, View.Bounds.Width, View.Bounds.Height);
47+
}
48+
4349
private void Initialize()
4450
{
4551
// Create new Map with basemap
@@ -76,10 +82,6 @@ private void Initialize()
7682

7783
private void CreateLayout()
7884
{
79-
// Setup the visual frame for the MapView
80-
_myMapView.Frame = new CoreGraphics.CGRect(
81-
0, yPageOffset, View.Bounds.Width, View.Bounds.Height - yPageOffset);
82-
8385
// Add MapView to the page
8486
View.AddSubviews(_myMapView);
8587
}

src/iOS/Xamarin.iOS/Samples/GraphicsOverlay/AddGraphicsRenderer/AddGraphicsRenderer.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,19 @@ public AddGraphicsRenderer()
3232
Title = "Add graphics (Renderer)";
3333
}
3434

35-
public override void ViewDidLayoutSubviews()
35+
public override void ViewDidLoad()
3636
{
37-
base.ViewDidLayoutSubviews();
37+
base.ViewDidLoad();
3838

3939
// Create the UI, setup the control references and execute initialization
4040
CreateLayout();
4141
Initialize();
4242
}
43+
public override void ViewDidLayoutSubviews()
44+
{
45+
// Setup the visual frame for the MapView
46+
_myMapView.Frame = new CoreGraphics.CGRect(0, 0, View.Bounds.Width, View.Bounds.Height);
47+
}
4348

4449
private void Initialize()
4550
{
@@ -114,10 +119,6 @@ private void OnViewpointChanged(object sender, EventArgs e)
114119

115120
private void CreateLayout()
116121
{
117-
// Setup the visual frame for the MapView
118-
_myMapView.Frame = new CoreGraphics.CGRect(
119-
0, yPageOffset, View.Bounds.Width, View.Bounds.Height - yPageOffset);
120-
121122
// Add MapView to the page
122123
View.AddSubviews(_myMapView);
123124
}

src/iOS/Xamarin.iOS/Samples/GraphicsOverlay/IdentifyGraphics/IdentifyGraphics.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@ public override void ViewDidLoad()
4545
Initialize();
4646
}
4747

48+
public override void ViewDidLayoutSubviews()
49+
{
50+
// Setup the visual frame for the MapView
51+
_myMapView.Frame = new CoreGraphics.CGRect(0, 0, View.Bounds.Width, View.Bounds.Height);
52+
}
53+
4854
private void Initialize()
4955
{
5056
// Create a map with 'Imagery with Labels' basemap and an initial location
@@ -117,10 +123,6 @@ private async void OnMapViewTapped(object sender, GeoViewInputEventArgs e)
117123

118124
private void CreateLayout()
119125
{
120-
// Setup the visual frame for the MapView
121-
_myMapView.Frame = new CoreGraphics.CGRect(
122-
0, yPageOffset, View.Bounds.Width, View.Bounds.Height - yPageOffset);
123-
124126
// Add MapView to the page
125127
View.AddSubviews(_myMapView);
126128
}

src/iOS/Xamarin.iOS/Samples/GraphicsOverlay/SketchOnMap/SketchOnMap.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ public SketchOnMap()
4646
Title = "Sketch on map";
4747
}
4848

49-
public override void ViewDidLayoutSubviews()
49+
public override void ViewDidLoad()
5050
{
51-
base.ViewDidLayoutSubviews();
51+
base.ViewDidLoad();
5252

5353
// Create the UI
5454
CreateLayout();
@@ -57,6 +57,12 @@ public override void ViewDidLayoutSubviews()
5757
Initialize();
5858
}
5959

60+
public override void ViewDidLayoutSubviews()
61+
{
62+
// Setup the visual frame for the MapView
63+
_myMapView.Frame = new CoreGraphics.CGRect(0, 0, View.Bounds.Width, View.Bounds.Height);
64+
}
65+
6066
private void Initialize()
6167
{
6268
// Create a light gray canvas map
@@ -89,9 +95,6 @@ private void CreateLayout()
8995
// Create a new MapView control
9096
_myMapView = new MapView();
9197

92-
// Define the visual frame for the MapView
93-
_myMapView.Frame = new CoreGraphics.CGRect(0, yPageOffset, View.Bounds.Width, View.Bounds.Height - yPageOffset);
94-
9598
// Add a segmented button control
9699
_segmentButton = new UISegmentedControl();
97100
_segmentButton.BackgroundColor = UIColor.White;

src/iOS/Xamarin.iOS/Samples/Layers/ArcGISMapImageLayerUrl/ArcGISMapImageLayerUrl.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,23 @@ public ArcGISMapImageLayerUrl()
2929
Title = "ArcGIS map image layer (URL)";
3030
}
3131

32-
public override void ViewDidLayoutSubviews()
32+
public override void ViewDidLoad()
3333
{
34-
base.ViewDidLayoutSubviews();
34+
base.ViewDidLoad();
3535

3636
// Create the UI, setup the control references and execute initialization
3737
CreateLayout();
3838
Initialize();
3939
}
4040

41+
public override void ViewDidLayoutSubviews()
42+
{
43+
// Setup the visual frame for the MapView
44+
_myMapView.Frame = new CoreGraphics.CGRect(0, 0, View.Bounds.Width, View.Bounds.Height);
45+
46+
base.ViewDidLayoutSubviews();
47+
}
48+
4149
private void Initialize()
4250
{
4351
// Create new Map
@@ -59,10 +67,6 @@ private void Initialize()
5967

6068
private void CreateLayout()
6169
{
62-
// Setup the visual frame for the MapView
63-
_myMapView.Frame = new CoreGraphics.CGRect(
64-
0, yPageOffset, View.Bounds.Width, View.Bounds.Height - yPageOffset);
65-
6670
// Add MapView to the page
6771
View.AddSubviews(_myMapView);
6872
}

src/iOS/Xamarin.iOS/Samples/Layers/ArcGISTiledLayerUrl/ArcGISTiledLayerUrl.cs

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,23 @@ public ArcGISTiledLayerUrl()
2929
Title = "ArcGIS tiled layer (URL)";
3030
}
3131

32-
public override void ViewDidLayoutSubviews()
32+
public override void ViewDidLoad()
3333
{
34-
base.ViewDidLayoutSubviews();
34+
base.ViewDidLoad();
3535

3636
// Create the UI, setup the control references and execute initialization
3737
CreateLayout();
3838
Initialize();
3939
}
4040

41+
public override void ViewDidLayoutSubviews()
42+
{
43+
// Setup the visual frame for the MapView
44+
_myMapView.Frame = new CoreGraphics.CGRect(0, 0, View.Bounds.Width, View.Bounds.Height);
45+
46+
base.ViewDidLayoutSubviews();
47+
}
48+
4149
private void Initialize()
4250
{
4351
// Create new Map
@@ -59,10 +67,6 @@ private void Initialize()
5967

6068
private void CreateLayout()
6169
{
62-
// Setup the visual frame for the MapView
63-
_myMapView.Frame = new CoreGraphics.CGRect(
64-
0, yPageOffset, View.Bounds.Width, View.Bounds.Height - yPageOffset);
65-
6670
// Add MapView to the page
6771
View.AddSubviews(_myMapView);
6872
}

src/iOS/Xamarin.iOS/Samples/Layers/ArcGISVectorTiledLayerUrl/ArcGISVectorTiledLayerUrl.cs

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public class ArcGISVectorTiledLayerUrl : UIViewController
2121
{
2222
// Create and hold reference to the used MapView
2323
private MapView _myMapView = new MapView();
24+
UIToolbar _toolbar;
2425

2526
private string _navigationUrl = "https://www.arcgis.com/home/item.html?id=dcbbba0edf094eaa81af19298b9c6247";
2627
private string _streetUrl = "https://www.arcgis.com/home/item.html?id=4e1133c28ac04cca97693cf336cd49ad";
@@ -41,16 +42,12 @@ public override void DidReceiveMemoryWarning()
4142
base.DidReceiveMemoryWarning();
4243
}
4344

44-
public override void ViewDidLayoutSubviews()
45+
public override void ViewDidLoad()
4546
{
46-
base.ViewDidLayoutSubviews();
47-
48-
// Create a variable to hold the yOffset where the MapView control should start
49-
var yOffset = 60;
47+
base.ViewDidLoad();
5048

5149
// Create a new MapView control and provide its location coordinates on the frame
52-
MapView myMapView = new MapView();
53-
myMapView.Frame = new CoreGraphics.CGRect(0, yOffset, View.Bounds.Width, View.Bounds.Height - yOffset);
50+
_myMapView = new MapView();
5451

5552
// Create a new Map instance with the basemap
5653
Map myMap = new Map(SpatialReferences.WebMercator);
@@ -61,7 +58,7 @@ public override void ViewDidLayoutSubviews()
6158
myMap.Basemap = new Basemap(_vectorTiledLayer);
6259

6360
// Assign the Map to the MapView
64-
myMapView.Map = myMap;
61+
_myMapView.Map = myMap;
6562

6663
// Create a segmented control to display buttons
6764
UISegmentedControl segmentControl = new UISegmentedControl();
@@ -104,25 +101,35 @@ public override void ViewDidLayoutSubviews()
104101
_vectorTiledLayer = new ArcGISVectorTiledLayer(new Uri(_vectorTiledLayerUrl));
105102

106103
// Create new Map with basemap and assigning to the Mapviews Map
107-
myMapView.Map = new Map(new Basemap(_vectorTiledLayer));
104+
_myMapView.Map = new Map(new Basemap(_vectorTiledLayer));
108105
};
109106

110107
// Create a UIBarButtonItem where its view is the SegmentControl
111108
UIBarButtonItem barButtonItem = new UIBarButtonItem(UIBarButtonSystemItem.FlexibleSpace);
112109
barButtonItem.CustomView = segmentControl;
113110

114111
// Create a toolbar on the bottom of the display
115-
UIToolbar toolbar = new UIToolbar();
116-
toolbar.Frame = new CoreGraphics.CGRect(0, View.Bounds.Height - 40, View.Bounds.Width, View.Bounds.Height);
117-
toolbar.AutosizesSubviews = true;
112+
_toolbar = new UIToolbar();
113+
114+
_toolbar.AutosizesSubviews = true;
118115

119116
// Add the bar button item to an array of UIBarButtonItems
120117
UIBarButtonItem[] barButtonItems = new UIBarButtonItem[] { barButtonItem };
121118

122119
// Add the UIBarButtonItems array to the toolbar
123-
toolbar.SetItems(barButtonItems, true);
120+
_toolbar.SetItems(barButtonItems, true);
121+
122+
View.AddSubviews(_myMapView, _toolbar);
123+
}
124124

125-
View.AddSubviews(myMapView, toolbar);
125+
public override void ViewDidLayoutSubviews()
126+
{
127+
// Setup the visual frame for the MapView
128+
_myMapView.Frame = new CoreGraphics.CGRect(0, 0, View.Bounds.Width, View.Bounds.Height);
129+
130+
_toolbar.Frame = new CoreGraphics.CGRect(0, View.Bounds.Height - 40, View.Bounds.Width, View.Bounds.Height);
131+
132+
base.ViewDidLayoutSubviews();
126133
}
127134
}
128135
}

0 commit comments

Comments
 (0)