回答編集履歴
1
修正
test
CHANGED
@@ -175,3 +175,157 @@
|
|
175
175
|
}
|
176
176
|
|
177
177
|
```
|
178
|
+
|
179
|
+
回答追記
|
180
|
+
|
181
|
+
---
|
182
|
+
|
183
|
+
PageMenuの中からも問題なく呼び出せたのでDelegateを使用しない例を載せておきます。
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
```swift
|
188
|
+
|
189
|
+
import UIKit
|
190
|
+
|
191
|
+
import PageMenu
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
class ViewController: UIViewController, CAPSPageMenuDelegate {
|
196
|
+
|
197
|
+
|
198
|
+
|
199
|
+
var pageMenu : CAPSPageMenu?
|
200
|
+
|
201
|
+
|
202
|
+
|
203
|
+
override func viewDidLoad() {
|
204
|
+
|
205
|
+
super.viewDidLoad()
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
var controllerArray : [UIViewController] = []
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
let controller = storyboard?.instantiateViewControllerWithIdentifier("VC1") as! ViewController1
|
214
|
+
|
215
|
+
controller.title = "SAMPLE TITLE"
|
216
|
+
|
217
|
+
controllerArray.append(controller)
|
218
|
+
|
219
|
+
|
220
|
+
|
221
|
+
let controller1 = storyboard?.instantiateViewControllerWithIdentifier("VC1") as! ViewController1
|
222
|
+
|
223
|
+
controller1.title = "SAMPLE TITLE1"
|
224
|
+
|
225
|
+
controllerArray.append(controller1)
|
226
|
+
|
227
|
+
|
228
|
+
|
229
|
+
let parameters: [CAPSPageMenuOption] = [
|
230
|
+
|
231
|
+
.MenuItemSeparatorWidth(4.3),
|
232
|
+
|
233
|
+
.UseMenuLikeSegmentedControl(true),
|
234
|
+
|
235
|
+
.MenuItemSeparatorPercentageHeight(0.1)
|
236
|
+
|
237
|
+
]
|
238
|
+
|
239
|
+
|
240
|
+
|
241
|
+
pageMenu = CAPSPageMenu(viewControllers: controllerArray, frame: CGRectMake(0.0, 0.0, self.view.frame.width, self.view.frame.height), pageMenuOptions: parameters)
|
242
|
+
|
243
|
+
self.view.addSubview(pageMenu!.view)
|
244
|
+
|
245
|
+
}
|
246
|
+
|
247
|
+
}
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
|
253
|
+
// -----------------------------
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
class ViewController1: UIViewController, UITableViewDelegate, UITableViewDataSource {
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
@IBOutlet weak var tableView: UITableView!
|
266
|
+
|
267
|
+
|
268
|
+
|
269
|
+
override func viewDidLoad() {
|
270
|
+
|
271
|
+
super.viewDidLoad()
|
272
|
+
|
273
|
+
|
274
|
+
|
275
|
+
tableView.estimatedRowHeight = 20
|
276
|
+
|
277
|
+
tableView.rowHeight = UITableViewAutomaticDimension
|
278
|
+
|
279
|
+
}
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
// Data Array
|
284
|
+
|
285
|
+
var dataArray = ["One","Two","Three","Four","Five"]
|
286
|
+
|
287
|
+
|
288
|
+
|
289
|
+
// MARK: - TableView Delegate & DataSource
|
290
|
+
|
291
|
+
|
292
|
+
|
293
|
+
// Row Count
|
294
|
+
|
295
|
+
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
296
|
+
|
297
|
+
return dataArray.count
|
298
|
+
|
299
|
+
}
|
300
|
+
|
301
|
+
|
302
|
+
|
303
|
+
// Generate Cell
|
304
|
+
|
305
|
+
func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
|
306
|
+
|
307
|
+
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath)
|
308
|
+
|
309
|
+
cell.textLabel?.text = dataArray[indexPath.row]
|
310
|
+
|
311
|
+
return cell
|
312
|
+
|
313
|
+
}
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
// Select Cell
|
318
|
+
|
319
|
+
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
|
320
|
+
|
321
|
+
tableView.deselectRowAtIndexPath(indexPath, animated: true)
|
322
|
+
|
323
|
+
|
324
|
+
|
325
|
+
performSegueWithIdentifier("chatViewControllerFromCell", sender: nil)
|
326
|
+
|
327
|
+
}
|
328
|
+
|
329
|
+
}
|
330
|
+
|
331
|
+
```
|