Storyboards Tutorial in iOS 9: Part 1

Hello thank you for coming back, but it is not really the same. 1 / your text and image arrive from the same place. 2 / you have an input page to send to the table. I have done tests by following your tutorial. My info is sent to the table, but with each sending from a different page, the first row of my table is replaced by the new one. Actually I look for examples or help but apart from a todo list I can not seem to find an example more suited to my need. Iā€™ll still look and try to find help.

Hello thank you but it is not really the same. 1 / your text and image arrive from the same place. 2 / you have an input page to send to the table. I have done tests by following your tutorial. My info is sent to the table, but with each sending from a different page, the first row of my table is replaced by the new one. Actually I look for examples or help but apart from a todo list I can not seem to find an example more suited to my need. Iā€™ll still look and try to find help.

@fabrice - why do you have 10 different views? Does each different view show completely different information?

Can you not just have one view and format that view depending on the information required to be shown?

Yes I have 10 views with different information. Good for the rest I managed to do some things to display these views and it works. All question, while I can not make a list of favorites that seems so simple for others and yet I am always at the same point

@fabrice - all apps have their quirks, but there are certain standard ways of presenting information.

If you can get a single array of favorites, even if each individual favorite is created by a different view, then you will be able to have a simple table view listing of these favorites.

I had Learned Many Things From The Tutorials But I Also Want To Know That How To Create A Web View In An Application Which Web View Shows The Profile Or The About Us Blog Of Any xyz Company And That Was Already On Their Website.
Currently I am Using Xcode 8.2.1 And I want To Make It On Swift 3.

@jay005 - Iā€™m afraid I donā€™t understand. It sounds as if you just want to add a UIWebView to the storyboard?

Sorry About That I Am A New Learner In iOSā€¦
@caroline

Yes, Of Course UIWebView But In That I Just Want To Show About Us Of Any Companyā€¦
Say For Example,
If I Want To Show Only The About us Blog Of ā€œApple.comā€ .
And I Didnā€™t Want To Use It As Browserā€¦
Because UIWebView Generates It By Using Browserā€¦ ā† The First Point.
Like Say For Example,
Amazon App Rightā€¦ It Is Not A Browser. Whether This App Is For Android Or iOS.
And We Can Not Open The Different Website From That Appā€¦
So In My Project I Want To Do Just Like Amazon But What The Difference Is That I Want To Create This View For A Particular Blog For As I Said Already Which Is At Any Websiteā€¦ ā€œAbout Us.ā€

Thank Youā€¦

@caroline

import UIKit
class ViewController: UIViewController {
@IBOutlet weak var webView: UIWebView!

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view, typically from a nib.
   
    let devitplURL = URL(string: "https://www.devitpl.com/about-devit/about-devit.aspx")
    let devitplURLRequest = URLRequest(url: devitplURL!)
    webView.loadRequest(devitplURLRequest)
    }

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

@IBAction func goForward(_ sender: Any) {
    webView.goForward()
}
@IBAction func goBack(_ sender: Any) {
    webView.goBack()
}

}

And Changing In info.plist file We Can Get The Result
But In Browserā€¦
Simply I donā€™t Want Thisā€¦

What I Want To Learn Thatā€¦

let devitplURL = URL(string: ā€œhttps://www.devitpl.com/about-devit/about-devit.aspxā€)
** let devitplURLRequest = URLRequest(url: devitplURL!)**
** webView.loadRequest(devitplURLRequest)**

User Can Only See This URL Or Website Nothing Otherā€¦Whether It Uses The Browser Or Not That I donā€™t Care Right Nowā€¦

I Hope Now You Can Understand Betterā€¦

Thanks And Regards,
jaypgopani05@gmail.com

:slight_smile:

@jay005 - do you mean disable links in the web page?

Hereā€™s a stackoverflow link:

And this would be the Swift code:

import UIKit

class ViewController: UIViewController {

  @IBOutlet var webView: UIWebView!
  var allowLoad = true

  override func viewDidLoad() {
    super.viewDidLoad()
    webView.delegate = self
    let url = URL(string: "https://www.devitpl.com/about-devit/about-devit.aspx")
    let urlRequest = URLRequest(url: url!)
    webView.loadRequest(urlRequest)
  }
}

extension ViewController: UIWebViewDelegate {
  func webView(_ webView: UIWebView, shouldStartLoadWith request: URLRequest, navigationType: UIWebViewNavigationType) -> Bool {
    return allowLoad
  }

  func webViewDidFinishLoad(_ webView: UIWebView) {
    allowLoad = false
  }
}
1 Like

Thank You very Much
@caroline

Hi - During the tutorial weā€™re told to do the following:

Now add a Player array property just below class PlayersTableViewController: UITableViewController in PlayersViewController.swift to hold the list of players

But I donā€™t have a class called PlayersTableViewController: UITableViewController in PlayersViewController.swift.

Have I missed a step somewhere?

@bootfit : Itā€™s just a typo, use the PlayersViewController class :slight_smile:

The class I have in PlayersViewControllerCollectionViewController.swift is called PlayersViewControllerCollectionViewController: UICollectionViewController - is this the class youā€™re referring to?

@bootfit: There is no UICollectionView subclass in this project, the auto-completion must have played you a trick :

Add a new file to the project. Choose the Cocoa Touch Class template under iOS/Source. Name the class PlayersViewController and make it a subclass of UITableViewController. Uncheck Also create XIB file. Choose the Swift language and hit Next followed by Create.

Thanks - restarted from scratch and that issue has gone now - must have been an error on my part.

However Iā€™m now getting errors when I drop in the following code into PlayersViewController.swift

    override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
    return 1
}

override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return players.count
}

override func tableView(tableView: UITableView, cell, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCellWithIdentifier("PlayerCell", forIndexPath: indexPath)
    
    let player = players[indexPath.row] as Player
    cell.textLabel?.text = player.name
    cell.detailTextLabel?.text = player.game
    return cell
}

When I was typing it in the autocomplete was suggesting different code. Has the syntax changed since the article was published?


Yes, this article was updated to iOS 9.3, and Swift 2.2, but the syntax has slightly changed since. If you use the latest version of Xcode, ( 8.3.2 for now), youā€™ll use Swift 3.1.

Always use the autocomplete version :slight_smile:

1 Like

Thanx, this is very nice tutorial for beginners to learn the Auto Layout concepts.Keep it up.
http://codeschooltech.com/ios-training-in-pune-best-ios-training-institutes-in-pune-ios-courses-in-pune/