Post

Replies

Boosts

Views

Activity

Open Multiple VCs from Cells in Table View
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.
1
0
821
Nov ’21
How can I make this kind of scroll menu?
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
10
0
2.2k
Nov ’21
Problem with layout - CollectionView
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.
6
0
2.2k
Nov ’21
MPRemoteCommandCenter - Remote controls on lock screen does not show up
Hello, I've implemented two functions in View controller (setupRemoteTransportControls() and setupNowPlaying()) and added one function to AppDelegate, but I'm still unable to see background audio controls of my app on the lock screen and also audio interruption function isn't working. This is the live stream from url, as you can spot on in the code. In the general settings I have added background playing: What I would like to do is to print on the Remote Command Center artist, title and albumArt, but but i was stuck just displaying the command center. I attach link my code on github, because it is too many characters to paste it: https://github.com/pawelzet/promil_new/blob/main/ViewController.swift Here is AppDelegate func that I've added:     func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {         application.beginReceivingRemoteControlEvents()      //    Override point for customization after application launch.        return true     }
2
0
4.2k
Jul ’22