Hello,
I have a TextView in a language different than english. I would like to add a button which translate this text in a text view to english and german. It can looks like this, in the Daily Art app:
Many thanks to any ideas and tips how to make it.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Created
Hello,
Im trying to open Each vc with each Table View Cell tapped. All I have manged to do is to open one VC with all of Table View Cells. I would like each cell to have open each VC. Here is my code:
RoutesController
import UIKit
class TrasyController: UIViewController,UITableViewDelegate, UITableViewDataSource {
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return routes.count
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell=tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath as IndexPath) as! TableTableViewCell
cell.photo.image=self.routesImages[indexPath .row]
cell.label.text=self.routes[indexPath .row]
cell.label_car.text=self.czas_auto[indexPath .row]
cell.label_bike.text=self.czas_rower[indexPath .row]
cell.label_walk.text=self.czas_pieszo[indexPath .row]
return cell
}
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath){
tableView.deselectRow(at: indexPath, animated: true)
performSegue(withIdentifier: "1", sender: self)
} //Here I can perform just one VC form all cells, I need each cell to open each VC (cell with name "one" opens "route1_vc"; cell with name "two" opens "route2_vc" etc.)
@IBOutlet weak var tableView: UITableView!
let routes = [("one"),("two"),("three")]
let routesImages = [UIImage(named: "1.jpeg"), UIImage(named: "2.jpeg"), UIImage(named: "3.jpeg")]
let czas_auto = [("2h"),("75m"),("2h50m")]
let czas_rower = [("2h"),("1h25n"),("3h50m")]
let czas_pieszo = [("2h"),("2h"),("4h50m")]
let vc = ["route1_vc","route2_vc","route3_vc"]
override func viewDidLoad() {
super.viewDidLoad()
tableView.delegate = self
tableView.dataSource = self
}
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
return 120
}
TableTableViewCell:
import UIKit
class TableTableViewCell: UITableViewCell {
@IBOutlet weak var photo: UIImageView!
@IBOutlet weak var label: UILabel!
@IBOutlet weak var label_car: UILabel!
@IBOutlet weak var label_bike: UILabel!
@IBOutlet weak var label_walk: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
override func setSelected(_ selected: Bool, animated: Bool) {
super.setSelected(selected, animated: animated)
// Configure the view for the selected state
}
}
Thank you in advance for your help.
I have added Scroll View and Stack View in it, but it does not seems to be the solution. I would like to have an effect like below: One photo and 3 labels under the photo in a container. I have 12 items like this, that is why I need ScrollView. Any ideas how to make it step by step? Here is the solution (airbnb app) I would like to have (I needed to put it on imgur, because there was an error, while adding a photo here):
https://imgur.com/pFY3DX5
Hello, as discussed in my previous topic with @Claude31 (Link ) I have a problem with riding off layout. Should I register the nib somewhere and in nib put constraints for a cell? Below I'm showing What I've got so far and how it looks like on device:
I have tried many solution but nothing helped, so i just putted constraints for collection view. I dont know how to put constraints for the cell (It is greyd out), maybe in nib file?:
I have defined there class and identifier.
Here is how it looks like on device:
I would like it to look like in the first screen shot (storyboard).
Here are my files connected with collectionview vc:
First one is Controller with code, another two are connected with the cell.
Here is the ModernizmCollectionViewCell file:
import UIKit
class ModernizmCollectionViewCell: UICollectionViewCell {
@IBOutlet weak var imageCell: UIImageView!
@IBOutlet weak var navButton: UIIButton!
@IBOutlet weak var title: UILabel!
@IBOutlet weak var subTitle: UILabel!
@IBOutlet weak var locationLabel: UILabel!
override func awakeFromNib() {
super.awakeFromNib()
// Initialization code
}
}
Many thank for your help.