From 17720a23fd145168d30fee65a4902b1e9c3bad3e Mon Sep 17 00:00:00 2001 From: "John D. Pope" Date: Thu, 14 Aug 2014 10:47:05 +1000 Subject: [PATCH] fix to make compile --- TSwfit/TSwfit/DetailViewController.swift | 4 ++-- TSwfit/TSwfit/RootViewController.swift | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/TSwfit/TSwfit/DetailViewController.swift b/TSwfit/TSwfit/DetailViewController.swift index 091eb03..d2ab3fa 100644 --- a/TSwfit/TSwfit/DetailViewController.swift +++ b/TSwfit/TSwfit/DetailViewController.swift @@ -36,7 +36,7 @@ class DetailViewController : UIViewController, UIPickerViewDataSource, UIPickerV button?.setTitle("Touch Me", forState: UIControlState.Highlighted) button?.addTarget(self, action: "buttonAction:", forControlEvents: UIControlEvents.TouchUpInside) button!.tag = 100 - self.view.addSubview(button) + self.view.addSubview(button!) } else if self.title == "UIImageView" { @@ -165,7 +165,7 @@ class DetailViewController : UIViewController, UIPickerViewDataSource, UIPickerV button?.setTitle("Show ActionSheet", forState: UIControlState.Highlighted) button?.addTarget(self, action: "showActionSheet", forControlEvents: UIControlEvents.TouchUpInside) button!.tag = 101 - self.view.addSubview(button) + self.view.addSubview(button!) } else if self.title == "UIActivityIndicatorView" { diff --git a/TSwfit/TSwfit/RootViewController.swift b/TSwfit/TSwfit/RootViewController.swift index c421181..6a69884 100644 --- a/TSwfit/TSwfit/RootViewController.swift +++ b/TSwfit/TSwfit/RootViewController.swift @@ -22,7 +22,7 @@ class RootViewController : UIViewController, UITableViewDelegate, UITableViewDat self.tableView!.delegate = self self.tableView!.dataSource = self self.tableView!.registerClass(UITableViewCell.self, forCellReuseIdentifier: "Cell") - self.view?.addSubview(self.tableView) + self.view?.addSubview(self.tableView!) } // UITableViewDataSource Methods @@ -40,7 +40,7 @@ class RootViewController : UIViewController, UITableViewDelegate, UITableViewDat { let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath: indexPath) as UITableViewCell! cell.accessoryType = UITableViewCellAccessoryType.DisclosureIndicator - cell.textLabel.text = self.items?.objectAtIndex(indexPath.row) as String + cell.textLabel.text = self.items?.objectAtIndex(indexPath.row) as AnyObject? as? String return cell } @@ -51,7 +51,7 @@ class RootViewController : UIViewController, UITableViewDelegate, UITableViewDat self.tableView!.deselectRowAtIndexPath(indexPath, animated: true) var detailViewController = DetailViewController() - detailViewController.title = self.items?.objectAtIndex(indexPath.row) as String + detailViewController.title = self.items?.objectAtIndex(indexPath.row) as AnyObject? as? String self.navigationController.pushViewController(detailViewController, animated:true) }