Skip to content

Commit cfb0653

Browse files
author
Villy G
committed
Done
1 parent 2805d92 commit cfb0653

File tree

10 files changed

+216
-47
lines changed

10 files changed

+216
-47
lines changed

TableView-FullScreenSectionView.xcodeproj/project.pbxproj

-12
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
/* Begin PBXBuildFile section */
1010
9590EBC21E65033D00A2946F /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9590EBC11E65033D00A2946F /* AppDelegate.swift */; };
1111
9590EBC41E65033D00A2946F /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9590EBC31E65033D00A2946F /* ViewController.swift */; };
12-
9590EBC71E65033D00A2946F /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9590EBC51E65033D00A2946F /* Main.storyboard */; };
1312
9590EBC91E65033D00A2946F /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 9590EBC81E65033D00A2946F /* Assets.xcassets */; };
1413
9590EBCC1E65033D00A2946F /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9590EBCA1E65033D00A2946F /* LaunchScreen.storyboard */; };
1514
/* End PBXBuildFile section */
@@ -18,7 +17,6 @@
1817
9590EBBE1E65033D00A2946F /* TableView-FullScreenSectionView.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "TableView-FullScreenSectionView.app"; sourceTree = BUILT_PRODUCTS_DIR; };
1918
9590EBC11E65033D00A2946F /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
2019
9590EBC31E65033D00A2946F /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
21-
9590EBC61E65033D00A2946F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
2220
9590EBC81E65033D00A2946F /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
2321
9590EBCB1E65033D00A2946F /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = "<group>"; };
2422
9590EBCD1E65033D00A2946F /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -56,7 +54,6 @@
5654
children = (
5755
9590EBC11E65033D00A2946F /* AppDelegate.swift */,
5856
9590EBC31E65033D00A2946F /* ViewController.swift */,
59-
9590EBC51E65033D00A2946F /* Main.storyboard */,
6057
9590EBC81E65033D00A2946F /* Assets.xcassets */,
6158
9590EBCA1E65033D00A2946F /* LaunchScreen.storyboard */,
6259
9590EBCD1E65033D00A2946F /* Info.plist */,
@@ -125,7 +122,6 @@
125122
files = (
126123
9590EBCC1E65033D00A2946F /* LaunchScreen.storyboard in Resources */,
127124
9590EBC91E65033D00A2946F /* Assets.xcassets in Resources */,
128-
9590EBC71E65033D00A2946F /* Main.storyboard in Resources */,
129125
);
130126
runOnlyForDeploymentPostprocessing = 0;
131127
};
@@ -144,14 +140,6 @@
144140
/* End PBXSourcesBuildPhase section */
145141

146142
/* Begin PBXVariantGroup section */
147-
9590EBC51E65033D00A2946F /* Main.storyboard */ = {
148-
isa = PBXVariantGroup;
149-
children = (
150-
9590EBC61E65033D00A2946F /* Base */,
151-
);
152-
name = Main.storyboard;
153-
sourceTree = "<group>";
154-
};
155143
9590EBCA1E65033D00A2946F /* LaunchScreen.storyboard */ = {
156144
isa = PBXVariantGroup;
157145
children = (

TableView-FullScreenSectionView.xcodeproj/xcuserdata/ve.xcuserdatad/xcschemes/TableView-FullScreenSectionView.xcscheme

+45
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@
55
<BuildAction
66
parallelizeBuildables = "YES"
77
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "9590EBBD1E65033D00A2946F"
18+
BuildableName = "TableView-FullScreenSectionView.app"
19+
BlueprintName = "TableView-FullScreenSectionView"
20+
ReferencedContainer = "container:TableView-FullScreenSectionView.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
</BuildActionEntries>
824
</BuildAction>
925
<TestAction
1026
buildConfiguration = "Debug"
@@ -13,6 +29,15 @@
1329
shouldUseLaunchSchemeArgsEnv = "YES">
1430
<Testables>
1531
</Testables>
32+
<MacroExpansion>
33+
<BuildableReference
34+
BuildableIdentifier = "primary"
35+
BlueprintIdentifier = "9590EBBD1E65033D00A2946F"
36+
BuildableName = "TableView-FullScreenSectionView.app"
37+
BlueprintName = "TableView-FullScreenSectionView"
38+
ReferencedContainer = "container:TableView-FullScreenSectionView.xcodeproj">
39+
</BuildableReference>
40+
</MacroExpansion>
1641
<AdditionalOptions>
1742
</AdditionalOptions>
1843
</TestAction>
@@ -26,6 +51,16 @@
2651
debugDocumentVersioning = "YES"
2752
debugServiceExtension = "internal"
2853
allowLocationSimulation = "YES">
54+
<BuildableProductRunnable
55+
runnableDebuggingMode = "0">
56+
<BuildableReference
57+
BuildableIdentifier = "primary"
58+
BlueprintIdentifier = "9590EBBD1E65033D00A2946F"
59+
BuildableName = "TableView-FullScreenSectionView.app"
60+
BlueprintName = "TableView-FullScreenSectionView"
61+
ReferencedContainer = "container:TableView-FullScreenSectionView.xcodeproj">
62+
</BuildableReference>
63+
</BuildableProductRunnable>
2964
<AdditionalOptions>
3065
</AdditionalOptions>
3166
</LaunchAction>
@@ -35,6 +70,16 @@
3570
savedToolIdentifier = ""
3671
useCustomWorkingDirectory = "NO"
3772
debugDocumentVersioning = "YES">
73+
<BuildableProductRunnable
74+
runnableDebuggingMode = "0">
75+
<BuildableReference
76+
BuildableIdentifier = "primary"
77+
BlueprintIdentifier = "9590EBBD1E65033D00A2946F"
78+
BuildableName = "TableView-FullScreenSectionView.app"
79+
BlueprintName = "TableView-FullScreenSectionView"
80+
ReferencedContainer = "container:TableView-FullScreenSectionView.xcodeproj">
81+
</BuildableReference>
82+
</BuildableProductRunnable>
3883
</ProfileAction>
3984
<AnalyzeAction
4085
buildConfiguration = "Debug">

TableView-FullScreenSectionView/AppDelegate.swift

+18-1
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,26 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
1515

1616

1717
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
18-
// Override point for customization after application launch.
18+
19+
self.window = UIWindow(frame: UIScreen.main.bounds)
20+
21+
let nav = UINavigationController()
22+
let vc = ViewController()
23+
24+
// Push the vc onto the nav
25+
nav.pushViewController(vc, animated: false)
26+
27+
// Set the window’s root view controller
28+
self.window!.rootViewController = nav
29+
30+
// Present the window
31+
self.window!.makeKeyAndVisible()
32+
1933
return true
34+
2035
}
36+
37+
2138

2239
func applicationWillResignActive(_ application: UIApplication) {
2340
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.

TableView-FullScreenSectionView/Assets.xcassets/AppIcon.appiconset/Contents.json

+25
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
{
22
"images" : [
3+
{
4+
"idiom" : "iphone",
5+
"size" : "20x20",
6+
"scale" : "2x"
7+
},
8+
{
9+
"idiom" : "iphone",
10+
"size" : "20x20",
11+
"scale" : "3x"
12+
},
313
{
414
"idiom" : "iphone",
515
"size" : "29x29",
@@ -30,6 +40,16 @@
3040
"size" : "60x60",
3141
"scale" : "3x"
3242
},
43+
{
44+
"idiom" : "ipad",
45+
"size" : "20x20",
46+
"scale" : "1x"
47+
},
48+
{
49+
"idiom" : "ipad",
50+
"size" : "20x20",
51+
"scale" : "2x"
52+
},
3353
{
3454
"idiom" : "ipad",
3555
"size" : "29x29",
@@ -59,6 +79,11 @@
5979
"idiom" : "ipad",
6080
"size" : "76x76",
6181
"scale" : "2x"
82+
},
83+
{
84+
"idiom" : "ipad",
85+
"size" : "83.5x83.5",
86+
"scale" : "2x"
6287
}
6388
],
6489
"info" : {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"info" : {
3+
"version" : 1,
4+
"author" : "xcode"
5+
}
6+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"scale" : "1x"
6+
},
7+
{
8+
"idiom" : "universal",
9+
"scale" : "2x"
10+
},
11+
{
12+
"idiom" : "universal",
13+
"filename" : "engraving-stage3-1a.jpg",
14+
"scale" : "3x"
15+
}
16+
],
17+
"info" : {
18+
"version" : 1,
19+
"author" : "xcode"
20+
}
21+
}
Loading

TableView-FullScreenSectionView/Base.lproj/Main.storyboard

-26
This file was deleted.

TableView-FullScreenSectionView/Info.plist

-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
<true/>
2323
<key>UILaunchStoryboardName</key>
2424
<string>LaunchScreen</string>
25-
<key>UIMainStoryboardFile</key>
26-
<string>Main</string>
2725
<key>UIRequiredDeviceCapabilities</key>
2826
<array>
2927
<string>armv7</string>

TableView-FullScreenSectionView/ViewController.swift

+101-6
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,113 @@
88

99
import UIKit
1010

11-
class ViewController: UIViewController {
11+
class ViewController: UITableViewController {
1212

13+
14+
convenience init() {
15+
16+
self.init(style: UITableViewStyle.grouped)
17+
18+
}
19+
1320
override func viewDidLoad() {
1421
super.viewDidLoad()
15-
// Do any additional setup after loading the view, typically from a nib.
16-
}
1722

18-
override func didReceiveMemoryWarning() {
19-
super.didReceiveMemoryWarning()
20-
// Dispose of any resources that can be recreated.
23+
self.navigationItem.title = "Gun details"
24+
2125
}
2226

2327

28+
29+
30+
override func viewWillTransition(to size: CGSize, with coordinator: UIViewControllerTransitionCoordinator) {
31+
super.viewWillTransition(to: size, with: coordinator)
32+
33+
// print("will execute before rotation")
34+
35+
self.tableView.beginUpdates()
36+
37+
coordinator.animate(alongsideTransition: { (context: UIViewControllerTransitionCoordinatorContext) in
38+
39+
// print("will execute during rotation")
40+
41+
self.tableView.endUpdates()
42+
43+
}) { (context: UIViewControllerTransitionCoordinatorContext) in
44+
45+
// print("will execute after rotation")
46+
47+
}
48+
49+
}
50+
51+
52+
// ***********************************************
53+
// MARK: - UITableViewDataSource
54+
// ***********************************************
55+
56+
57+
58+
override func numberOfSections(in tableView: UITableView) -> Int {
59+
60+
return 3
61+
62+
}
63+
64+
65+
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
66+
67+
return 5
68+
69+
}
70+
71+
72+
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
73+
74+
// since it is a static view we don't care about recycling at this time
75+
let result: UITableViewCell = UITableViewCell(style: .value1, reuseIdentifier: "cell")
76+
77+
result.textLabel?.text = "Text for row at: \(indexPath.row)"
78+
result.detailTextLabel?.text = "Details for row at: \(indexPath.row)"
79+
80+
return result
81+
82+
}
83+
84+
85+
86+
override func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat {
87+
if section == 0 {
88+
let orientation = UIApplication.shared.statusBarOrientation
89+
90+
if orientation.isLandscape {
91+
return view.frame.height
92+
} else {
93+
return view.frame.height / 3
94+
}
95+
}
96+
97+
return UITableViewAutomaticDimension
98+
99+
}
100+
101+
override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? {
102+
103+
// We'll assume that there is only one section for now.
104+
105+
if section == 0 {
106+
107+
let imageView: UIImageView = UIImageView()
108+
imageView.clipsToBounds = true
109+
imageView.contentMode = .scaleAspectFill
110+
imageView.image = UIImage(named: "gun")!
111+
return imageView
112+
}
113+
114+
return nil
115+
116+
}
117+
118+
24119
}
25120

0 commit comments

Comments
 (0)