質問編集履歴
1
回答をいただいての現状と追記
test
CHANGED
File without changes
|
test
CHANGED
@@ -93,3 +93,99 @@
|
|
93
93
|
・```Xcode7.3.1```
|
94
94
|
|
95
95
|
・```Swift2```
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
###追記(ご回答を実装後)
|
100
|
+
|
101
|
+
```Swift
|
102
|
+
|
103
|
+
class ViewController: UIViewController, UITableViewDataSource {
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
@IBOutlet weak var myTable: UITableView!
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
var cnt = 15
|
112
|
+
|
113
|
+
var myImageView: UIImageView?
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
override func viewDidLoad() {
|
118
|
+
|
119
|
+
super.viewDidLoad()
|
120
|
+
|
121
|
+
// let window = UIScreen.mainScreen().bounds.size
|
122
|
+
|
123
|
+
// let myImage = UIImage(named: "footer")
|
124
|
+
|
125
|
+
// myImageView = UIImageView(frame: CGRectMake(0, 0, window.width, (myImage?.size.height)!))
|
126
|
+
|
127
|
+
//
|
128
|
+
|
129
|
+
// myImageView!.image = myImage
|
130
|
+
|
131
|
+
// myImageView!.contentMode = .ScaleAspectFill
|
132
|
+
|
133
|
+
// myTable.tableFooterView = myImageView
|
134
|
+
|
135
|
+
}
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
override func viewWillAppear(animated: Bool) {
|
140
|
+
|
141
|
+
// if cnt >= 10 {
|
142
|
+
|
143
|
+
// myImageView?.hidden = true
|
144
|
+
|
145
|
+
// myImageView = UIImageView(frame: CGRectMake(0,0,0,0))
|
146
|
+
|
147
|
+
// myTable.tableFooterView?.frame.size.height = 0.0
|
148
|
+
|
149
|
+
// }
|
150
|
+
|
151
|
+
myTable.reloadData()
|
152
|
+
|
153
|
+
super.viewWillAppear(animated)
|
154
|
+
|
155
|
+
}
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
160
|
+
|
161
|
+
return cnt
|
162
|
+
|
163
|
+
}
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
|
168
|
+
|
169
|
+
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)
|
170
|
+
|
171
|
+
let label = cell.viewWithTag(1) as! UILabel
|
172
|
+
|
173
|
+
label.text = "\(indexPath.row + 1)"
|
174
|
+
|
175
|
+
return cell
|
176
|
+
|
177
|
+
}
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
}
|
182
|
+
|
183
|
+
```
|
184
|
+
|
185
|
+
![スクショ](b479f9179fde2095ef851b0690a57b48.png)![スクショ](adc3f0ca6321f5b67b12cce46894ad59.png)
|
186
|
+
|
187
|
+
※左が該当部分をコメントアウト、右がコメントアウトなし(Footer追加時、本来はこのスペースに画像あり)
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
基本的にはFooterを追加しておいて、ある条件下にのみ、左のように詰めて表示したいのですが。。。
|