ios - Why is the label's text not updating? -




i'm trying pass data forward table view cell button view controller. depending on row button selected in want following view controller label's text set accordingly. however, when try so, labels in following view controller stay blank , don't change. how can change this?

i added action tipbutton in table view controller creates segue keyscontroller fyi.

code table view cell:

class drillstableviewcell: uitableviewcell {  var videourl:[url] = [url(fileurlwithpath: "/users/ralphsimmonds/desktop/plainjayne/coolindb/cook.mov"), url(fileurlwithpath: "/users/ralphsimmonds/desktop/plainjayne/coolindb/check.mov")] var video = url(fileurlwithpath: string()) var initialrow = int() var firsttips = ["tip 1: stay hydrated", "tip 1: keep elbow tucked", "x", "tip 1: take quick breaks:", "tip 1: keep head up", "tip 1: don't cross feet", "tip 1: don't more 15 reps"]  var player: avplayer? var playercontroller = avplayerviewcontroller()  @iboutlet weak var drilltitle: uilabel! @iboutlet weak var tipbutton: uibutton! @ibaction func tipsbutton(_ sender: uibutton) {     print(string(initialrow))      let tipsvc = uistoryboard(name: "main", bundle: nil).instantiateviewcontroller(withidentifier: "keyscontroller") as! keyscontroller     tipsvc.key1.text = firsttips[initialrow] } 

code view controller labels i'm trying update:

import uikit  class keyscontroller: uiviewcontroller {     @iboutlet weak var toplabel: uilabel!     @iboutlet weak var key1: uilabel!      override func viewdidload() {         super.viewdidload()     } } 

your outlets aren't wired until view loads.

try creating property in keyscontroller, say:

var keytext: string? 

set property after instantiating view controller:

tipsvc.keytext = firsttips[initialrow] 

then in keyscontroller.viewdidload method:

key1.text = keytext 




wiki

Comments

Popular posts from this blog

Asterisk AGI Python Script to Dialplan does not work -

python - Read npy file directly from S3 StreamingBody -

kotlin - Out-projected type in generic interface prohibits the use of metod with generic parameter -