Posts

Post not yet marked as solved
1 Replies
269 Views
I want to create an app, where after the user adds some text and an image to a View, they have the ability to share that View in PDF format as a report.Is there any simple way that a View can be converted / translated into a PDF without having to manually code all the relevant margines, etc.?I am a novice developer, so any example code would be appreciated.Xcode 11.3, Swift 5.Thanks in advance.
Posted
by Leksville.
Last updated
.
Post marked as solved
5 Replies
1.3k Views
I am trying to create a "simple" app that allows me to look up certain vehicles and gives me relevant information about it.I have been following a video made by someone creating an app showing how to move info from one tableview to another, but despite my best efforts, I keep getting "Cannot invoke 'indexPathForSelectedRow' with no arguments" error for the following line: var indexPath: NSIndexPath = self.tableView.indexPathForSelectedRow()!The video is a couple of years old, so I believe the video maker may have an older version of Xcode and or Swift, but it seems so close?The issue is in the first tableview controller file, I have included the second tableview controller file and tableview table in case either is causing the issue.Can anyone tell me what is going wrong?FIRST TABLEVIEW CONTROLLER:import Foundationimport UIKitclass VehicleMakeController: UITableViewController { var VehicleMakeArray = [String] () var VehicleModelArray = [VehicleModelTable] () override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. VehicleMakeArray = ["Ford", "Volkeswagon", "Peugeot"] VehicleModelArray = [VehicleModelTable(SecondTitle: ["Mondeo", "Focus", "Fiesta"]), VehicleModelTable(SecondTitle: ["Caddy", "Golf", "Passat"]), VehicleModelTable(SecondTitle: ["Partner", "208", "106"])] } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } override func numberOfSections(in tableView: UITableView) -> Int { return 1 } override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return VehicleMakeArray.count } override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = self.tableView.dequeueReusableCell(withIdentifier: "VehicleMakeCell", for: indexPath) as UITableViewCell // Configure the cell... cell.textLabel?.text = VehicleMakeArray [indexPath.row] return cell } override func prepare(for segue: UIStoryboardSegue, sender: Any?) { var indexPath: NSIndexPath = self.tableView.indexPathForSelectedRow()! var DestViewController = segue.destination as! VehicleModelController var VehicleModelArrayTwo: VehicleModelTable VehicleModelArrayTwo = VehicleModelArray[indexPath.row] DestViewController.VehicleModelArray = VehicleModelArrayTwo.SecondTitle }SECOND TABLEVIEW CONTROLLER:import Foundationimport UIKitclass VehicleModelController: UITableViewController { var VehicleModelArray = [String] () override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. } override func didReceiveMemoryWarning() { super.didReceiveMemoryWarning() // Dispose of any resources that can be recreated. } override func numberOfSections(in tableView: UITableView) -> Int { return 1 }func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int { return VehicleModelArray.count }func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell { let Cell = self.tableView.dequeueReusableCell(withIdentifier: "VehicleModelCell", for: indexPath as IndexPath) as UITableViewCell // Configure the cell... Cell.textLabel?.text = VehicleModelArray [indexPath.row] return Cell}}SECOND TABLEVIEW TABLEimport Foundationstruct VehicleModelTable { var SecondTitle: [String]}
Posted
by Leksville.
Last updated
.